[Ottawa_users] Clipping shapefiles with ogr2ogr
Paul Spencer
pspencer at dmsolutions.ca
Mon Feb 18 09:22:26 EST 2008
My first guess is that ogr2ogr doesn't clip, it uses the bbox as a
spatial selection and keeps anything that intersects with the bbox.
Would this account for your results?
Paul
On 17-Feb-08, at 9:25 PM, Alyre Chiasson wrote:
> 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
> _______________________________________________
> Ottawa_users mailing list
> Ottawa_users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/ottawa_users
__________________________________________
Paul Spencer
Chief Technology Officer
DM Solutions Group Inc
http://www.dmsolutions.ca/
More information about the Ottawa_users
mailing list