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've downloaded the 350MB coastline shape file from Openstreetmap, but I really would like to work with a small part of them, is there a way to generate a shapefile of a small area.

I'm using MacOSX or Unix for this.

Edit: Apparently the coastline file from Openstreetmap wasn't one big polygon so everything worked fine. Without cutting polygons.

share|improve this question
According to the docs, it's not "one big polygon," but has already been "divided into 100km x 100km squares." Do you need to clip out smaller portions of those square features or would it suffice to select those squares covering your study region? – whuber Feb 10 '11 at 14:31
It would be enough if I could export a couple of those 100km squares. Not optimal, if I'm limited to such a big grid, but very doable. – Erik Johansson Feb 17 '11 at 0:27
up vote 11 down vote accepted

With ogr2ogr, you can specify a bounding box that you'd like to clip by with -clipsrc x_min y_min x_max y_max, so for example, to only get the northern hemisphere of a global dataset you could do:

ogr2ogr -f "ESRI Shapefile" borders_north.shp borders.shp -clipsrc -180 0 180 90

See the ogr2ogr documentation for further options, including clipping to another geometry.

share|improve this answer
If you have an old GDAL version (<1.7) this "works": ogr2ogr -f "ESRI Shapefile" borders_north.shp borders.shp -spat -180 0 180 90 It will not clip so if you have one big geometry you will still have to upgrade, – Erik Johansson Dec 12 '11 at 12:29
The file is of course in spherical mercator, so you will have to covnert the coordinates in someway. – Erik Johansson Dec 13 '11 at 10:39

You can install and use qgis to load the file you downloaded; use the mouse or query the data for the features that you would like to select; and export the selected features to a new shapefile.

QGIS is a cross-platform (Linux, Windows, Mac) open source application with many common GIS features and functions.

A link containing tutorials that illustrates these steps in qgis is available here

share|improve this answer

Your Answer


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.