The Stack Overflow podcast is back! Listen to an interview with our new CEO.

New answers tagged

0

You can do a one time download via https://www.openstreetmap.org/export#map=14/43.9402/4.8096 -> then click on the "Overpass API" link. This area is small enough to be downloaded via Overpass API, the resulting XML will be around 100MB.


0

Overpass API is not really the right tool for querying large data like all buildings and roads. It is rather suited for making specialized queries like all postboxes in an area. For rather large and complete extracts of OpenStreetMap (like in your case), I recommend to download from Geofabrik or OSMaxx.


0

You might want to try out osmium export, which is based on the libosmium library, a proven and widely used lib for high performance OSM processing: https://docs.osmcode.org/osmium/latest/osmium-export.html Installation instructions are available here: https://osmcode.org/osmium-tool/


2

Standalone tools You can try it with ogr2ogr using the OpenStreetMap driver. ogr2ogr -f GeoJSON output_points.json input.osm.pbf points ogr2ogr -f GeoJSON output_lines.json input.osm.pbf lines ... Note ogr2ogr reads OSM-files with 5 layers: points, lines, multilinestrings, multipolygons and other_relations. So you might need to repeat the upper command ...


1

If you know how to use PostGIS you can use the following query to construct a valid geojson: COPY ( SELECT jsonb_build_object( 'type', 'FeatureCollection', 'features', jsonb_agg(feature) ) FROM ( SELECT jsonb_build_object( 'type', 'Feature', 'id', id, 'geometry', ST_AsGeoJSON(geom)::jsonb, 'properties', to_jsonb(...


4

History files are still available from Geofabrik! You need to use their "OpenStreetMap internal server" download area, and log on with your OSM account. This was changed last year to accomodate for GDPR requirements. Link: https://osm-internal.download.geofabrik.de/


0

Use an online tool on the following website: https://export.hotosm.org


1

It should find the osmconf.ini local to the installation. You can override it using -o CONFIG_FILE=<yourpath>/osmconf.ini on the command line. (you might need OSM_CONFIG_FILE instead of CONFIG_FILE) You are probably also going to want to adjust your osmconf.ini to specify what is imported and what ignored. Also, how to handle closed ways,etc. Yes ...


3

By default, osm2pgsql transforms the raw geographic coordinates (EPSG:4326 - WGS84) to EPSG:3857; to populate the geom column in your gps_coordinates table accordingly (i.e. defined as GEOMETRY(POINT, 3857)), run UPDATE gps_coordinates SET geom = ST_Transform(ST_SetSRID(ST_MakePoint(longitude, latitude), 4326), 3857) ; After that, running SELECT a.id, ...


1

You are trying to match two different map projections. The default OpenStreetMap tiles use the EPSG:3857 coordinate reference system, AKA Web Mercator Projection. It looks like this: On the other hand, the Natural Earth files use the EPSG:4326 coordianate reference system, AKA equirectangular projection. It looks like this: The issue of map projections, ...


1

You should go to the Query panel and write your own query such as: [out:xml][timeout:25]; ( nwr["name"~"Costco(.*)"] ["shop"] ({{bbox}}); ); out body; >; out skel qt; or in XML format, so QuickOSM will be able to highlight it correctly: <osm-script output="xml" timeout="25"> <union> <query type="nwr"> <...


2

The documentation for ST_Distance states: For geometry type returns the minimum 2D Cartesian distance between two geometries in projected units (spatial ref units). Therefore, it is not returning meters like you assumed, it is returning degrees. Depending on your latitude, one degree is equal to around 111 KM! https://en.wikipedia.org/wiki/...


0

You might wan to try --tf accept-relations waterway=* --used-way --used-node or alternatively accept-ways


0

https://github.com/mapbox/awesome-vector-tiles#cli-utilities - a curated list of awesome things related to Vector Tiles (CLI, Servers, Clients, etc.) You can generate(serve) VEctor Tiles directly from PostgreSQL database (+PostGIS) using 't-rex' (https://github.com/t-rex-tileserver/t-rex) or 'tegola' (https://github.com/go-spatial/tegola) servers


0

Just adding this as an addendum to the accepted answer: It looks like ST_AsMVT (https://postgis.net/docs/ST_AsMVT.html) actually does support outputting more than just geometries - maybe that's new, I don't know. From the docs: The Mapbox Vector Tile format can store features with a different set of attributes per feature. To make use of this feature ...


0

I would recommend you using the HOT site to download OSM data. You can download data for a specific location or even draw a boundary for an area. and download only the road. https://export.hotosm.org/en/v3/exports/new/describe


0

After weeks of research and headache, I finally figured out the correct architecture of the local OSM server. My problem was that the employee who created the local OSM server hasn't actually finished his work (all he has done is cloning the open source OSM project and deploying it on the local server). Probably, the following information won't be helpful ...


1

Found the issue. Specifically this code: # GetNextFeature handles interleaved reading correctly for ily in range (0,nly): layer = ds.GetLayerByIndex(ily) I initially replaced it with: # GetNextFeature handles interleaved reading correctly for ily in (0,1,2,4,3): layer = ds.GetLayerByIndex(ily) ...which appeared to work. It ensures Layer 4 ("...


2

As demonstrated by @ArturoMendes , Using Overpass API it is possible to do queries in a nice way , there is much information on the OSM Wiki, OSM Wiki Link. On the OSM Wiki there is a list of public global Overpass API providers you can query against. This list is reproduced below and is not complete https://lz4.overpass-api.de/api/interpreter https://z....


3

Even though this blog is in Spanish, it will let you know about OSM data and how to make a request from Python. You'll find the code there too. import requests import json overpass_url = "http://overpass-api.de/api/interpreter" overpass_query = """ [out:json]; area["name"="Málaga"][admin_level=8]; (node["amenity"="restaurant"](area); node["amenity"="bar"](...


0

Convert the .geojson to .poly format, then use the -B option in osmconvert. Grab ogr2poly.py from https://github.com/suke-blog/ogr2poly.py . This is a python2 script. python2 ogr2poly.py "area.geojson" This generates a .poly file in the same folder like area_0.poly. Run osmconvert: osmconvert india-latest.osm.pbf -B="area_0.poly" --complete-ways -o=area2....


3

If you want to use QuickMapServices 1) go to Web -> QuickMapServices -> Settings 2) add/edit/remove -> create service from existing (3.a) or create new service (3.b) 3.a) If you chose create service from existing choose the one you want to edit. 3.b) If you create a new service choose TMS as Type 4) in TMS tab edit the url and insert your api key


3

As stated on an example at thunderforest.com use https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=<insert-your-apikey-here>. You can add XYZ-Tiles to QGIS via Browser -> XYZ-Tiles -> New Connection


Top 50 recent answers are included