Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Shapefile with Polygon features representing the world's land areas (continents, islands). Is it possible to invert these, and get a geometry that represents the world's oceans and seas? So the original land Polygons need to become rings in a single global Polygon that covers the planet.

Basically, I'm looking for something like Select > Inverse in Photoshop. A Python, command line or QGIS solution is preferred.

share|improve this question
up vote 11 down vote accepted

You can do this using the following steps:

1- In QGIS go to Vector > Research Tools > Polygon From Layer Extent. Use the World's Land area as Input File. Choose the Desired name for the output file name of extent layer. This will create a new vector layer covering the Whole Land area.

2- Use Geoprocessing Tools > Difference: Use the extent layer created in step one as input file and world's land area as difference file. Then You will get an opposite shapefile which represents the ocean.

share|improve this answer
1  
I'm accepting this, because generally this seems to be the right technique. Matte is right though: some of the ocean will be missing. – kontextify Apr 1 at 20:53

When you invert the polygons its probably missing a small amount of ocean in the end as the extend of the landmass will not go up to the northpole and therefore the difference may lack a bit there. Depending on what should be done with the data afterwards it might be better to just get the ocean data.

http://www.naturalearthdata.com/features/

share|improve this answer
    
I considered Natural Earth, but I need more detailed coastlines. – kontextify Mar 30 at 8:41
    
This is interesting because there is no point at which a coastline is 'detailed' enough; there will always be more detail available in the natural world. For the US east coast, I know the coastline available from NOAA ( ngdc.noaa.gov/mgg/shorelines ) wasn't enough for me. – Geocurious Mar 31 at 12:54
1  
I ended up going with an excellent OSM-based dataset. It's detailed enough for me. openstreetmapdata.com/data/water-polygons – kontextify Apr 1 at 20:57

Additional to ahmadhanb answer, you can create a buffer of a few degrees/km/miles to the "Polygon from Layer Extent", in this fashion you will have some space out of the most external vertices of your continental shapes (which is what you obtain).

Then, you may apply "Difference" to this buffered shape to erase you continent polygons and obtain the ocean.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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