Problems downloading and displaying .osm data in QGIS

757 views
Skip to first unread message

Douglas

unread,
Feb 20, 2014, 9:31:55 PM2/20/14
to nzop...@googlegroups.com
Hi all, I have two related questions that you might be able to help me with.  When I download data in .osm format (or .osm.bz2, or .osm.xz) and try to display in QGIS (v1.8.0) using the OpenStreetMap plugin, half the nodes lose their tags and become "dumb" nodes.  Has anyone come across this before, and how can I resolve this problem?  Also, what is the easiest way to download or convert a large extent (eg. regional) of school polygons to .osm format or shapefile?
Thanks.

Andin

unread,
Feb 20, 2014, 11:38:30 PM2/20/14
to nzop...@googlegroups.com
For the schools query, i imagine it would be easiest to grab all of NZ using your file of preference from here:
http://download.geofabrik.de/australia-oceania/new-zealand.html

Open it in JOSM, and run a search for anything school related, copy, paste into new layer, then save as OSM file.

For point data of NZ schools, this would be useful:
https://koordinates.com/layer/243-nz-schools/

Douglas

unread,
Feb 23, 2014, 5:48:02 PM2/23/14
to nzop...@googlegroups.com
Hi Andin.  I had downloaded .osm.bz2 files from Geofabrik and other sites, and these are the files that seem to be incomplete when opening in QGIS.  I just tried to open .osm and .bz2 files in JOSM but can't see the data after JOSM says "Parsing OSM data..."  Working with OSM data and applications is totally new to me, so I could just be doing something silly.
 
It is the school polygons I want to extract and convert into a nationwide GIS layer so I can run some spatial analysis on it.  If anyone has better luck in extracting these polygons out, please let me know.  Cheers.

Hamish

unread,
Feb 23, 2014, 6:15:01 PM2/23/14
to nzop...@googlegroups.com
Hi Douglas,

I'd suggest to use the Offramp OSM ("Xapi-like") interface to download
and extract just the data you need.

If the input data is valid & good (??) I'd suspect any trouble loading into
QGIS would have to do with the tag-matching filters in the QGIS osm plugin.

I've seen several approaches to tagging school grounds
boundaries/building polygons/single text labeled nodes, some at the
edge of the playing fields, some at approximate property boundaries.
So I wouldn't be surprised if a brittle rule based
filter has a little trouble.

example of a full bounding box extract, including metadata:

https://trac.osgeo.org/osgeo/browser/livedvd/gisvm/trunk/bin/install_osm.sh#L115
(sorry for the mess in the script)

Overpass instructions:
http://www.overpass-api.de/

see also
http://wiki.openstreetmap.org/wiki/OSM3S/install


unix (or msys) shell commands:

CITY="Portland_OR"
BBOX="-122.8,45.4,-122.5,45.6"
XAPI_URL="http://www.overpass-api.de/api/xapi?"
XAPI_EXTRA="[@meta]"
wget --progress=dot:mega -O "$CITY.osm" \
"${XAPI_URL}*[bbox=$BBOX]$XAPI_EXTRA"


add additional "[tag=label]" to the URL to restrict to the desired school
tags-only. That should get you a solid + specific extract to work with, and
JOSM should be happy with it.

If QGIS still doesn't like that let me know, I can probably load it in via GRASS
GIS's osm import script and convert to a format QGIS will be happy with.
I suspect shapefile format will not be ideal since it can't deal with
the multiple
polygon and point data types in a single layer.


regards,
Hamish
> --
> You received this message because you are subscribed to the Google Groups
> "nzopengis" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nzopengis+...@googlegroups.com.
> To post to this group, send email to nzop...@googlegroups.com.
> Visit this group at http://groups.google.com/group/nzopengis.
> For more options, visit https://groups.google.com/groups/opt_out.
>

Hamish

unread,
Mar 2, 2014, 10:04:58 PM3/2/14
to nzopengis
Hi Douglas,

You are probably well past this problem now, but for the archives or
in case it helps someone else...

Yesterday I had the chance to review/rewrite the QGIS tutorial for the
upcoming OSGeo Live sampler DVD (http://live.osgeo.org), which
includes a section on the OSM import tool. I thought I'd pass on what
I learned:

Apparently the old QGIS OSM Plugin wasn't 64bit-aware, and some months
ago the OSM project exceeded 32bit space, so any nodes newer than that
will have trouble with this tool. So it should work with old OSM
extracts, but not new ones.

Even though (in my opinion) the old OSM plugin was quite nice, it was
decided for QGIS 2.0 and newer that the old approach was fundamentally
flawed, and that it should be replaced by an inbuilt tool for
converting OSM xml files (.osm) to a SpatiaLite database, then have
the user connect to and query from the new spatialite database. So the
import and rendering process is no longer automatic, and not nearly as
simple, but I guess it front-loads most of the pain instead of leaving
it there to deal with later on.

Annoyingly it forces you to split out points, lines, and polygons into
separate database tables, I wish we could have retired that trouble
with shapefiles, but oh well.

some further reading,
http://adhoc.osgeo.osuosl.org/livedvd/docs/en/quickstart/qgis_quickstart.html
http://wiki.openstreetmap.org/wiki/QGIS_OSM_Plugin
http://wiki.openstreetmap.org/wiki/QGIS#QGIS2_OpenStreetMap_Vectors
http://gis.stackexchange.com/questions/73238/how-do-i-load-osm-vector-data-in-qgis-2-0

I haven't tested it with the newly released QGIS version 2.2 yet.


regards,
Hamish

Douglas

unread,
Mar 4, 2014, 5:58:44 PM3/4/14
to nzop...@googlegroups.com
Hi Hamish,
 
Thank you for all your help and input.  I had some time to get back into this now, so it is quite timely.  That now makes perfect sense that the old plug-in could only handle 32 bit - well done on the research!
 
I downloaded QGIS 2.2 and the new tools work perfectly!  I can extract and convert exactly what I want now and the processing time is fast.  The points, lines, and polygons are ideal - great for spatial analysis.
 
Thanks again,
Doug

 
Reply all
Reply to author
Forward
0 new messages