[mapserver-dev] Problem with projectionObj
GMail
itacasoft at gmail.com
Sun Oct 2 17:48:55 EDT 2011
Hello everybody,
I have discovered a blocking problem with projectionObj. I have some layers in WGS84 that want to reproject in Sferical Mercatore (google maps) on the fly, then send back a PNG image to the client.
Here is my code:
protected virtual void DrawAMap(HttpContext context)
{
bool exists;
string filename = RequestParser.GetParamAsString(context.Request, "map", out exists);
mapObj map = new mapObj(filename);
map.width = RequestParser.GetParamAsInteger(context.Request, "width", out exists);
map.height = RequestParser.GetParamAsInteger(context.Request, "height", out exists);
rectObj bbox = RequestParser.GetParamAsExtent(context.Request, "bbox", out exists);
map.setProjection("+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs");
projectionObj projMercatore = null;
projectionObj projWGS84 = null;
if (projMercatore == null)
{
projMercatore = new projectionObj(MERCATORE_PROJ4);
}
if (projWGS84 == null)
{
projWGS84 = new projectionObj(WGS84_PROJ4);
}
///HERE first time OK, second or third time hangs!!!
bbox.project(projWGS84, projMercatore);
map.extent = bbox;
imageObj image = map.draw();
MemoryStream memstrm = new MemoryStream(image.getBytes());
context.Response.StatusCode = 200;
context.Response.ContentType = "image/png";
memstrm.Position = 0;
context.Response.BinaryWrite(memstrm.ToArray());
context.Response.Flush();
}
Environtment: MapScript C# + VS2010 + ASP.NET 3.5 + IIS7.0 + MapServer 6.0.1 + Windows 7 Pro.
Problem is that the rectObj.project() instruction hangs the second or third time it is hit. No error is visible on the eventviewer, I just have to reset IIS. If I avoid reprojecting, this code works just fine. Same code worked using mapscript_csharp.dll from a Delphi program, so I suppose that the problem should be in the C# SWIG interface. Am I missing something?
Thanks
Fabrizio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20111002/b81302d5/attachment.html
More information about the mapserver-dev
mailing list