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