[GRASS-dev] does v.out.ogr export centroids ? [was: Re:
mlennert at club.worldonline.be
Wed May 23 10:57:16 EDT 2007
On 23/05/07 16:20, Moritz Lennert wrote:
> On 23/05/07 15:50, Salvator*eL*arosa wrote:
>> hajhouse wrote:
>>> På 2007-05-22, skrev Salvator*eL*arosa:
>>>> i need a little help!
>>>> How can to export a point shapefile from a polygon layer in Grass
>>>> So, i can have in table (point file) all informations of the layer
>>>> Sorry my english!
>>> In GRASS terminology polygons can be lines, boundaries, or areas (when
>>> conbined with a centroid [= center point]). So assuming you have areas
>>> and you want to export just the centroids, I believe something like:
>>> v.type type=centroid,point in=mymap out=mymap_converted
>>> v.out.ogr in=mymap_converted dsn=myshapefile.shp
>>> would meet your needs.
>> Thank u for reply!
>> Unfortunately it doesn't work, yet. It export always shp polygon!
>> I need of a point shapefile!
> You need to use the type= option of v.out.ogr:
> v.type type=centroid,point in=mymap out=mymap_converted
> v.out.ogr in=mymap_converted dsn=myshapefile.shp type=point
> Then you get a point file with attributes.
This has made me try and wonder: v.out.ogr's type option contains
'centroid' as one of the possibilities, so in my understanding something
v.out.ogr in=fields type=centroid dsn=~/ olayer=fields
should work, exporting only the centroids. But I get the following messages:
GRASS 6.3.cvs (spearfish60):~ > v.out.ogr in=fields dsn=~/ olayer=fields
WARNING: 208 Boundary(ies) found, but not requested to be exported. Verify
Exporting 271 points/lines...
ERROR 1: Attempt to write non-point (LINESTRING) geometry to point
[repeated 63 times]
63 features written
I don't know where the error message comes from, I imagine it must be
the OGR libraries.
v.type type=centroid,point in=fields out=fp
v.out.ogr in=fp dsn=~/ olayer=fields type=point
works as expected.
Is this a bug in v.out.ogr, or am I misunderstanding something ?
More information about the grass-dev