Adding a simple dot or line on the map (using mapwingis)

Jan 23, 2015 at 7:15 PM
Edited Jan 23, 2015 at 7:16 PM
Hi there,

I just started with MapWinGIS activex control in vb express 2010.

showing google maps or openstreetmaps etc goes well, I use following code:
AxMap1.Projection = MapWinGIS.tkMapProjection.PROJECTION_GOOGLE_MERCATOR
    AxMap1.TileProvider = MapWinGIS.tkTileProvider.GoogleHybrid
    AxMap1.KnownExtents = MapWinGIS.tkKnownExtents.keNetherlands
    AxMap1.Tiles.DoCaching(MapWinGIS.tkCacheType.Both) = True
    AxMap1.Tiles.UseCache(MapWinGIS.tkCacheType.Both) = True
Then I want to add some lines and dots on this map, coming from measurements we did,
I use following code:
Dim DrawingLayerHandle As Integer
    DrawingLayerHandle = Map.NewDrawing(MapWinGIS.tkDrawReferenceList.dlSpatiallyReferencedList)
    Map.DrawCircleEx(DrawingLayerHandle, Longitude, Latitude, 1000000, System.Convert.ToUInt32(RGB(255, 0, 0)), True)
With every longitude and latitude I use, the circle is drawed at coordinages 0;0 ?

I tried other things like loading a KML file with the same result, the kml coordinates are being ignored and the figure is drawed around coordinates 0,0;
  Dim filename = "c:\klad\maps\example.kml"
  AxMap1.AddLayerFromFilename(filename, tkFileOpenStrategy.fosAutoDetect, True)
Example kml:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="">
<description>Examples of paths. Note that the tessellate tag is by default
  set to 0. If you want to create tessellated lines, they must be authored
  (or edited) directly in KML.</description>
<Style id="yellowLineGreenPoly">
  <name>Absolute Extruded</name>
  <description>Transparent green wall with yellow outlines</description>

Anyone can help?

Jan 24, 2015 at 7:33 AM
Edited Jan 24, 2015 at 7:34 AM
It seems that you are not reprojecting coordinates. Your map project is spherical Mercator (in meters) while you are passing coordinates as degrees.

You should use AxMap.DegreesToProjection method (see Adding markers to the map here).

For vector layers (KML) automatic reprojection can be set up, see "Improved API for projection mismatch testing" here.

It's also possible to do reprojection of any data manually via GeoProjection class (StartTransform, Transform, StopTransform).

However the easiest option for you is to set WGS84 equirectangular projection (AxMap.Projection = tkMapProjection.PROJECTION_WGS84). Background tiles will be somewhat scaled then, but your data won't need transformation.