4

I want to import polygons representing buildings in my local area from OSM into QGIS (v 2.18.11). Regular polygons are fine. There are also 3 buildings represented by multipolygon relations in the data set, which have internal courtyards (polygons with role=inner). All 3 render correctly in both OpenStreetMap itself and JOSM (one of the buildings omitted for more clarity):

enter image description here

One of them renders correctly in QGIS (ie like a square doughnut), but the others have the courtyard filled in:

enter image description here

The XML code for the 3 objects is as follows:

<?xml version='1.0' encoding='UTF-8'?>
<osm version='0.6' generator='JOSM'>
  <node id='-82116' action='modify' lat='53.4456028' lon='-2.2521999' />
  <node id='-82117' action='modify' lat='53.4455817' lon='-2.2530796' />
  <node id='-82118' action='modify' lat='53.4458295' lon='-2.2530963' />
  <node id='-82119' action='modify' lat='53.445833' lon='-2.2529503' />
  <node id='-82120' action='modify' lat='53.4458649' lon='-2.2529524' />
  <node id='-82121' action='modify' lat='53.4458644' lon='-2.2529758' />
  <node id='-82122' action='modify' lat='53.4459204' lon='-2.2529796' />
  <node id='-82123' action='modify' lat='53.4459224' lon='-2.2528941' />
  <node id='-82124' action='modify' lat='53.445867' lon='-2.2528903' />
  <node id='-82125' action='modify' lat='53.4458664' lon='-2.2529122' />
  <node id='-82126' action='modify' lat='53.4458339' lon='-2.25291' />
  <node id='-82127' action='modify' lat='53.4458481' lon='-2.2523171' />
  <node id='-82128' action='modify' lat='53.4458957' lon='-2.2523203' />
  <node id='-82129' action='modify' lat='53.4458917' lon='-2.2524881' />
  <node id='-82130' action='modify' lat='53.4459696' lon='-2.2524933' />
  <node id='-82131' action='modify' lat='53.4459762' lon='-2.2522193' />
  <node id='-82132' action='modify' lat='53.4458986' lon='-2.2522141' />
  <node id='-82133' action='modify' lat='53.4458972' lon='-2.2522734' />
  <node id='-82134' action='modify' lat='53.4458492' lon='-2.2522702' />
  <node id='-82135' action='modify' lat='53.4458505' lon='-2.2522166' />
  <node id='-82136' action='modify' lat='53.4456481' lon='-2.2529877' />
  <node id='-82137' action='modify' lat='53.4456599' lon='-2.2524564' />
  <node id='-82138' action='modify' lat='53.4457869' lon='-2.2524644' />
  <node id='-82139' action='modify' lat='53.4457752' lon='-2.2529956' />
  <node id='-82140' action='modify' lat='53.4562862' lon='-2.2581721' />
  <node id='-82141' action='modify' lat='53.4562833' lon='-2.2576752' />
  <node id='-82142' action='modify' lat='53.4562712' lon='-2.2576754' />
  <node id='-82143' action='modify' lat='53.45627' lon='-2.2574823' />
  <node id='-82144' action='modify' lat='53.4560722' lon='-2.2574856' />
  <node id='-82145' action='modify' lat='53.4560735' lon='-2.257701' />
  <node id='-82146' action='modify' lat='53.456053' lon='-2.2577014' />
  <node id='-82147' action='modify' lat='53.4560558' lon='-2.2581759' />
  <node id='-82148' action='modify' lat='53.4561249' lon='-2.2581748' />
  <node id='-82149' action='modify' lat='53.4561253' lon='-2.2582369' />
  <node id='-82150' action='modify' lat='53.4562227' lon='-2.2582353' />
  <node id='-82151' action='modify' lat='53.4562223' lon='-2.2581732' />
  <node id='-82152' action='modify' lat='53.4562008' lon='-2.257637' />
  <node id='-82153' action='modify' lat='53.4561405' lon='-2.257638' />
  <node id='-82154' action='modify' lat='53.4561417' lon='-2.2578328' />
  <node id='-82155' action='modify' lat='53.4562019' lon='-2.2578318' />
  <node id='-82156' action='modify' lat='53.4427909' lon='-2.247667' />
  <node id='-82157' action='modify' lat='53.4428017' lon='-2.2471454' />
  <node id='-82158' action='modify' lat='53.4428214' lon='-2.2471466' />
  <node id='-82159' action='modify' lat='53.4428271' lon='-2.2468694' />
  <node id='-82160' action='modify' lat='53.4428091' lon='-2.2468684' />
  <node id='-82161' action='modify' lat='53.4428201' lon='-2.2463379' />
  <node id='-82162' action='modify' lat='53.4427518' lon='-2.2463339' />
  <node id='-82163' action='modify' lat='53.4427551' lon='-2.2461757' />
  <node id='-82164' action='modify' lat='53.4428263' lon='-2.2461798' />
  <node id='-82165' action='modify' lat='53.4428369' lon='-2.2456674' />
  <node id='-82166' action='modify' lat='53.4423019' lon='-2.2456362' />
  <node id='-82167' action='modify' lat='53.4423005' lon='-2.2457046' />
  <node id='-82168' action='modify' lat='53.4422665' lon='-2.2457027' />
  <node id='-82169' action='modify' lat='53.4422678' lon='-2.24564' />
  <node id='-82170' action='modify' lat='53.4420409' lon='-2.2456268' />
  <node id='-82171' action='modify' lat='53.4420353' lon='-2.2458989' />
  <node id='-82172' action='modify' lat='53.4422601' lon='-2.245912' />
  <node id='-82173' action='modify' lat='53.4422625' lon='-2.245799' />
  <node id='-82174' action='modify' lat='53.4423039' lon='-2.2458014' />
  <node id='-82175' action='modify' lat='53.4422968' lon='-2.2461442' />
  <node id='-82176' action='modify' lat='53.4427219' lon='-2.2461689' />
  <node id='-82177' action='modify' lat='53.442719' lon='-2.2463057' />
  <node id='-82178' action='modify' lat='53.4426932' lon='-2.2463042' />
  <node id='-82179' action='modify' lat='53.4426929' lon='-2.2463176' />
  <node id='-82180' action='modify' lat='53.442511' lon='-2.246307' />
  <node id='-82181' action='modify' lat='53.4425127' lon='-2.246221' />
  <node id='-82182' action='modify' lat='53.442467' lon='-2.2462184' />
  <node id='-82183' action='modify' lat='53.4424653' lon='-2.2463008' />
  <node id='-82184' action='modify' lat='53.442429' lon='-2.2462987' />
  <node id='-82185' action='modify' lat='53.4424308' lon='-2.246209' />
  <node id='-82186' action='modify' lat='53.4423386' lon='-2.2462037' />
  <node id='-82187' action='modify' lat='53.4423096' lon='-2.2476056' />
  <node id='-82188' action='modify' lat='53.4420757' lon='-2.247592' />
  <node id='-82189' action='modify' lat='53.4420874' lon='-2.2470251' />
  <node id='-82190' action='modify' lat='53.4419539' lon='-2.2470173' />
  <node id='-82191' action='modify' lat='53.4419293' lon='-2.248207' />
  <node id='-82192' action='modify' lat='53.4420631' lon='-2.2482148' />
  <node id='-82193' action='modify' lat='53.4420662' lon='-2.2480639' />
  <node id='-82194' action='modify' lat='53.4422345' lon='-2.2480737' />
  <node id='-82195' action='modify' lat='53.4422352' lon='-2.2480419' />
  <node id='-82196' action='modify' lat='53.4423948' lon='-2.2480512' />
  <node id='-82197' action='modify' lat='53.4424032' lon='-2.2476444' />
  <node id='-82198' action='modify' lat='53.4426973' lon='-2.2474874' />
  <node id='-82199' action='modify' lat='53.4427049' lon='-2.2470988' />
  <node id='-82200' action='modify' lat='53.442487' lon='-2.2470868' />
  <node id='-82201' action='modify' lat='53.4424794' lon='-2.2474754' />
  <node id='-82202' action='modify' lat='53.4427083' lon='-2.2469032' />
  <node id='-82203' action='modify' lat='53.4427176' lon='-2.2465111' />
  <node id='-82204' action='modify' lat='53.442434' lon='-2.2464921' />
  <node id='-82205' action='modify' lat='53.4424247' lon='-2.2468842' />
  <way id='-82099' action='modify'>
    <nd ref='-82116' />
    <nd ref='-82117' />
    <nd ref='-82118' />
    <nd ref='-82119' />
    <nd ref='-82120' />
    <nd ref='-82121' />
    <nd ref='-82122' />
    <nd ref='-82123' />
    <nd ref='-82124' />
    <nd ref='-82125' />
    <nd ref='-82126' />
    <nd ref='-82127' />
    <nd ref='-82128' />
    <nd ref='-82129' />
    <nd ref='-82130' />
    <nd ref='-82131' />
    <nd ref='-82132' />
    <nd ref='-82133' />
    <nd ref='-82134' />
    <nd ref='-82135' />
    <nd ref='-82116' />
  </way>
  <way id='-82100' action='modify'>
    <nd ref='-82136' />
    <nd ref='-82137' />
    <nd ref='-82138' />
    <nd ref='-82139' />
    <nd ref='-82136' />
  </way>
  <way id='-82101' action='modify'>
    <nd ref='-82140' />
    <nd ref='-82141' />
    <nd ref='-82142' />
    <nd ref='-82143' />
    <nd ref='-82144' />
    <nd ref='-82145' />
    <nd ref='-82146' />
    <nd ref='-82147' />
    <nd ref='-82148' />
    <nd ref='-82149' />
    <nd ref='-82150' />
    <nd ref='-82151' />
    <nd ref='-82140' />
  </way>
  <way id='-82102' action='modify'>
    <nd ref='-82152' />
    <nd ref='-82153' />
    <nd ref='-82154' />
    <nd ref='-82155' />
    <nd ref='-82152' />
  </way>
  <way id='-82103' action='modify'>
    <nd ref='-82156' />
    <nd ref='-82157' />
    <nd ref='-82158' />
    <nd ref='-82159' />
    <nd ref='-82160' />
    <nd ref='-82161' />
    <nd ref='-82162' />
    <nd ref='-82163' />
    <nd ref='-82164' />
    <nd ref='-82165' />
    <nd ref='-82166' />
    <nd ref='-82167' />
    <nd ref='-82168' />
    <nd ref='-82169' />
    <nd ref='-82170' />
    <nd ref='-82171' />
    <nd ref='-82172' />
    <nd ref='-82173' />
    <nd ref='-82174' />
    <nd ref='-82175' />
    <nd ref='-82176' />
    <nd ref='-82177' />
    <nd ref='-82178' />
    <nd ref='-82179' />
    <nd ref='-82180' />
    <nd ref='-82181' />
    <nd ref='-82182' />
    <nd ref='-82183' />
    <nd ref='-82184' />
    <nd ref='-82185' />
    <nd ref='-82186' />
    <nd ref='-82187' />
    <nd ref='-82188' />
    <nd ref='-82189' />
    <nd ref='-82190' />
    <nd ref='-82191' />
    <nd ref='-82192' />
    <nd ref='-82193' />
    <nd ref='-82194' />
    <nd ref='-82195' />
    <nd ref='-82196' />
    <nd ref='-82197' />
    <nd ref='-82156' />
  </way>
  <way id='-82104' action='modify'>
    <nd ref='-82198' />
    <nd ref='-82199' />
    <nd ref='-82200' />
    <nd ref='-82201' />
    <nd ref='-82198' />
  </way>
  <way id='-82105' action='modify'>
    <nd ref='-82202' />
    <nd ref='-82203' />
    <nd ref='-82204' />
    <nd ref='-82205' />
    <nd ref='-82202' />
  </way>
  <relation id='-82093' action='modify'>
    <member type='way' ref='-82099' role='outer' />
    <member type='way' ref='-82100' role='inner' />
    <tag k='addr:housenumber' v='61A' />
    <tag k='addr:street' v='Brantingham Road' />
    <tag k='building' v='residential' />
    <tag k='name' v='Hartley Hall of Residence' />
    <tag k='type' v='multipolygon' />
  </relation>
  <relation id='-82094' action='modify'>
    <member type='way' ref='-82101' role='outer' />
    <member type='way' ref='-82102' role='inner' />
    <tag k='addr:housenumber' v='51' />
    <tag k='addr:street' v='Withington Road' />
    <tag k='building' v='yes' />
    <tag k='type' v='multipolygon' />
  </relation>
  <relation id='-82095' action='modify'>
    <member type='way' ref='-82103' role='outer' />
    <member type='way' ref='-82104' role='inner' />
    <member type='way' ref='-82105' role='inner' />
    <tag k='building' v='school' />
    <tag k='type' v='multipolygon' />
  </relation>
