<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, &amp;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 &amp;&amp; SRID != 0)  /*The problem is here*/<br>          writeInt(SRID);<br>}</div>
<div>If I don&#39;t give the SRID number to the WKBWriter, it always have zero number and can&#39;t past the if condition.</div>
<div> </div>
<div>Best regards,<br><br></div>
<div class="gmail_quote">2009/4/2 <span dir="ltr">&lt;<a href="mailto:geos-devel-request@lists.osgeo.org">geos-devel-request@lists.osgeo.org</a>&gt;</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 &#39;help&#39; 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 &quot;Re: Contents of geos-devel digest...&quot;<br><br><br>Today&#39;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 &lt;<a href="mailto:pramsey@opengeo.org">pramsey@opengeo.org</a>&gt;<br>Subject: Re: [geos-devel] Question<br>To: LiN YongHeng &lt;<a href="mailto:bicealyh@gmail.com">bicealyh@gmail.com</a>&gt;<br>Cc: <a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a><br>
Message-ID: &lt;<a href="mailto:791C9529-32B0-416F-B03C-EC9DB8B36439@opengeo.org">791C9529-32B0-416F-B03C-EC9DB8B36439@opengeo.org</a>&gt;<br>Content-Type: text/plain; charset=&quot;us-ascii&quot;<br><br><br>There&#39;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 &#39;SRID=9999;...&#39; 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>&gt; hello Paul Ramsey and anyone,<br>&gt; The function GEOSGeomToWKB_buf() doesn&#39;t include the SRID. if I want<br>&gt; to output encodings that embed the srid, how<br>&gt; can I do?<br>&gt;<br>&gt; 2009/3/31 Paul Ramsey &lt;<a href="mailto:pramsey@opengeo.org">pramsey@opengeo.org</a>&gt;<br>
&gt; To clarify: your first representation is nonstandard:<br>&gt;<br>&gt;  SRID=5001;POINT(44 31)<br>&gt;<br>&gt; GEOS will accept it, but it won&#39;t emit it. If you print out<br>&gt;<br>&gt;  GEOSGeomToWKT(g1)<br>&gt;<br>
&gt; you will see the standard representation<br>&gt;<br>&gt;  POINT(44 31)<br>&gt;<br>&gt; which you&#39;ll note doesn&#39;t include the SRID.<br>&gt;<br>&gt; It doesn&#39;t actually look like we support output encodings that embed<br>
&gt; the srid... odd.<br>&gt;<br>&gt; P<br>&gt;<br>&gt; On Tue, Mar 31, 2009 at 8:42 AM, strk &lt;<a href="mailto:strk@keybit.net">strk@keybit.net</a>&gt; wrote:<br>&gt; &gt; On Tue, Mar 31, 2009 at 11:24:50PM +0800, LiN YongHeng wrote:<br>
&gt; &gt;&gt; hello everyone, Please look these code:<br>&gt; &gt;&gt; GEOSGeom g1, g2;<br>&gt; &gt;&gt; g1 = GEOSGeomFromWKT(&quot;SRID=5001;POINT(44 31)&quot;);<br>&gt; &gt;&gt; g1srid = GEOSGetSRID(g1);<br>&gt; &gt;&gt; g2 = GEOSGeomFromWKT(GEOSGeomToWKT(g1));<br>
&gt; &gt;&gt; g2srid= GEOSGetSRID(g2);<br>&gt; &gt;&gt; g2srid not have the same value with g1srid, which g1srid value is<br>&gt; 5001 and<br>&gt; &gt;&gt; g2srid is -1. My GEOS version is &quot;3.1.0&quot;. I don&#39;t know why? Can<br>
&gt; anyone give<br>&gt; &gt;&gt; me answer<br>&gt; &gt;<br>&gt; &gt; The WKT standard doesn&#39;t include a SRID specification,<br>&gt; &gt; so GEOSGeomToWKT won&#39;t get it. Still GEOSGeomFromWKT<br>&gt; &gt; accepts that.<br>
&gt; &gt;<br>&gt; &gt; --strk;<br>&gt; &gt;<br>&gt; &gt;  Free GIS &amp; Flash consultant/developer      ()  ASCII Ribbon<br>&gt; Campaign<br>&gt; &gt;  <a href="http://foo.keybit.net/~strk/services.html" target="_blank">http://foo.keybit.net/~strk/services.html</a>  /\  Keep it simple!<br>
&gt; &gt; _______________________________________________<br>&gt; &gt; geos-devel mailing list<br>&gt; &gt; <a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a><br>&gt; &gt; <a href="http://lists.osgeo.org/mailman/listinfo/geos-devel" target="_blank">http://lists.osgeo.org/mailman/listinfo/geos-devel</a><br>
&gt; &gt;<br>&gt;<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 &lt;<a href="mailto:pramsey@opengeo.org">pramsey@opengeo.org</a>&gt;<br>Subject: Re: [geos-devel] Question<br>
To: LiN YongHeng &lt;<a href="mailto:bicealyh@gmail.com">bicealyh@gmail.com</a>&gt;<br>Cc: <a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a><br>Message-ID: &lt;<a href="mailto:8D10AAE4-DA8D-4204-B173-8A543C1AA1D5@opengeo.org">8D10AAE4-DA8D-4204-B173-8A543C1AA1D5@opengeo.org</a>&gt;<br>
Content-Type: text/plain; charset=&quot;us-ascii&quot;<br><br>And if you want to submit patches for EWKT and EWKB outputs, we&#39;d love<br>to see them.<br><br>P<br><br>On 31-Mar-09, at 6:07 PM, LiN YongHeng wrote:<br><br>
&gt; hello Paul Ramsey and anyone,<br>&gt; The function GEOSGeomToWKB_buf() doesn&#39;t include the SRID. if I want<br>&gt; to output encodings that embed the srid, how<br>&gt; can I do?<br>&gt;<br>&gt; 2009/3/31 Paul Ramsey &lt;<a href="mailto:pramsey@opengeo.org">pramsey@opengeo.org</a>&gt;<br>
&gt; To clarify: your first representation is nonstandard:<br>&gt;<br>&gt;  SRID=5001;POINT(44 31)<br>&gt;<br>&gt; GEOS will accept it, but it won&#39;t emit it. If you print out<br>&gt;<br>&gt;  GEOSGeomToWKT(g1)<br>&gt;<br>
&gt; you will see the standard representation<br>&gt;<br>&gt;  POINT(44 31)<br>&gt;<br>&gt; which you&#39;ll note doesn&#39;t include the SRID.<br>&gt;<br>&gt; It doesn&#39;t actually look like we support output encodings that embed<br>
&gt; the srid... odd.<br>&gt;<br>&gt; P<br>&gt;<br>&gt; On Tue, Mar 31, 2009 at 8:42 AM, strk &lt;<a href="mailto:strk@keybit.net">strk@keybit.net</a>&gt; wrote:<br>&gt; &gt; On Tue, Mar 31, 2009 at 11:24:50PM +0800, LiN YongHeng wrote:<br>
&gt; &gt;&gt; hello everyone, Please look these code:<br>&gt; &gt;&gt; GEOSGeom g1, g2;<br>&gt; &gt;&gt; g1 = GEOSGeomFromWKT(&quot;SRID=5001;POINT(44 31)&quot;);<br>&gt; &gt;&gt; g1srid = GEOSGetSRID(g1);<br>&gt; &gt;&gt; g2 = GEOSGeomFromWKT(GEOSGeomToWKT(g1));<br>
&gt; &gt;&gt; g2srid= GEOSGetSRID(g2);<br>&gt; &gt;&gt; g2srid not have the same value with g1srid, which g1srid value is<br>&gt; 5001 and<br>&gt; &gt;&gt; g2srid is -1. My GEOS version is &quot;3.1.0&quot;. I don&#39;t know why? Can<br>
&gt; anyone give<br>&gt; &gt;&gt; me answer<br>&gt; &gt;<br>&gt; &gt; The WKT standard doesn&#39;t include a SRID specification,<br>&gt; &gt; so GEOSGeomToWKT won&#39;t get it. Still GEOSGeomFromWKT<br>&gt; &gt; accepts that.<br>
&gt; &gt;<br>&gt; &gt; --strk;<br>&gt; &gt;<br>&gt; &gt;  Free GIS &amp; Flash consultant/developer      ()  ASCII Ribbon<br>&gt; Campaign<br>&gt; &gt;  <a href="http://foo.keybit.net/~strk/services.html" target="_blank">http://foo.keybit.net/~strk/services.html</a>  /\  Keep it simple!<br>
&gt; &gt; _______________________________________________<br>&gt; &gt; geos-devel mailing list<br>&gt; &gt; <a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a><br>&gt; &gt; <a href="http://lists.osgeo.org/mailman/listinfo/geos-devel" target="_blank">http://lists.osgeo.org/mailman/listinfo/geos-devel</a><br>
&gt; &gt;<br>&gt;<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 &lt;<a href="mailto:bicealyh@gmail.com">bicealyh@gmail.com</a>&gt;<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>       &lt;<a href="mailto:11e4f1140903312018u5d6c9461t781500e86acac6fd@mail.gmail.com">11e4f1140903312018u5d6c9461t781500e86acac6fd@mail.gmail.com</a>&gt;<br>
Content-Type: text/plain; charset=&quot;iso-8859-1&quot;<br><br>hello anybody ,<br>I have seen the source code, which have writen the SRID, just like below<br>codes.  Why don&#39;t you say that the output not  contain<br>
the SRID? but the fact that the output don&#39;t contain the SRID, so<br>I really puzzle about  this.<br>-------------------------------Source<br>Code---------------------------------------<br>void<br>WKBWriter::writePolygon(const Polygon &amp;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-&gt;getCoordinatesRO();<br> assert(cs);<br> writeCoordinateSequence(*cs, true);<br> for (int i=0; i&lt;nholes; i++)<br> {<br> ls = g.getInteriorRingN(i);<br> assert(ls);<br>
 cs = ls-&gt;getCoordinatesRO();<br> assert(cs);<br> writeCoordinateSequence(*cs, true);<br> }<br>}<br>-------------------------------Source<br>Code---------------------------------------<br>2009/3/31 strk &lt;<a href="mailto:strk@keybit.net">strk@keybit.net</a>&gt;<br>
