Search code examples
openstreetmaptrafficoverpass-api

How to export the roadmap including traffic_signals and street_lamps of a city?


I would like to get some statistics about the roads, their deployed traffic lights, and the lampposts. Is there any way to get these statistics immediately for Shenzhen (China) city?

Secondly: how can I export the road network of a specific city (i.e., Shenzhen) including traffic_signals and street_lamps?

I have tried this code using Overpass API:

[out:csv(::id,::lat,::lon)][timeout:900];
    // gather results
    (
      node["highway"="street_lamp"](22.6242,113.6371,23.0628,114.5462);
    );
    // print results
    out body;

The query doesn't retrieve any results for Shenzhen's(China) coordinates(22.6242,113.6371,23.0628,114.5462).However, when applying on coordinates of London(51.3941,-0.2774,51.56,0.0879), it works and retrieves.

Moreover, when I do simple query like querying PoI:

[out:json][timeout:10];
// gather results
(
  node["leisure"](around: 200,22.5,113.9936701,22.6740047,113.9935278);
);
out body;

It also works although in Shenzhen(China). Any way to retrieve nodes tagged with 'street_lamp' and 'traffic_sign' in Chinese cities (i.e., Shenzhen)?


Solution

  • To query within boundaries, use the id of the city boundary's relation, then use map_to_area and then query with the the (area) filter:

    rel(3464353);
    map_to_area;
    node(area)["highway"="street_lamp"];
    out;