Create globe locator maps in QGIS
HTML-код
- Опубликовано: 26 ноя 2024
- Sometimes you might want to create a locator map to show where a country or area is in the world, and make it look like a globe. This video shows you how you can do it very quickly in QGIS using the Globe Builder plugin.
I do it using the default 'world' layer in QGIS but if you are looking for different boundaries for countries or sub-national regions then you can use an alternative data source for your map layers.
www.naturalear...
You can use one of the Admin 0 - Countries point-of-views files for countries and the Admin 1 or Admin 2 layers for sub-national areas.
If you want to place the country bounding box I show in the video as the top-most layer, then you can simply duplicate the country layer (right-click, hit Duplicate Layer) and then apply the geometry generator to the top layer and the regular fill style to the country layer.
Expression used to add a bounding box
densify_by_count( buffer(bounds($geometry),2,1,'flat','miter'),100)
A workaround for when the bounding box is too big
In the case of some countries (e.g. France, Norway, New Zealand) there are parts of their country far away from the mainland. In these cases
densify_by_count(make_polygon(geom_from_wkt('LINESTRING(0 82,35 82,35 56,0 56,0 82)')),100)
The expression above may look horrific, but all it is doing is drawing a bounding box around Norway. How? it uses the LINESTRING function and then a set of coordinates that define the box around Norway - e.g. 0 degrees east and 82 degrees north is the first point, then 35 degrees east and 82 degrees north is the next point, and so on. To do this for another country you can just manually edit the bounding box coordinates, but it's only necessary if you need to do it manually in a few cases.
See my intro and intermediate QGIS courses for more: www.udemy.com/...