[mapserver-dev] Weak-ass, Potentially Dangerous Fix for Mapscript WKT Errors

Dan Little danlittle at yahoo.com
Wed Sep 16 13:41:02 EDT 2009


http://trac.osgeo.org/mapserver/ticket/2763

I actually have seen this problem rear it's ugly head in Python on a number of applications.  It seems specifically linked to 64-bit platforms as my old Pentium 4 didn't seem to have the same issues.

Now, what I've done is a hack... I don't expect it to be anything more but it has fixed my issues...

In mapgeos.c ... comment out the msGEOSFreeGeomtry line.  I'm not sure how msGEOSFreeGeometry updates the geometry as according to the comments.   I just followed the line of logic from GDB, commented out some code, and magically things started to work as expected.

char *msGEOSShapeToWKT(shapeObj *shape)
{
#ifdef USE_GEOS
  GEOSGeom g;

  if(!shape)
    return NULL;

  /* if we have a geometry, we should update it*/
  /* msGEOSFreeGeometry(shape->geometry); */

  shape->geometry = (GEOSGeom) msGEOSShape2Geometry(shape);
  g = (GEOSGeom) shape->geometry;
  if(!g) return NULL;

  return GEOSGeomToWKT(g);
#else
  msSetError(MS_GEOSERR, "GEOS support is not available.", "msGEOSShapeToWKT()");
  return NULL;
#endif
}

My hope is that someone with a little more free time and effort may be able either confirm this is a real fix (doubt it) or find the real fix with more familiarity to the msGEOS* code base.

-Duck



      


More information about the mapserver-dev mailing list