[Gdal-dev] convert a group of points (lat, lon) to a shape file

Frank Warmerdam fwarmerdam at gmail.com
Wed Jun 22 19:19:53 EDT 2005


On 6/22/05, Xiaodong Zhang <zhang at aero.und.edu> wrote:
> Hi,
> 
> I have a humble question which may have been answered before, but could
> anybody please kindly help out. The question is:
> 
> If I have a series of points, say in a text file, like
> lat1, lon1
> lat2, lon2
> lat3, lon3
> lat4, lon4
> 
> How should I format the text file such that an ogr utility (e.g.,
> ogr2ogr) can convert it into a shapefile as a polygon.

Xiaodong,

Perry's suggestion should work well.  Another alternative
is to treat your file as a .csv file, and then write a small VRT
file to show OGR how to treat the columns as x/y values of a point.
Then use ogr2ogr to convert it to a shapefile. 

See:

  http://www.gdal.org/ogr/drv_csv.html
  http://www.gdal.org/ogr/drv_vrt.html

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 Gdal-dev mailing list