anvaka / city-roads

Visualization of all roads within any city
https://anvaka.github.io/city-roads/
MIT License
6.04k stars 448 forks source link

Map Scale #33

Closed pqhf5kd closed 4 years ago

pqhf5kd commented 4 years ago

I want to compare two cities but the export function exports the current zoom level, not a scale image. Is it possible to load a particular scale in the console?

pqhf5kd commented 4 years ago

While it's not exactly what I originally asked for, here is the method I used to compare two cities side by side with a custom query.

  1. scene.clear();
  2. 
    scene.load('', {
    raw: `[out:json][timeout:250];
    (
    (
    way[highway=cycleway](around:7000, {{geocodeCoords:CITY1}}); 
    node(w);
    );
    (
    way[bicycle=designated](around:7000, {{geocodeCoords:CITY1}});
    node(w);
    );
    );
    out skel;`
    })
3.

scene.load('', { raw: [out:json][timeout:250]; ( ( way[highway=cycleway](around:7000, {{geocodeCoords:CITY2}}); node(w); ); ( way[bicycle=designated](around:7000, {{geocodeCoords:CITY2}}); node(w); ); ); out skel; })


4. `allLayers = scene.queryLayerAll()`
5. `allLayers[0].moveBy(/* xOffset = */ 25000, /* yOffset = */ 0)`

Here you can see I was looking for cycleways and ways designated for bicycles.
I wasn't sure how to change the layer ID when loading a query but it's possible to move a layer by it's default ID.