[Ottawa_users] Clipping shapefiles with ogr2ogr

Alyre Chiasson alyrechiasson at yahoo.ca
Mon Feb 18 14:42:31 EST 2008


Hello,

I suspected that something like below was happening, although the documentation I read regarding the -spat option presents it as a clipping function. I was surprised by the result. I am new to all of this and have no computer science background so I am not familar with a "bbox" . Although I know Python is a flexible multi platform language (I see a lot of references in the Linux world), attempting to learn the language to write a script to do this job or to understand someone else's script I believe would be beyond my time constraints for the current project. I did try to import both shape files into GRASS as layers and then tried to overlay (v.overlay) them but got error messages which I couldn't understand but were basically complaining about missing attributes. Not sure what attributes it was referring to. Is there actually no way to do this within GRASS or QGIS that retains the feature of the shapefile (everthing within the clipping region) without
 having to learn a programming language? Would seem to be a desirable function. Not adverse to learning a program language but it would be a much longer term goal.  

Thanks

Alyre



----- Original Message ----
From: Tyler Mitchell (OSGeo) <tmitchell at osgeo.org>
To: Ottawa (Canada) Local Chapter List <ottawa_users at lists.osgeo.org>
Sent: Monday, February 18, 2008 12:26:36 PM
Subject: Re: [Ottawa_users] Clipping shapefiles with ogr2ogr

On  18-Feb-08,  at  6:22  AM,  Paul  Spencer  wrote:

>  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?

That's  right,  it  cannot  clip,  but  will  select/return  all  features  
that  fit  in  the  area.   You  can't  use  ogr2ogr  for  clipping  but  I  
believe  you  could  write  a  Python  script  that  calls  the  OGR  and  GEOS  
functions  to  do  this  job.

Tyler
_______________________________________________
Ottawa_users  mailing  list
Ottawa_users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/ottawa_users






      Connect with friends from any web browser - no download required. Try the new Yahoo! Canada Messenger for the Web BETA at http://ca.messenger.yahoo.com/webmessengerpromo.php
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/ottawa_users/attachments/20080218/952e49e9/attachment.html


More information about the Ottawa_users mailing list