[Gdal-dev] Transform Line String into Polygon with ogr2ogr

Frank Warmerdam warmerdam at pobox.com
Wed Apr 18 09:18:36 EDT 2007


On 4/17/07, Lijian Shi <lijian.shi at und.nodak.edu> wrote:
> I have a shp file with Line String geometry type. Actually these lines are
> polygon because the coordinate values of line string's first point are same
> with them of line string's last one. Now I want to transform this shp into a
> new one with polygon and I use command "ogr2ogr" as:
>
>
>
> ogr2ogr new.shp old.shp –nlt POLYGON
>
>
>
> But there are some errors as followed:
>
>
>
> ERROR 1: Attempt to write non-polygon (LINESTRING) geometry to type
> shapefile.
>
> ERROR 1: Terminating translation prematurely after failed
>
> Translation of layer zones
>
>
>
> Can I use this "ogr2ogr" to convert LINESTRING into POLYGON? If yes, what's
> the problem with my command?

Lijian,

I'm afraid there is not support for automatic conversion of
geometry types in ogr2ogr.

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