[gdal-dev] more than one linearring object in the geometry but with all linerring objects having zero points?

Chao YUE chaoyuejoy at gmail.com
Fri Mar 29 10:52:46 PDT 2013


Hi Frank,

thanks for pointing out the MultiPolygon, Indeed you're right.

While when I print the geometry, I get all the underlying vertices data.

feature = layer.GetFeature(408)
georef = feature.GetGeometryRef()
georef.GetGeometryName()

'MULTIPOLYGON'

when I print georef, I get a big list of data which are the vertices I
guess.

thanks again,

Chao

On Thu, Mar 28, 2013 at 7:06 PM, Frank Warmerdam <warmerdam at pobox.com>wrote:

> Chao,
>
> I suspect you have a multipolygon.  So each subgeometry is a polygon
> on which there are in turn subgeometries which are rings.
>
> By the way, if you just print the geometry in python you should get
> the "Well Known Text" representation which can be explanatory.
>
> Best regards,
> Frank
>
>
>
> On Thu, Mar 28, 2013 at 9:58 AM, Chao YUE <chaoyuejoy at gmail.com> wrote:
> > Dear all,
> >
> > I try to read fire polygon shapefile by ogr (beginner level), I referred
> to
> > some sources online:
> >
> http://geoinformaticstutorial.blogspot.fr/2012/10/accessing-vertices-from-polygon-with.html
> >
> http://gis.stackexchange.com/questions/8144/get-all-vertices-of-a-polygon-using-ogr-and-python
> >
> > However, both the links are incomplete as I have polygons who have more
> than
> > one linearring objects, which
> > fianally turns out to have hole inside the polygon.
> >
> > But I have another strange issue, is that there are some polygons with
> more
> > than one linearring object,
> > but all the rings have zero points. However, the fire size of the
> polygon is
> > not zero, and when I checked
> > the same polygon in ArcGIS, there is really a shape! could anyone point
> out
> > I miss something?
> > thanks!!
> >
> > In [28]:
> >
> > feature = layer.GetFeature(276)
> >
> > geo = feature.GetGeometryRef()
> >
> > geo.GetGeometryCount()
> >
> > Out[28]:
> >
> > 2
> >
> > In [29]:
> >
> > ring = geo.GetGeometryRef(0)
> >
> > ring.GetPointCount()
> >
> > Out[29]:
> >
> > 0
> >
> > In [31]:
> >
> > ring = geo.GetGeometryRef(1)
> >
> > ring.GetPointCount()
> >
> > Out[31]:
> >
> > 0
> >
> > In [34]:
> >
> > feature.items()['SIZE_HA']
> >
> > Out[34]:
> >
> > 13041.187
> >
> >
> > Chao
> > --
> >
> ***********************************************************************************
> > Chao YUE
> > Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
> > UMR 1572 CEA-CNRS-UVSQ
> > Batiment 712 - Pe 119
> > 91191 GIF Sur YVETTE Cedex
> > Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
> >
> ************************************************************************************
> >
> > _______________________________________________
> > gdal-dev mailing list
> > gdal-dev at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
>
> --
>
> ---------------------------------------+--------------------------------------
> 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 Software Developer
>



-- 
***********************************************************************************
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130329/0036b484/attachment.html>


More information about the gdal-dev mailing list