[mapserver-users] SQL Server 2008 layer C# MapScript query help
Willem Swanepoel
will.swan at ymail.com
Thu Jan 21 21:30:18 PST 2010
Hi,
I'm just starting out with MapServer / MapScript C#.
I get "Attempted to read or write protected memory" when trying to retrieve
the shape of the selection in a SQL Server layer. Code snippet below
(adapted from example code):
if (layer.queryByPoint(Map, point, mapscript.MS_SINGLE, tolerance) ==
(int)MS_RETURN_VALUE.MS_SUCCESS) {
resultCacheObj result = layer.getResults();
if (result.numresults > 0)
{ int shapeInd =
result.getResult(0).shapeindex;
layer.open();
shapeObj shape = layer.getFeature(shapeInd, -1);
<<--Attempted to read or write protected memory
string txt = "";
for (int i = 0; i < shape.numvalues;i++)// layer.numitems; i++)
{
txt += "<b>"+ layer.getItem(i) +": </b>";
txt += " " + shape.getValue(i) +
"<br/>";
} etc.
Additional notes:
* the tolerance > 0
* IIS 5
* using latest build (MSVC2008 (Win32) -stable
release-1500-gdal-1-6-mapserver-5-6.zip) DLLs (including
msplugin_mssql2008.dll)
* VS 2008 project
* the SQL Server layer geometry is points & draws without problems
* code works for other layers in may map
Additional issue:
When doing a queryByShape on the SQL Server layer and try drawQuery on the
map I get "Image handling error. Failed to draw layer..."
Am doing something wrong - is this the correct way of going about querying &
visualizing? Is what I trying to do possible with SQL Server layers?
Any help/pointers appreciated.
Thanks
Will
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20100122/22d4e30f/attachment.htm>
More information about the MapServer-users
mailing list