[geos-devel] Re: (not) Empty geometry

Jo doublebyte at gmail.com
Sun Aug 2 18:42:52 EDT 2009


Thanks a lot all for your replies!
It turns out that there was no problem with the geometry itself, but with
another geometry that I generated from it; this second geometry was *empty*,
but not *null* and so I was failing a test to catch it that would turn it
out to my first (correct) geometry.
                                                 Thanks again for your time
and have a good evening!

Jo

2009/8/2 <geos-devel-request at lists.osgeo.org>

> Send geos-devel mailing list submissions to
>        geos-devel at lists.osgeo.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://lists.osgeo.org/mailman/listinfo/geos-devel
> or, via email, send a message with subject or body 'help' to
>        geos-devel-request at lists.osgeo.org
>
> You can reach the person managing the list at
>        geos-devel-owner at lists.osgeo.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of geos-devel digest..."
>
>
> Today's Topics:
>
>   1. Re: (Mateusz Loskot)
>   2. Re:(not) Empty geometry (Jo)
>   3. Re: Re:(not) Empty geometry (Mateusz Loskot)
>   4. Re: (not) Empty geometry (Jo) (Jo)
>   5. Re: Re: (not) Empty geometry (Jo) (Mateusz Loskot)
>   6. Polygonizer returns inner rings on their own? (Frederik Ramm)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sun, 02 Aug 2009 21:57:47 +0100
> From: Mateusz Loskot <mateusz at loskot.net>
> Subject: Re: [geos-devel] (not) Empty geometry
> To: GEOS Development List <geos-devel at lists.osgeo.org>
> Message-ID: <4A75FDCB.4020104 at loskot.net>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Jo wrote:
> > Hi, I am having some troubles with a polygon, that is seen by geos as
> > empty (and thus returning GetNumPoints()=0);
> > I dont understand what might be wrong with this polygon, since the
> > output of geos::io::WKTWriter shows a polygon with many
> > coordinates...
>
> It's impossible to judge unless you show a snippet of code
> that presents how you construct a polygon object using GEOS?
> What's the source data?
>
> Best regards,
> --
> Mateusz Loskot, http://mateusz.loskot.net
> Charter Member of OSGeo, http://osgeo.org
>
>
> ------------------------------
>
> Message: 2
> Date: Sun, 2 Aug 2009 22:16:29 +0100
> From: Jo <doublebyte at gmail.com>
> Subject: [geos-devel] Re:(not) Empty geometry
> To: geos-devel at lists.osgeo.org
> Message-ID:
>        <23ab5f0a0908021416g27919536o256fd515f79acacc at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> I just realized the mailing list truncated my last message; here it is
> (without the attach!)
>
> Hi,
> I am having some troubles with a polygon, that is seen by geos as empty
> (and
> thus returning GetNumPoints()=0); I dont understand what might be wrong
> with
> this polygon, since the output of geos::io::WKTWriter shows a polygon with
> many coordinates... I append that output here;
> I also put an image of the polygon on:
>
> http://ladybug.no-ip.org/files/emptyPolygon.png
>
> It would be great if anybody had some suggestions: Im realy lost here!
> Thanks in advance for ur help,
>
> cheers,
>
> Jo
>
>
> 2009/8/2 <geos-devel-request at lists.osgeo.org>
>
> > Send geos-devel mailing list submissions to
> >        geos-devel at lists.osgeo.org
> >
> > To subscribe or unsubscribe via the World Wide Web, visit
> >        http://lists.osgeo.org/mailman/listinfo/geos-devel
> > or, via email, send a message with subject or body 'help' to
> >        geos-devel-request at lists.osgeo.org
> >
> > You can reach the person managing the list at
> >        geos-devel-owner at lists.osgeo.org
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of geos-devel digest..."
> >
> >
> > Today's Topics:
> >
> >   1. (not) Empty geometry (Jo)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Sun, 2 Aug 2009 21:51:41 +0100
> > From: Jo <doublebyte at gmail.com>
> > Subject: [geos-devel] (not) Empty geometry
> > To: geos-devel at lists.osgeo.org
> > Message-ID:
> >        <23ab5f0a0908021351w53233efehdb82784d0c7248aa at mail.gmail.com>
> > Content-Type: text/plain; charset="iso-8859-1"
> >
> > Skipped content of type multipart/alternative-------------- next part
> > --------------
> > A non-text attachment was scrubbed...
> > Name: polygon.wkt
> > Type: application/octet-stream
> > Size: 51117 bytes
> > Desc: not available
> > Url :
> >
> http://lists.osgeo.org/pipermail/geos-devel/attachments/20090802/9e51e147/polygon.obj
> >
> > ------------------------------
> >
> > _______________________________________________
> > geos-devel mailing list
> > geos-devel at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/geos-devel
> >
> > End of geos-devel Digest, Vol 82, Issue 3
> > *****************************************
> >
>
>
>
> --
> "#define QUESTION ((bb) || !(bb))"  (Shakespeare)
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.osgeo.org/pipermail/geos-devel/attachments/20090802/1c757e2c/attachment-0001.html
>
> ------------------------------
>
> Message: 3
> Date: Sun, 02 Aug 2009 22:30:06 +0100
> From: Mateusz Loskot <mateusz at loskot.net>
> Subject: Re: [geos-devel] Re:(not) Empty geometry
> To: GEOS Development List <geos-devel at lists.osgeo.org>
> Message-ID: <4A76055E.1040308 at loskot.net>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Jo wrote:
> > I just realized the mailing list truncated my last message; here it is
> > (without the attach!)
>
> Sorry, I didn't see any source code in your message.
> See how it is archived:
>
> http://lists.osgeo.org/pipermail/geos-devel/2009-August/004293.html
>
> Or you mean polygon.obj attachment?
>
>
> http://lists.osgeo.org/pipermail/geos-devel/attachments/20090802/9e51e147/polygon.obj
>
> Best regards,
> --
> Mateusz Loskot, http://mateusz.loskot.net
> Charter Member of OSGeo, http://osgeo.org
>
>
> ------------------------------
>
> Message: 4
> Date: Sun, 2 Aug 2009 22:56:43 +0100
> From: Jo <doublebyte at gmail.com>
> Subject: [geos-devel] Re: (not) Empty geometry (Jo)
> To: geos-devel at lists.osgeo.org
> Message-ID:
>        <23ab5f0a0908021456x3928293al32e4e1186dfc1896 at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi,
> The attach was only the wkt definition of the polygon...
> Things are gettin a bit clearer now: the polygon is also valid and
> empty on OGR (so I guess no prob in importing it to geos).
> I think is outside the scope of this mailing list to tell how Im
> importing it into OGR, but I ll do it anyway :-)
>
>
>                while( (poFeature = poLayer->GetNextFeature()) != NULL )
>                {
>                        OGRGeometry *poGeometry;
>                        poGeometry = poFeature->GetGeometryRef();
>
>                        if( poGeometry != NULL &&
> wkbFlatten(poGeometry->getGeometryType())
> == wkbPolygon )
>                        {
>                                OGRPolygon *poPolygon = (OGRPolygon*)
> poGeometry;
>                                 DoStuffWithGEOS()
>                        }
>                   }
> Inside DoStuffWithGEOS(), I export it to text and import it (from
> text) to Geos. I guess this is all working fine cause it works for all
> the hundreds of polygons that I have, so I guess this one is "special"
> :-)
> I would have to look at it with a bit more detail!!
> It looks fine in QGis thought...
>
> http://ladybug.no-ip.org/files/emptyPolygon.png
>
>                                                           cheers,
>                                                                   Jo
>
>
>
> Jo wrote:
> >* I just realized the mailing list truncated my last message; here it is
> *>* (without the attach!)
> *
> Sorry, I didn't see any source code in your message.
> See how it is archived:
>
> http://lists.osgeo.org/pipermail/geos-devel/2009-August/004293.html
>
> Or you mean polygon.obj attachment?
>
>
> http://lists.osgeo.org/pipermail/geos-devel/attachments/20090802/9e51e147/polygon.obj
>
> Best regards,
>
>
>
> 2009/8/2 <geos-devel-request at lists.osgeo.org>
>
> > Send geos-devel mailing list submissions to
> >        geos-devel at lists.osgeo.org
> >
> > To subscribe or unsubscribe via the World Wide Web, visit
> >        http://lists.osgeo.org/mailman/listinfo/geos-devel
> > or, via email, send a message with subject or body 'help' to
> >        geos-devel-request at lists.osgeo.org
> >
> > You can reach the person managing the list at
> >        geos-devel-owner at lists.osgeo.org
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of geos-devel digest..."
> >
> >
> > Today's Topics:
> >
> >   1. (not) Empty geometry (Jo)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Sun, 2 Aug 2009 21:51:41 +0100
> > From: Jo <doublebyte at gmail.com>
> > Subject: [geos-devel] (not) Empty geometry
> > To: geos-devel at lists.osgeo.org
> > Message-ID:
> >        <23ab5f0a0908021351w53233efehdb82784d0c7248aa at mail.gmail.com>
> > Content-Type: text/plain; charset="iso-8859-1"
> >
> > Skipped content of type multipart/alternative-------------- next part
> > --------------
> > A non-text attachment was scrubbed...
> > Name: polygon.wkt
> > Type: application/octet-stream
> > Size: 51117 bytes
> > Desc: not available
> > Url :
> >
> http://lists.osgeo.org/pipermail/geos-devel/attachments/20090802/9e51e147/polygon.obj
> >
> > ------------------------------
> >
> > _______________________________________________
> > geos-devel mailing list
> > geos-devel at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/geos-devel
> >
> > End of geos-devel Digest, Vol 82, Issue 3
> > *****************************************
> >
>
>
>
> --
> "#define QUESTION ((bb) || !(bb))"  (Shakespeare)
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.osgeo.org/pipermail/geos-devel/attachments/20090802/778c5fc1/attachment-0001.html
>
> ------------------------------
>
> Message: 5
> Date: Sun, 02 Aug 2009 23:12:56 +0100
> From: Mateusz Loskot <mateusz at loskot.net>
> Subject: Re: [geos-devel] Re: (not) Empty geometry (Jo)
> To: GEOS Development List <geos-devel at lists.osgeo.org>
> Message-ID: <4A760F68.8050609 at loskot.net>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Jo wrote:
> > Hi,
> > The attach was only the wkt definition of the polygon...
> > Things are gettin a bit clearer now: the polygon is also valid and
> > empty on OGR (so I guess no prob in importing it to geos).
> > I think is outside the scope of this mailing list to tell how Im
> > importing it into OGR, but I ll do it anyway :-)
> >
> >
> >               while( (poFeature = poLayer->GetNextFeature()) != NULL )
> >               {
> >                       OGRGeometry *poGeometry;
> >                       poGeometry = poFeature->GetGeometryRef();
> >
> >                       if( poGeometry != NULL &&
> wkbFlatten(poGeometry->getGeometryType())
> > == wkbPolygon )
> >                       {
> >                               OGRPolygon *poPolygon = (OGRPolygon*)
> poGeometry;
> >                                  DoStuffWithGEOS()
>
> What does this return?
>
> poPolygon->getExteriorRing()->getNumPoints()
>
> >                       }
> >                    }
> > Inside DoStuffWithGEOS(), I export it to text and import it (from
> > text) to Geos.
>
> You don't need to go through text export/import.
> Just dump OGR geometry as GEOS geometry using
> OGRGeometry::exportToGEOS() method:
>
> http://trac.osgeo.org/gdal/browser/trunk/gdal/ogr/ogr_geometry.h#L118
>
> And check if GEOS geomtetry is OK now.
>
> Best regards,
> --
> Mateusz Loskot, http://mateusz.loskot.net
> Charter Member of OSGeo, http://osgeo.org
>
>
> ------------------------------
>
> Message: 6
> Date: Mon, 03 Aug 2009 00:22:25 +0200
> From: Frederik Ramm <frederik at remote.org>
> Subject: [geos-devel] Polygonizer returns inner rings on their own?
> To: geos-devel at lists.osgeo.org
> Message-ID: <4A7611A1.5080202 at remote.org>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hi,
>
>    why is it that the (C++) Polygonizer, when given the following four
> geometries,
>
>         "LINESTRING(1 1, 1 10, 10 10)"
>         "LINESTRING(10 10, 10 1, 1 1)"
>         "LINESTRING(20 20, 20 30, 30 30, 30 20, 20 20)"
>         "LINESTRING(3 3, 3 4, 4 4, 4 3, 3 3)"
>
> (1 and 2 together form a shell, 3 forms a disjunct shell, 4 forms an
> inner ring of 1+2)
>
> returns a collection of three polygons:
>
> POLYGON ((1.00 1.00, 1.00 10.00, 10.00 10.00, 10.00 1.00, 1.00 1.00),
> (3.00 3.00, 4.00 3.00, 4.00 4.00, 3.00 4.00, 3.00 3.00))
> POLYGON ((20.00 20.00, 20.00 30.00, 30.00 30.00, 30.00 20.00, 20.00 20.00))
> POLYGON ((3.00 3.00, 3.00 4.00, 4.00 4.00, 4.00 3.00, 3.00 3.00))
>
> I'm ok with the first and second, but the third one has already been
> used as a "hole" inside the first and should not be returned again - or
> is there a misunderstanding on my part?
>
> Bye
> Frederik
>
> --
> Frederik Ramm  ##  eMail frederik at remote.org  ##  N49°00'09" E008°23'33"
>
>
> ------------------------------
>
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geos-devel
>
> End of geos-devel Digest, Vol 82, Issue 4
> *****************************************
>



-- 
"#define QUESTION ((bb) || !(bb))"  (Shakespeare)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geos-devel/attachments/20090802/2b43a1b2/attachment-0001.html


More information about the geos-devel mailing list