[geos-devel] Question

LiN YongHeng bicealyh at gmail.com
Tue Mar 31 23:18:54 EDT 2009


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.html


More information about the geos-devel mailing list