<br>&gt; On Tue, Mar 31, 2009 at 11:24:50PM +0800, LiN YongHeng wrote:<br>&gt; &gt; hello everyone, Please look these code:<br>&gt; &gt; GEOSGeom g1, g2;<br>&gt; &gt; g1 = GEOSGeomFromWKT(&quot;SRID=5001;POINT(44 31)&quot;);<br>
&gt; &gt; g1srid = GEOSGetSRID(g1);<br>&gt; &gt; g2 = GEOSGeomFromWKT(GEOSGeomToWKT(g1));<br>&gt; &gt; g2srid= GEOSGetSRID(g2);<br>&gt; &gt; g2srid not have the same value with g1srid, which g1srid value is 5001<br>&gt; and<br>
&gt; &gt; g2srid is -1. My GEOS version is &quot;3.1.0&quot;. I don&#39;t know why? Can anyone<br>&gt; give<br>&gt; &gt; me answer<br>&gt;<br>&gt; The WKT standard doesn&#39;t include a SRID specification,<br>&gt; so GEOSGeomToWKT won&#39;t get it. Still GEOSGeomFromWKT<br>
&gt; accepts that.<br>&gt;<br>&gt; --strk;<br>&gt;<br>&gt;  Free GIS &amp; Flash consultant/developer      ()  ASCII Ribbon Campaign<br>&gt;  <a href="http://foo.keybit.net/~strk/services.html" target="_blank">http://foo.keybit.net/~strk/services.html</a>  /\  Keep it simple!<br>
&gt;<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 &lt;<a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a>&gt;<br>Subject: Re: [geos-devel] Question<br>
To: GEOS Development List &lt;<a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a>&gt;<br>Cc: <a href="mailto:geos-devel@geos.refractions.net">geos-devel@geos.refractions.net</a><br>Message-ID: &lt;<a href="mailto:49D2E31B.90109@pobox.com">49D2E31B.90109@pobox.com</a>&gt;<br>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br><br>LiN YongHeng wrote:<br>&gt; hello anybody ,<br>&gt; I have seen the source code, which have writen the SRID, just like below<br>&gt; codes.  Why don&#39;t you say that the output not  contain<br>
&gt; the SRID? but the fact that the output don&#39;t contain the SRID, so<br>&gt; I really puzzle about  this.<br>&gt; -------------------------------Source<br>&gt; Code---------------------------------------<br>&gt; void<br>
&gt; WKBWriter::writePolygon(const Polygon &amp;g)<br>&gt; {<br>&gt;  writeByteOrder();<br>&gt;<br>&gt;  writeGeometryType(WKBConstants::wkbPolygon, g.getSRID());<br>&gt;  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 &lt;<a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a>&gt;<br>Subject: Re: [geos-devel] Question<br>To: GEOS Development List &lt;<a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a>&gt;<br>
Cc: <a href="mailto:geos-devel@geos.refractions.net">geos-devel@geos.refractions.net</a><br>Message-ID: &lt;<a href="mailto:49D2E31B.90109@pobox.com">49D2E31B.90109@pobox.com</a>&gt;<br>Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br>
<br>LiN YongHeng wrote:<br>&gt; hello anybody ,<br>&gt; I have seen the source code, which have writen the SRID, just like below<br>&gt; codes.  Why don&#39;t you say that the output not  contain<br>&gt; the SRID? but the fact that the output don&#39;t contain the SRID, so<br>
&gt; I really puzzle about  this.<br>&gt; -------------------------------Source<br>&gt; Code---------------------------------------<br>&gt; void<br>&gt; WKBWriter::writePolygon(const Polygon &amp;g)<br>&gt; {<br>&gt;  writeByteOrder();<br>
&gt;<br>&gt;  writeGeometryType(WKBConstants::wkbPolygon, g.getSRID());<br>&gt;  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>