[geos-devel] Re: geos-devel Digest, Vol 78, Issue 1
LiN YongHeng
bicealyh at gmail.com
Wed Apr 1 23:24:30 EDT 2009
Hi anybody,
I know that. I give the example just want to say that WKBWriter output is
the same with WKTWriter, not having the SRID.But if I use the below codes,
it can contains the SRID.
---------------------------------------CODES-------------------------------------
pWriter = GEOSWKBWriter_create();
GEOSWKBWriter_setIncludeSRID(pWriter ,srid); /*write SRID in the
GEOSWKBWriter*/
pWKB = GEOSWKBWriter_write(pWriter , g3, &size);
--------------------------------------------CODE-------------------------------
Now, pWKB have the SRID!
I look at the GEOS source codes, find that the problem is just like below
code I have note.
void
WKBWriter::writeSRID(int SRID)
{
if (includeSRID && SRID != 0) /*The problem is here*/
writeInt(SRID);
}
If I don't give the SRID number to the WKBWriter, it always have zero number
and can't past the if condition.
Best regards,
2009/4/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: Question (Paul Ramsey)
> 2. Re: Question (Paul Ramsey)
> 3. Re: Question (LiN YongHeng)
> 4. Re: Question (Frank Warmerdam)
> 5. Re: Question (Frank Warmerdam)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 31 Mar 2009 18:09:20 -0700
> From: Paul Ramsey <pramsey at opengeo.org>
> Subject: Re: [geos-devel] Question
> To: LiN YongHeng <bicealyh at gmail.com>
> Cc: geos-devel at lists.osgeo.org
> Message-ID: <791C9529-32B0-416F-B03C-EC9DB8B36439 at opengeo.org>
> Content-Type: text/plain; charset="us-ascii"
>
>
> There's no way right now. You could do a little work on your client
> side, and pull both the WKT and the SRID, then concatenate them into
> an output string with 'SRID=9999;...' just like your input. In the
> longer run, we could add EWKT and EWKB outputs. :/
>
> P
>
> On 31-Mar-09, at 6:07 PM, LiN YongHeng wrote:
>
> > hello Paul Ramsey and anyone,
> > The function GEOSGeomToWKB_buf() doesn't include the SRID. if I want
> > to output encodings that embed the srid, how
> > can I do?
> >
> > 2009/3/31 Paul Ramsey <pramsey at opengeo.org>
> > To clarify: your first representation is nonstandard:
> >
> > SRID=5001;POINT(44 31)
> >
> > GEOS will accept it, but it won't emit it. If you print out
> >
> > GEOSGeomToWKT(g1)
> >
> > you will see the standard representation
> >
> > POINT(44 31)
> >
> > which you'll note doesn't include the SRID.
> >
> > It doesn't actually look like we support output encodings that embed
> > the srid... odd.
> >
> > P
> >
> > On Tue, Mar 31, 2009 at 8:42 AM, strk <strk at keybit.net> wrote:
> > > On Tue, Mar 31, 2009 at 11:24:50PM +0800, LiN YongHeng wrote:
> > >> hello everyone, Please look these code:
> > >> GEOSGeom g1, g2;
> > >> g1 = GEOSGeomFromWKT("SRID=5001;POINT(44 31)");
> > >> g1srid = GEOSGetSRID(g1);
> > >> g2 = GEOSGeomFromWKT(GEOSGeomToWKT(g1));
> > >> g2srid= GEOSGetSRID(g2);
> > >> g2srid not have the same value with g1srid, which g1srid value is
> > 5001 and
> > >> g2srid is -1. My GEOS version is "3.1.0". I don't know why? Can
> > anyone give
> > >> me answer
> > >
> > > The WKT standard doesn't include a SRID specification,
> > > so GEOSGeomToWKT won't get it. Still GEOSGeomFromWKT
> > > accepts that.
> > >
> > > --strk;
> > >
> > > Free GIS & Flash consultant/developer () ASCII Ribbon
> > Campaign
> > > http://foo.keybit.net/~strk/services.html /\ Keep it simple!
> > > _______________________________________________
> > > geos-devel mailing list
> > > geos-devel at lists.osgeo.org
> > > http://lists.osgeo.org/mailman/listinfo/geos-devel
> > >
> >
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.osgeo.org/pipermail/geos-devel/attachments/20090331/e0866f02/attachment-0001.html
>
> ------------------------------
>
> Message: 2
> Date: Tue, 31 Mar 2009 18:09:48 -0700
> From: Paul Ramsey <pramsey at opengeo.org>
> Subject: Re: [geos-devel] Question
> To: LiN YongHeng <bicealyh at gmail.com>
> Cc: geos-devel at lists.osgeo.org
> Message-ID: <8D10AAE4-DA8D-4204-B173-8A543C1AA1D5 at opengeo.org>
> Content-Type: text/plain; charset="us-ascii"
>
> And if you want to submit patches for EWKT and EWKB outputs, we'd love
> to see them.
>
> P
>
> On 31-Mar-09, at 6:07 PM, LiN YongHeng wrote:
>
> > hello Paul Ramsey and anyone,
> > The function GEOSGeomToWKB_buf() doesn't include the SRID. if I want
> > to output encodings that embed the srid, how
> > can I do?
> >
> > 2009/3/31 Paul Ramsey <pramsey at opengeo.org>
> > To clarify: your first representation is nonstandard:
> >
> > SRID=5001;POINT(44 31)
> >
> > GEOS will accept it, but it won't emit it. If you print out
> >
> > GEOSGeomToWKT(g1)
> >
> > you will see the standard representation
> >
> > POINT(44 31)
> >
> > which you'll note doesn't include the SRID.
> >
> > It doesn't actually look like we support output encodings that embed
> > the srid... odd.
> >
> > P
> >
> > On Tue, Mar 31, 2009 at 8:42 AM, strk <strk at keybit.net> wrote:
> > > On Tue, Mar 31, 2009 at 11:24:50PM +0800, LiN YongHeng wrote:
> > >> hello everyone, Please look these code:
> > >> GEOSGeom g1, g2;
> > >> g1 = GEOSGeomFromWKT("SRID=5001;POINT(44 31)");
> > >> g1srid = GEOSGetSRID(g1);
> > >> g2 = GEOSGeomFromWKT(GEOSGeomToWKT(g1));
> > >> g2srid= GEOSGetSRID(g2);
> > >> g2srid not have the same value with g1srid, which g1srid value is
> > 5001 and
> > >> g2srid is -1. My GEOS version is "3.1.0". I don't know why? Can
> > anyone give
> > >> me answer
> > >
> > > The WKT standard doesn't include a SRID specification,
> > > so GEOSGeomToWKT won't get it. Still GEOSGeomFromWKT
> > > accepts that.
> > >
> > > --strk;
> > >
> > > Free GIS & Flash consultant/developer () ASCII Ribbon
> > Campaign
> > > http://foo.keybit.net/~strk/services.html /\ Keep it simple!
> > > _______________________________________________
> > > geos-devel mailing list
> > > geos-devel at lists.osgeo.org
> > > http://lists.osgeo.org/mailman/listinfo/geos-devel
> > >
> >
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.osgeo.org/pipermail/geos-devel/attachments/20090331/749591cb/attachment-0001.html
>
> ------------------------------
>
> Message: 3
> Date: Wed, 1 Apr 2009 11:18:54 +0800
> From: LiN YongHeng <bicealyh at gmail.com>
> Subject: Re: [geos-devel] Question
> To: geos-devel at geos.refractions.net
> Message-ID:
> <11e4f1140903312018u5d6c9461t781500e86acac6fd at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> hello anybody ,
> I have seen the source code, which have writen the SRID, just like below
> codes. Why don't you say that the output not contain
> the SRID? but the fact that the output don't contain the SRID, so
> I really puzzle about this.
> -------------------------------Source
> Code---------------------------------------
> void
> WKBWriter::writePolygon(const Polygon &g)
> {
> writeByteOrder();
>
> writeGeometryType(WKBConstants::wkbPolygon, g.getSRID());
> writeSRID(g.getSRID());
>
> int nholes = g.getNumInteriorRing();
> writeInt(nholes+1);
> const LineString* ls = g.getExteriorRing();
> assert(ls);
> const CoordinateSequence* cs=ls->getCoordinatesRO();
> assert(cs);
> writeCoordinateSequence(*cs, true);
> for (int i=0; i<nholes; i++)
> {
> ls = g.getInteriorRingN(i);
> assert(ls);
> cs = ls->getCoordinatesRO();
> assert(cs);
> writeCoordinateSequence(*cs, true);
> }
> }
> -------------------------------Source
> Code---------------------------------------
> 2009/3/31 strk <strk at keybit.net>
>
> > On Tue, Mar 31, 2009 at 11:24:50PM +0800, LiN YongHeng wrote:
> > > hello everyone, Please look these code:
> > > GEOSGeom g1, g2;
> > > g1 = GEOSGeomFromWKT("SRID=5001;POINT(44 31)");
> > > g1srid = GEOSGetSRID(g1);
> > > g2 = GEOSGeomFromWKT(GEOSGeomToWKT(g1));
> > > g2srid= GEOSGetSRID(g2);
> > > g2srid not have the same value with g1srid, which g1srid value is 5001
> > and
> > > g2srid is -1. My GEOS version is "3.1.0". I don't know why? Can anyone
> > give
> > > me answer
> >
> > The WKT standard doesn't include a SRID specification,
> > so GEOSGeomToWKT won't get it. Still GEOSGeomFromWKT
> > accepts that.
> >
> > --strk;
> >
> > Free GIS & Flash consultant/developer () ASCII Ribbon Campaign
> > http://foo.keybit.net/~strk/services.html /\ Keep it simple!
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.osgeo.org/pipermail/geos-devel/attachments/20090401/d68061cd/attachment-0001.html
>
> ------------------------------
>
> Message: 4
> Date: Tue, 31 Mar 2009 23:44:27 -0400
> From: Frank Warmerdam <warmerdam at pobox.com>
> Subject: Re: [geos-devel] Question
> To: GEOS Development List <geos-devel at lists.osgeo.org>
> Cc: geos-devel at geos.refractions.net
> Message-ID: <49D2E31B.90109 at pobox.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> LiN YongHeng wrote:
> > hello anybody ,
> > I have seen the source code, which have writen the SRID, just like below
> > codes. Why don't you say that the output not contain
> > the SRID? but the fact that the output don't contain the SRID, so
> > I really puzzle about this.
> > -------------------------------Source
> > Code---------------------------------------
> > void
> > WKBWriter::writePolygon(const Polygon &g)
> > {
> > writeByteOrder();
> >
> > writeGeometryType(WKBConstants::wkbPolygon, g.getSRID());
> > writeSRID(g.getSRID());
>
> LiN,
>
> This is the WKB writer, not the WKT writer.
>
> 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
>
>
>
> ------------------------------
>
> Message: 5
> Date: Tue, 31 Mar 2009 23:44:27 -0400
> From: Frank Warmerdam <warmerdam at pobox.com>
> Subject: Re: [geos-devel] Question
> To: GEOS Development List <geos-devel at lists.osgeo.org>
> Cc: geos-devel at geos.refractions.net
> Message-ID: <49D2E31B.90109 at pobox.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> LiN YongHeng wrote:
> > hello anybody ,
> > I have seen the source code, which have writen the SRID, just like below
> > codes. Why don't you say that the output not contain
> > the SRID? but the fact that the output don't contain the SRID, so
> > I really puzzle about this.
> > -------------------------------Source
> > Code---------------------------------------
> > void
> > WKBWriter::writePolygon(const Polygon &g)
> > {
> > writeByteOrder();
> >
> > writeGeometryType(WKBConstants::wkbPolygon, g.getSRID());
> > writeSRID(g.getSRID());
>
> LiN,
>
> This is the WKB writer, not the WKT writer.
>
> 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
>
>
>
> ------------------------------
>
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geos-devel
>
> End of geos-devel Digest, Vol 78, Issue 1
> *****************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geos-devel/attachments/20090402/d645ce77/attachment-0001.html
More information about the geos-devel
mailing list