<div>Thank you for the clarification, Matheus and for the link, Dave (I am afraid that's not what I was looking for, as it still requires to download data on osm format).<br></div><div><br></div><div>I tried Bryce's code, which uses overpass api python wrapper (<a href="https://github.com/mvexel/overpass-api-python-wrapper">https://github.com/mvexel/overpass-api-python-wrapper</a>), and it just works fine! <br></div><div><br></div><div>Unfortunately, I have to admit that I don't wholly understand it (I have just landed in Python's world). Would you be so kind to explain the following?:<br></div><ol><li>Can I add the query in more than a single line? (the provided one is quite simple and still it is long) If so, how? (from what I am seeing Python is very strict  dealing with new lines)<br></li><li>what's going on after the result? I understand there's where the magic of creating a gjson file happens, but can't understand much about it.<br></li></ol><div>Regards and thank you again to everyone!<br></div><div><br></div><div class="protonmail_signature_block"><div class="protonmail_signature_block-user"><div>Carlos Cámara-Menoyo<br></div><div><a href="https://carloscamara.es" title="https://carloscamara.es">https://carloscamara.es</a><br></div></div><div class="protonmail_signature_block-proton protonmail_signature_block-empty"><br></div></div><div><br></div><div>‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐<br></div><div> On Monday 11 March de 2019 a les 18:34, Dave F via talk <talk@openstreetmap.org> wrote:<br></div><div> <br></div><blockquote class="protonmail_quote" type="cite"><div>Unsure, but would OSMtoGeojson be of use?<br></div><div> <a href="https://github.com/tyrasd/osmtogeojson">https://github.com/tyrasd/osmtogeojson</a><br></div><div> <br></div><div> DaveF<br></div><div> <br></div><div> <br></div><div class="moz-cite-prefix">On 11/03/2019 10:18, Carlos Cámara
      Menoyo via talk wrote:<br></div><blockquote type="cite"><pre wrap>Dear colleagues,

I have just started to use Python and I would like to make a query to Overpass and store the results in a geospatial format (e.g. GeoJSON) so I can programatically update the data.

As far as I know, there is a library called overpy that should be what I am looking for. After reading [its documentation](<a href="https://python-overpy.readthedocs.io/en/latest/example.html">https://python-overpy.readthedocs.io/en/latest/example.html</a>) I came up with the following code:

import

overpy

API

=

overpy

.

Overpass

()

# Fetch highways within Granollers' city.

result

=

API

.

query

(

"""
    area[name="Granollers"][admin_level=8];
    // query part for: “highway=*”
    (way["highway"](area);
    relation["highway"](area);
    );
    // print results
    out body;
    """

)

The thing is that I am not familiar at all with Python and I don't know how to store result as a GeoJSON file (Honestly, I don't even know what kind of thing result is -I tried with type(result) and I get overpy.Result as an output, which doesn't mean much to my poor knowledge). I have been reading overpy documentation but I haven't been able to figure it out.

Can anyone give me a clue with this?

Carlos Cámara-Menoyo
<a href="https://carloscamara.es">https://carloscamara.es</a><br></pre><div><br></div><div><br></div><pre wrap>_______________________________________________
talk mailing list
<a href="mailto:talk@openstreetmap.org">talk@openstreetmap.org</a>
<a href="https://lists.openstreetmap.org/listinfo/talk">https://lists.openstreetmap.org/listinfo/talk</a>
<br></pre></blockquote></blockquote><div><br></div>