Center of mass of one feature to most distant point of the next

This commit is contained in:
Erica Fischer
2024-07-08 12:05:31 -07:00
parent cc809157c7
commit 453b37a920
5 changed files with 204 additions and 181 deletions
+5 -5
View File
@@ -9,7 +9,7 @@
"maxzoom": "13",
"minzoom": "11",
"name": "tests/muni/out/-Z11_-z13_-M5000_-as.json.check.mbtiles",
"strategies": "[{},{},{},{},{},{},{},{},{},{},{},{\"dropped_by_rate\":4080,\"dropped_as_needed\":480,\"tile_size_desired\":10887},{\"dropped_by_rate\":2974,\"dropped_as_needed\":1344,\"tile_size_desired\":10721},{\"dropped_as_needed\":3059,\"tile_size_desired\":9664}]",
"strategies": "[{},{},{},{},{},{},{},{},{},{},{},{\"dropped_by_rate\":4080,\"dropped_as_needed\":480,\"tile_size_desired\":10887},{\"dropped_by_rate\":2974,\"dropped_as_needed\":1345,\"tile_size_desired\":10721},{\"dropped_as_needed\":3058,\"tile_size_desired\":9664}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -1423,8 +1423,6 @@
,
{ "type": "Feature", "properties": { "name": "Geary Blvd & Franklin St" }, "geometry": { "type": "Point", "coordinates": [ -122.422886, 37.785572 ] } }
,
{ "type": "Feature", "properties": { "name": "Mcallister St & Gough St" }, "geometry": { "type": "Point", "coordinates": [ -122.423851, 37.779687 ] } }
,
{ "type": "Feature", "properties": { "name": "Van Ness Ave & Eddy St" }, "geometry": { "type": "Point", "coordinates": [ -122.420719, 37.783197 ] } }
,
{ "type": "Feature", "properties": { "name": "Mcallister St & Fillmore St" }, "geometry": { "type": "Point", "coordinates": [ -122.431405, 37.778618 ] } }
@@ -4465,6 +4463,8 @@
,
{ "type": "Feature", "properties": { "name": "University St & Bacon St" }, "geometry": { "type": "Point", "coordinates": [ -122.413541, 37.725142 ] } }
,
{ "type": "Feature", "properties": { "name": "University St & Wayland St" }, "geometry": { "type": "Point", "coordinates": [ -122.413069, 37.723928 ] } }
,
{ "type": "Feature", "properties": { "name": "Woolsey St & Colby St" }, "geometry": { "type": "Point", "coordinates": [ -122.411449, 37.722944 ] } }
,
{ "type": "Feature", "properties": { "name": "University St & Woolsey St" }, "geometry": { "type": "Point", "coordinates": [ -122.412533, 37.722732 ] } }
@@ -5051,6 +5051,8 @@
,
{ "type": "Feature", "properties": { "name": "Bryant St & 18th St" }, "geometry": { "type": "Point", "coordinates": [ -122.410204, 37.761869 ] } }
,
{ "type": "Feature", "properties": { "name": "Bryant St & 19th St" }, "geometry": { "type": "Point", "coordinates": [ -122.410076, 37.760579 ] } }
,
{ "type": "Feature", "properties": { "name": "Folsom St & 22nd St" }, "geometry": { "type": "Point", "coordinates": [ -122.414335, 37.755948 ] } }
,
{ "type": "Feature", "properties": { "name": "Powell St & Geary Blvd" }, "geometry": { "type": "Point", "coordinates": [ -122.408327, 37.787462 ] } }
@@ -5189,8 +5191,6 @@
,
{ "type": "Feature", "properties": { "name": "Potrero Ave & Alameda St" }, "geometry": { "type": "Point", "coordinates": [ -122.407919, 37.768442 ] } }
,
{ "type": "Feature", "properties": { "name": "Potrero Ave & 16th St" }, "geometry": { "type": "Point", "coordinates": [ -122.408198, 37.766347 ] } }
,
{ "type": "Feature", "properties": { "name": "Potrero Ave & 17th St" }, "geometry": { "type": "Point", "coordinates": [ -122.407351, 37.764736 ] } }
,
{ "type": "Feature", "properties": { "name": "16th St & San Bruno Ave" }, "geometry": { "type": "Point", "coordinates": [ -122.405516, 37.765864 ] } }
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+12 -7
View File
@@ -1049,16 +1049,21 @@ static serial_feature next_feature(decompressor *geoms, std::atomic<long long> *
if (sf.gap == 0) {
if (sf.index != previndex) {
long long ox = (1LL << (32 - z)) * tx;
long long oy = (1LL << (32 - z)) * ty;
unsigned wx1, wy1;
decode_index(sf.index, &wx1, &wy1);
decode_index(previndex, &wx1, &wy1);
unsigned wx2, wy2;
decode_index(previndex, &wx2, &wy2);
for (auto const &g : sf.geometry) {
long long dx = (long long) wx1 - (g.x + ox);
long long dy = (long long) wy1 - (g.y + oy);
long long dx = (long long) wx1 - wx2;
long long dy = (long long) wy1 - wy2;
sf.gap = dx * dx + dy * dy;
unsigned long long d = dx * dx + dy * dy;
if (d > sf.gap) {
sf.gap = d;
}
}
}
}
previndex = sf.index;