Skip to content

Commit

Permalink
Manually create clipping boundaries for all test cases. Display in St…
Browse files Browse the repository at this point in the history
…reetExplorer. #127
  • Loading branch information
dabreegster committed Dec 12, 2022
1 parent 687bd9b commit db64e89
Show file tree
Hide file tree
Showing 29 changed files with 42 additions and 2 deletions.
2 changes: 1 addition & 1 deletion street-explorer/www/js/layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export const makeDebugLayer = (text) => {
};

export const makeBoundaryLayer = (geojson) => {
return new L.geoJSON(geojson);
return new L.geoJSON(geojson, { interactive: false });
};

export const layerMakers = {
Expand Down
11 changes: 10 additions & 1 deletion street-explorer/www/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class StreetExplorer {

// Set up controls for importing via rectangle and polygon boundaries.
// TODO This is flaky. What do we do when geoman's magic init doesn't happen by now?
if (app.map.pm) {
if (app.map.pm && app.currentTest == null) {
app.map.pm.addControls({
position: "bottomright",
editControls: false,
Expand Down Expand Up @@ -133,11 +133,13 @@ class TestCase {
const osmInput = await loadFile(prefix + "input.osm");
const geometry = await loadFile(prefix + "geometry.json");
const network = await loadFile(prefix + "road_network.dot");
const boundary = await loadFile(prefix + "boundary.json");

const geometryLayer = makePlainGeoJsonLayer(geometry);
const bounds = geometryLayer.getBounds();

var group = new LayerGroup("built-in test case", app.map);
group.addLayer("Boundary", makeBoundaryLayer(JSON.parse(boundary)));
group.addLayer("OSM", makeOsmLayer(osmInput), { enabled: false });
group.addLayer("Network", await makeDotLayer(network, { bounds }));
group.addLayer("Geometry", geometryLayer);
Expand Down Expand Up @@ -204,6 +206,13 @@ class TestCase {
this.app.layers.removeGroups((name) => name != "built-in test case");
// Then disable the original group. Seeing dueling geometry isn't a good default.
this.app.layers.getGroup("built-in test case").setEnabled(false);
// But keep the boundary on
const boundaryLayer = this.app.layers.getLayer(
"built-in test case",
"Boundary"
);
boundaryLayer.enabled = true;
this.app.map.addLayer(boundaryLayer.getData());

importOSM("Details", this.app, this.osmXML, false, null);
};
Expand Down
1 change: 1 addition & 0 deletions tests/src/arizona_highways/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[-111.89157680665546,33.63105171499508],[-111.88932943304057,33.6311018367018],[-111.88925418615612,33.62849129234626],[-111.89155674081962,33.62852053088113],[-111.89237442363043,33.62965664912229],[-111.89157680665546,33.63105171499508]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/aurora_sausage_link/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[-122.34485637402513,47.692542375442635],[-122.34424365879015,47.69253914074448],[-122.34421722793687,47.69167870390754],[-122.344946802417,47.69169164291247],[-122.34485637402513,47.692542375442635]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/borough_sausage_links/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[-0.09134105017577723,51.50174879718557],[-0.09134105017577723,51.50057027013801],[-0.0928575645918417,51.500269524702695],[-0.09419217886549759,51.5011849124486],[-0.09295418824965652,51.50192735923107],[-0.09134105017577723,51.50174879718557]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/bristol_contraflow_cycleway/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[-2.5550039037546313,51.45721968193698],[-2.5550039037546313,51.45812026848635],[-2.5513788952537384,51.45812026848635],[-2.5513788952537384,51.45721968193698],[-2.5550039037546313,51.45721968193698]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/bristol_sausage_links/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[-2.55193057180406,51.459361328717854],[-2.55193057180406,51.45998448275898],[-2.549679240586589,51.45998448275898],[-2.549679240586589,51.459361328717854],[-2.55193057180406,51.459361328717854]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/cycleway_rejoin_road/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[-0.11515156604013256,51.48872585472985],[-0.11763673893444573,51.489470186484745],[-0.11627775831374977,51.491033243616585],[-0.1139121253814457,51.49003038605417],[-0.11515156604013256,51.48872585472985]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/fremantle_placement/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[115.75669366197116,-32.036279605513386],[115.75581950286569,-32.037038142644455],[115.75435798226158,-32.03737656487569],[115.75398858694406,-32.036114282484085],[115.75572084448898,-32.03557941181485],[115.75669366197116,-32.036279605513386]]],"type":"Polygon"}}]}
5 changes: 5 additions & 0 deletions tests/src/fremantle_placement/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"notes": [
"An example with many uses of the placement tag."
]
}
1 change: 1 addition & 0 deletions tests/src/i5_exit_ramp/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[-122.32315814342475,47.65489764271366],[-122.32315814342475,47.65787470606149],[-122.32068762595378,47.65787470606149],[-122.32068762595378,47.65489764271366],[-122.32315814342475,47.65489764271366]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/kingsway_junction/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[-2.304941450665932,53.44520111864422],[-2.308606257009887,53.44523951571749],[-2.3073020025194184,53.446955534095565],[-2.3045645558321897,53.44615217439695],[-2.304941450665932,53.44520111864422]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/leeds_cycleway/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[-1.5318995212964672,53.79625901498703],[-1.5360325435716524,53.79566669743701],[-1.537578077759077,53.799454526075614],[-1.5348835100061733,53.800382987673466],[-1.5324116249694146,53.799911863217034],[-1.5318995212964672,53.79625901498703]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/montlake_roundabout/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[-122.3044506459959,47.638817085508826],[-122.3044506459959,47.640070376815665],[-122.30288919047386,47.640070376815665],[-122.30288919047386,47.638817085508826],[-122.3044506459959,47.638817085508826]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/northgate_dual_carriageway/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[-122.32177366632588,47.707170849642964],[-122.32826919536443,47.70729910438648],[-122.32826204119196,47.70927951198621],[-122.32404264711572,47.70902577704933],[-122.32394512645139,47.710657533605335],[-122.32237179306702,47.710613787447265],[-122.32177366632588,47.707170849642964]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/oneway_loop/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[-0.10427881832325125,51.50221215716761],[-0.10427881832325125,51.503806874788424],[-0.10168038991039466,51.503806874788424],[-0.10168038991039466,51.50221215716761],[-0.10427881832325125,51.50221215716761]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/perth_peanut_roundabout/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[115.90218174086604,-31.980994167015716],[115.90091845514306,-31.98199206766575],[115.89939455782991,-31.980818438106787],[115.90079335909495,-31.979789490253967],[115.90218174086604,-31.980994167015716]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/perth_stretched_lights/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[115.89809805679887,-31.974765118750916],[115.89770967221675,-31.975478426704033],[115.8969970231487,-31.97474491604841],[115.89760341605752,-31.97433464482027],[115.89809805679887,-31.974765118750916]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/quad_intersection/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[-122.30193863820924,47.64366768502663],[-122.30463428403283,47.643330294018945],[-122.30479410493146,47.64480546629571],[-122.30330244321088,47.64513208031529],[-122.30193863820924,47.64366768502663]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/roosevelt_cycletrack/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[-122.3184194997658,47.67190982018071],[-122.31640087772388,47.67190982018071],[-122.31594725479313,47.66066732761932],[-122.31839681861928,47.660697880026575],[-122.3184194997658,47.67190982018071]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/seattle_slip_lane/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[-122.31876980436802,47.660728824581334],[-122.31876980436802,47.661973128504286],[-122.31624774033094,47.661973128504286],[-122.31624774033094,47.660728824581334],[-122.31876980436802,47.660728824581334]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/seattle_triangle/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[-122.33883289670288,47.616751856170374],[-122.33849315953144,47.61710011516509],[-122.33765637979744,47.617046609481314],[-122.33694921224456,47.616382882058026],[-122.33774131608624,47.61592057549675],[-122.33883289670288,47.61620899680358],[-122.33883289670288,47.616751856170374]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/service_road_loop/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[-2.5662722807935356,51.46087979417534],[-2.5673906951791796,51.46050369075257],[-2.5679387922953127,51.46094209321607],[-2.5674666140364804,51.4612558944987],[-2.5664889272887796,51.461135911910105],[-2.5662722807935356,51.46087979417534]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/st_georges_cycletrack/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[-0.10100846954776534,51.49606929596047],[-0.10022569729213117,51.49469733764069],[-0.10153598998092096,51.49431063922609],[-0.10902337677391129,51.49668375039062],[-0.1091850362614877,51.49758952586778],[-0.10713451328749014,51.497955009121355],[-0.10100846954776534,51.49606929596047]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/taipei/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[121.5214689267763,25.051601312022886],[121.5214689267763,25.05319056180579],[121.52380079296731,25.05319056180579],[121.52380079296731,25.051601312022886],[121.5214689267763,25.051601312022886]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/tempe_light_rail/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[-111.91022313394404,33.413782564757305],[-111.91022313394404,33.4157878631309],[-111.90806660096491,33.4157878631309],[-111.90806660096491,33.413782564757305],[-111.91022313394404,33.413782564757305]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/tempe_split/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[-111.9406688366367,33.42156652709828],[-111.9406688366367,33.42267126806258],[-111.93853925848752,33.42267126806258],[-111.93853925848752,33.42156652709828],[-111.9406688366367,33.42156652709828]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/tiny_loop/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[-88.43662419840753,44.24067965573533],[-88.43662419840753,44.24425087609072],[-88.43132417932634,44.24425087609072],[-88.43132417932634,44.24067965573533],[-88.43662419840753,44.24067965573533]]],"type":"Polygon"}}]}
1 change: 1 addition & 0 deletions tests/src/tiny_roundabout/boundary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[-122.27334687938139,47.53295626161783],[-122.27334687938139,47.535546547236635],[-122.27164644222555,47.535546547236635],[-122.27164644222555,47.53295626161783],[-122.27334687938139,47.53295626161783]]],"type":"Polygon"}}]}

0 comments on commit db64e89

Please sign in to comment.