Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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
2  
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
add comment

2 Answers 2

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
add comment

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 http://qgis.spatialthoughts.com/

share|improve this answer
add comment

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.