I am a total GIS beginner and have been trying to make some simple maps of the nation of São Tomé and Príncipe using QGIS and publicly available data. The readily available data I find comes from OSM. Some features, such as waterways, coastlines, and cities/towns/villages I have been able to find as individual shape files and add to my QGIS projects as layers that can be turned on and off. But other features I can only find as part of one "flattened" (computationally-speaking) file that renders like this:

São Tomé island from OSM data

This data was obtained by selecting 'OpenStreetMaps' from the 'XYZ Tiles' option in the QGIS browser pane, but I've found the same data various places on the internet. There are lots of great features visible, but they all come as a single layer, and I can't find any way to select/de-select/modify them individually. For example, the district boundaries in purple and the park boundary in green.

However, my boss sent me some .png files given to him by some long-ago employee and wants me to create similar maps:

São Tomé island with layers from unknown source

Here we have the same district and park boundaries, but whoever created this map was able to manipulate those features individually. I've been looking high and low but can't find individual shape files for those features on the internet.

Does anyone know where they might have come from?

I also notice that the roads are broken out here as 'Primary roads' and 'Other roads', whereas the OSM shape file I've found only has one class: 'roads'.

I feel like (even with my rudimentary skills) I can re-create these maps as requested, if only I can find the underlying data!

3 Answers 3


First of all, the XYZ-Layer you are showing is a raster tile. You can not modify it or get any informations from it. What you need is vector data. You can get all data you need for your project from OSM for free (but dont forget to give credentials to osm contributors ;)).

You can either use overpass-turbo api for example from this website: https://overpass-turbo.eu/s/MmC (link includes query for administrative boundaries)

Or get an extract from Geofabrik here: http://download.geofabrik.de/africa.html You can either choose shapefiles or the full .pbf extract.

Natural Earth might also be a source for you: https://www.naturalearthdata.com/downloads/

For questions about open data, we have another SE: https://opendata.stackexchange.com/

  • Some good links. The Geofabrik shapefiles have every area, line, point, etc arranged as a shapefile for areas, a shapefile for lines, etc. Some heavy filtering would be required. As it happens, I was thinking of writing a simple utility to extract admin areas from a PBF file, and creating shapefile(s) for the requested admin levels. Still investigating.
    – winwaed
    Commented Sep 17, 2019 at 19:23
  • Did not realize that was raster data, but I just zoomed way, way in on it and I see what you mean!
    – mcrepeau
    Commented Sep 17, 2019 at 21:49

Further to @MrXSquared's reply and my comment, I have managed to create a layer of Admin Level 6 polygons in QGIS. I started using a Geofabrik PBF extract (I used Texas because I had it handy). QGIS will import this with a single click, but it produces "flat" layers - one for each feature type (area, point, etc), and then hides most of the OSM tags in a "Other Tags" attribute.

So instead we import it via SQLite. The conversion to SQLite makes the tags more accessible as regular feature attributes. Use the ogr2ogr utility (part of GDAL/OGR, typically installed with QGIS) to do this:

ogr2ogr -f "SQLite" -dsco SPATIALITE=YES texas.db texas-latest.osm.pbf

The resulting texas.db can be added as a layer in QGIS. There are a variety of feature types - select "multipolygons". This gives a layer with all the polygons - counties, areas of water, buildings, parks, etc,etc. This particular extract has admin levels 4 (US State) and 6 (US County for my data - also the level you're after).

Right click on the layer name in the Layers list, and select "Filter...". This gives the Query Builder. The following filter expression is what you need:

"boundary" = 'administrative' AND "admin_level" = 6

I also had some clauses removing 3 errant polygons by ID (seems like the Geofabrik cut is accidentally including 3 Mexican counties!)

The filter selection can be saved by right clicking on the layer name and selecting "Export -> Save Features As".

Here is the result for Texas Admin Level 6 Polygons:

enter image description here

  • Ok, I'm going to give that a try. In addition to getting the layers I need, it'll be a great learning exercise!
    – mcrepeau
    Commented Sep 17, 2019 at 21:48

Is this one of the sources you've already checked? https://data.nextgis.com/en/region/ST/

  • Hmmm... I sort of assumed the previous employee used only free, open-source data, but maybe he purchased it. $8 seems pretty reasonable, given that every minute I spend looking for free data is costing my boss money!
    – mcrepeau
    Commented Sep 17, 2019 at 17:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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