Hi,
I've been working with the same three lines of code for about 6 hours now, and I'm at a loss. I'm trying to take a shape delivered from SQL in WKT, reproject it as a VETile, and then get the bitmap and return it. I can load the WKT fine. However, if I try to reproject it. I get an error. The error occurs when calling getbitmap, but the stack trace shows that the violation actually occurs when accessing the projection. The result is the same in the web edition as in the desktop edition. Below is the error and some of the code. ANY help would be appreciated.
[AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.] ThinkGeo.MapSuite.Core.Proj4Projection.pj_init(Int32 argc, String[] args) +0 ThinkGeo.MapSuite.Core.Proj4Projection.OpenCore() +185 ThinkGeo.MapSuite.Core.FeatureSource.Open() +84 ThinkGeo.MapSuite.Core.VectorLayer.OpenCore() +25 ThinkGeo.MapSuite.Core.Layer.Open() +12 ThinkGeo.MapSuite.DesktopEdition.Overlay.Draw(GeoCanvas canvas, Object nativeImage, RectangleShape canvasExtent, GeographyUnit mapUnit) +217 ThinkGeo.MapSuite.DesktopEdition.x65fdca92d79c01f5.x2d1a07f71f20336d(Int32 xa209325f5c895f7e, Int32 x7454a0d1965919b1, Boolean xcdc4574d58d5c2d6) +1331 ThinkGeo.MapSuite.DesktopEdition.WinformsMap.GetBitmap(Int32 width, Int32 height) +19 ThinkGeoImage.WebForm1.Page_Load(Object sender, EventArgs e) in C:\Documents and Settings\Grant Hamm\My Documents\Visual Studio 2008\Projects\ThinkGeoImage\ThinkGeoImage\WebForm1.aspx.vb:95 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +50 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
Dim mapShapeLayer As InMemoryFeatureLayer = New InMemoryFeatureLayer()
mapShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.FromArgb(255, Item.FillColor.R, Item.FillColor.G, Item.FillColor.B)
mapShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColor.FromArgb(255, Item.LineColor.R, Item.LineColor.G, Item.LineColor.B)
mapShapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
mapShapeLayer.InternalFeatures.Add(AWhereReader("UniqueFeatureValue") & count, x)
Dim proj4 As New Proj4Projection
proj4.InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(4326)
proj4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString
mapShapeLayer.FeatureSource.Projection = proj4
Map1.StaticOverlay.Layers.Add(AWhereReader("UniqueFeatureValue") & count, mapShapeLayer)
That's the code to load a WKT shape.
Then the bitmap call is just:
Map1.CurrentExtent = New RectangleShape(-105.5, 39.9, -105.45, 39.4)
Map1.MapUnit = GeographyUnit.Meter
img = Map1.GetBitmap(256, 256)
img.Save("C:\test123.png")
Thanks in advance!