[Gdal-dev] Re: Clip shapefile into a polygon

Frank Warmerdam warmerdam at pobox.com
Thu Aug 9 15:47:32 EDT 2007


SAEZ Laurent - CETE Méditerr./DI/ETER wrote:
> Frank,
> 
> Thanks for your quick answer.
> I'm not a programmer...
> I've wrote anyway a script in Python using Geometry.Intersection method. That was my first script in Python.
> I've taken your script vec_tr.py as sample.
> Miracle, my first script works good !
> However, I've noted some strange things :
> - Feature.SetFrom doesn't copy field values,
> - Geometry.Intersection can return empty geometries : In my case, it creates plines with 0 nodes. The generated shapefile can't be open with MapInfo® 7.8.
> I try to convert it with ogr2ogr in MIF/MID format. MapInfo® can't open it as well.
> 
> Thanks a lot for all. I hope that in a few months I will be able to help somebody.

Laurent,

I haven't dug really deeply, but it isn't clear to me why SetFrom() would
not copy the attribute values.

I'd appreciate it if you could file a bug on the issue with empty geometries
not being properly written out to mid/mif.  Ideally you would provide an
input file and the ogr2ogr commandline to demonstrate the issue.  I think
the mapinfo driver ought to error out for those features or something similar
if they won't work in mapinfo.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list