I am using the GADM database. Is there any way to determine landlocked polygons in QGIS and create a dummy variable for it ( 1==landlocked ; 0==not landlocked) ?
you might be able to do this using the contains, within or relate geometry functions in QGIS. I think these are a fairly new additions.
I've not tried this with GADM or Natural Earth data, but you should be able to do this with QGIS expressions without having to resort to python code.
- keep your country polygons in layer one ("country")
- use dissolve to merge adjacent country polygons into layer two ("continent")
- probably, also convert the dissolved 'continent' layer from single part to multipart
if the value of
- contains(continent_geometry, country_geometry) is True OR
- within(country_geometry, continent_geometry) is True
or using relate (I'm not so sure about these..!)
- relate(country_geometry, continent_geometry) = "2FF1FF212" OR
- relate(continent_geometry, country_geometry) = "212F11FF2"
...then the country geometry falls completely inside the outline of the continent, so it is landlocked.