<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Unsure, but would OSMtoGeojson be of use?<br>
<a class="moz-txt-link-freetext" href="https://github.com/tyrasd/osmtogeojson">https://github.com/tyrasd/osmtogeojson</a><br>
<br>
DaveF<br>
<br>
<div class="moz-cite-prefix">On 11/03/2019 10:18, Carlos Cámara
Menoyo via talk wrote:<br>
</div>
<blockquote type="cite"
cite="mid:uamkK7lB61qcMC0qY-cKXTVVR8iwqxhXZlt-TAoDl09CSg5a60LsAaBYBklAosqyz2QJkigcISCnGJRGyMh946VcI-rdO9-APKascAcksCo=@pm.me">
<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 class="moz-txt-link-freetext" 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 class="moz-txt-link-freetext" href="https://carloscamara.es">https://carloscamara.es</a></pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
talk mailing list
<a class="moz-txt-link-abbreviated" href="mailto:talk@openstreetmap.org">talk@openstreetmap.org</a>
<a class="moz-txt-link-freetext" href="https://lists.openstreetmap.org/listinfo/talk">https://lists.openstreetmap.org/listinfo/talk</a>
</pre>
</blockquote>
<br>
</body>
</html>