[FWTools] table to ESRI shapefile

Frank Warmerdam warmerdam at pobox.com
Thu Mar 5 13:58:41 EST 2009


Greg Fiske wrote:
> Hello,
> 
> I have a table where the first four rows define the XY points vertices of a
> (square) polygon, the next four rows define another polygon, and so on.
> Example:
> 
> id      X     Y
> 1	57.482	6.08
> 1	56.866	6.206
> 1	56.761	5.693
> 1	57.376	5.566
> 2	60.734	1.119
> 2	60.123	1.249
> 2	60.014	0.729
> 2	60.625	0.598
> ...
> 
> Is there an FTtools approach to making this table into an ESRI vector
> polygon shapefile?

Greg,

You would basically need to write a script to parse the text file, and
create features with polygon geometries.

The script at:

   http://svn.osgeo.org/gdal/trunk/gdal/swig/python/scripts/gcps2vec.py

shows creating simple point features as a shapefile.  You might manage
to adapt it to your purposes. Actually, this graticule creation script
might also be a useful model:

   http://svn.osgeo.org/gdal/trunk/gdal/swig/python/scripts/mkgraticule.py

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    | Geospatial Programmer for Rent



More information about the FWTools mailing list