Comments (4)
I am also wondering the same: I am pretty new to python (just landed to it) and I would like to make a query to Overpass and store the results in a geospatial format (e.g. GeoJSON).
After reading this documentation page 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;
""")
Unfortunately, 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.
from python-overpy.
There is a library to do osm to geojson osmtogeojson, but it requires to have the raw data (xml or json) as returned by Overpass API. I consider that doing geojson conversion is probably off-topic for overpy, but could be nice to have something like a raw
str
result returned fromoverpy
to use as input for other tools likeosmtogeojson
osmium-tools with "export" command is not well known but do the same (osm to geojson) efficiently (c compiled).
from python-overpy.
There is a library to do osm to geojson osmtogeojson, but it requires to have the raw data (xml or json) as returned by Overpass API. I consider that doing geojson conversion is probably off-topic for overpy, but could be nice to have something like a raw str
result returned from overpy
to use as input for other tools like osmtogeojson
from python-overpy.
There is a library to do osm to geojson osmtogeojson, but it requires to have the raw data (xml or json) as returned by Overpass API. I consider that doing geojson conversion is probably off-topic for overpy, but could be nice to have something like a raw
str
result returned fromoverpy
to use as input for other tools likeosmtogeojson
Overpass Python Wrapper gives back GEOJSON and also raw XML/JSON data in just a few lines of code.
https://github.com/mvexel/overpass-api-python-wrapper
from python-overpy.
Related Issues (20)
- delete this HOT 1
- Update/Write to .osm file
- Overpy requires wheel and does not install it if it's not present on the system. HOT 3
- Osint HOT 1
- Get osm_timestamp HOT 2
- Support for Overpass API /api/status
- Support PBF HOT 1
- change BaseException to Exception? HOT 1
- Is there a possibility to query a local Overpass db? HOT 2
- Polsby-Popper test
- Quering data from a localhost or patrticular osm file HOT 1
- querying data from local osm file HOT 4
- Query without parsing
- Unknown content type: text/html; charset="utf-8"
- Updating pip package HOT 3
- Road geometry extraction
- build is failing according to the readme badge
- .value() missed HOT 2
- Documentation custom url parameter
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-overpy.