[Ottawa_users] Clipping shapefiles with ogr2ogr
Alyre Chiasson
alyrechiasson at yahoo.ca
Sun Feb 17 21:25:12 EST 2008
Hello,
I have two shape files with the following identical prj :
GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
I want to cut a rectangle with the following coordinates
xmin –68.9125
ymin 44.129
xmax –63.0701
ymax 48.3721
from a shapefile with the following coordinates:
xmin –69.35
ymin 43.45
xmax –50.85
ymax 60.95
The way I read it the smaller rectangle should lay totally within the
larger. So I have tried:
ogr2ogr –spat –68.9125 44.129 –63.0701 48.3721 out.shp in.shp
The does produce a new file, however, the metadata have not changed,
QGIS says it is the same as the original. In addition when I overlay the
out.shp over the in.shp, I do not have a smaller rectangle within a
larger. What I have is almost a diagonal swath retained from the
original file with two cookie cutter holes of contour lines missing in
the lower portion. The original shapefile contains contour lines for
temperature. The cookie cutter holes are areas with closed polygons that
are close to being spherical.
What am I missing here? Does the spat option do something other than
clipping? Seemed straight forward but the results are strange.
Thanks
Alyre
More information about the Ottawa_users
mailing list