</osm>

Can anyone suggest what might be the problem here?

1

This seems to be a bug in the QuickOSM plugin. If you download the data in Shapefile format, it looks ok (as in Steven Kay's answer).

Using the Geojson format to preserve full key names, you get the school building with the two holes rendered as features as well. Using Vector -> Geometry Tools -> Multipart to singlepart, you can separate the two inner.

Selecting the school building and saving it to shapefile (or download with QuickOSM using shapefile format) shows the correct outline.

2

I suggest using the QuickOSM plugin to download the data, rather than a local JOSM file, as AndreJ hinted at. This will fetch the latest data from Overpass and handles a lot of geometry weirdness quite well.

If you include relations and multipolygons it should handle this correctly.

Here's your area of interest, with the donuts appearing correctly. (Used the OSM place search plugin to find it, and QuickMapServices for the basemap). I searched for anything with the building tag.

enter image description here

I don't think downloads from QuickOSM are suitable for editing, so best to carry on using JOSM if you want to submit changes back to OSM. But if you're just using this for read-only mapping, not editing, that might not be a problem.

  • 2
    I did the same for just a smaller area with QuickOSM unsing GeoJSON format, but the two immer of the school are filled. Selecting the school building and saving to shapefile (or download with QuickOSM using shapefile format) shows the same outline as you have. Add vector layer has the same strange behaviour. – AndreJ Aug 4 '17 at 6:50
  • 2
    Yes, QuickOSM is read only. If you want to edit, QuickOSM is providing some QGIS actions on each features. You can use the JOSM action for instance – etrimaille Aug 4 '17 at 9:54
  • 1
    @Gustry cool, thanks for that. I think I see the problem, i'll add an update to the issue on the plugin tracker. I didn't realise geoJSON was an option ;-) – Steven Kay Aug 4 '17 at 10:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.