ThinkGeo.com    |     Documentation    |     Premium Support

Error getting image properties

I have two applications and am using the following method in both


 


        Dim IconPath As String = Get_GIS_Icon(Unit_Name)



        If System.IO.File.Exists(IconPath) = False Then

            IconPath = AppPath & "\icons\gis\base.png"

        End If



        gisMap.Overlays("iconOverlay").Lock.EnterWriteLock()



        Dim myFeature As New Feature(Lon, Lat, Unit_Name)



        Try



            Dim myMapShape As New MapShape(myFeature)



            myMapShape.ZoomLevels.ZoomLevel01.DefaultTextStyle.TextColumnName = "Unit_Name"

            myMapShape.ZoomLevels.ZoomLevel01.DefaultPointStyle = New PointStyle(New GeoImage(IconPath))

            myMapShape.ZoomLevels.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20





            Dim Y As Integer = myMapShape.ZoomLevels.ZoomLevel01.DefaultPointStyle.Image.GetHeight()


 


NOTE - Y is to get the offset for the label attached to the mapshape


****************


The first works fine with


Dim Y As Integer = myMapShape.ZoomLevels.ZoomLevel01.DefaultPointStyle.Image.GetHeight()


 


 


the second fails at that point and I have to do


            Dim myImage As New Bitmap(IconPath)



            Dim Y As Integer = myImage.Height


 


 


I have compared the propeties of myMapShape in both and they look the same


 


 


Any ideas 


 


Ewan


 


 


 



Ewan,


When we wrote some code based on your code like this:

MapShape mapShape1 = new MapShape(new Feature(-104, 42));
mapShape1.ZoomLevels.ZoomLevel01.DefaultPointStyle = new PointStyle(new GeoImage(@"..\..\Data\Cargo Plane.png"));
mapShape1.ZoomLevels.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
mapShapeLayer.MapShapes.Add("1", mapShape1);

int y = mapShape1.ZoomLevels.ZoomLevel01.DefaultPointStyle.Image.GetHeight();
mapShape1.ZoomLevels.ZoomLevel01.DefaultPointStyle.YOffsetInPixel = y;

 
It works fine. So can you send us a small sample which is like your second application so that we can recreate the problem and to see how to solve it.
Any more information is appreciated.
Thanks,
sun