I am trying to download ALL the OpenStreetMap data for a certain region. Meaning, I want the roads, the stores, the rivers, the parks, the traffic signals, the bus stops, ... everything. I'm expecting that results to be big, so I plan do it for a specific administrative area at a time, and sweep the relevant admin areas. However, if there is a way to retrieve and download all the data for a larger region, I'm interested in that too. I know how to get all the data of one type by using the Overpass-Turbo wizard; for example, to get all the "highway" data in Shinjuku, this worked:

// gather results
  // query part for: “highway=*”
out body;
out skel qt;

Ideally I'd be able to enter "*" in place of "highway" and get everything, but that didn't work. I could sweep the types, but I can't find a list of all available element types, so I can't do a "highway or station or ..." type command manually either.

How do I select all kinds of elements?

My current plan is to incorporate that into a Python-based query to get, format, and save the data using a script like the one below. It's basically the same as the Overpass Turbo wizard query, but note the last line.

tokyo_areacode = 3601543125
query = f"""
        // query part for: “railway=station”
    // print results
    out body;
    out skel qt;
    api = overpass.API(timeout=900)
    result = api.get(query, responseformat='csv(::id,::lat,::lon,name)')

Because I'm getting all the data, I want to save all the data too, and I think JSON is best for me in this case (I'm going to load it into NetworkX).

How do I write the responseformat to save all the tags for all the elements as a JSON?

It may seem like two questions, but it's just one question about how to get ALL the data for an area, and I highlighted the two steps in that process where I can't find any solutions.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.