Help with getting started with C1MAP on VB.net

Posted by: dan on 6 May 2024, 8:19 am EST

    • Post Options:
    • Link

    Posted 6 May 2024, 8:19 am EST

    Hi

    I’m trying to add long/lat points to a map control. I’ve obviously missed a step somewhere since my locations aren’t appearing where I expect!

    The examples that list the VB code don’t bear any relation to real world coordinates and I can’t work out how to convert from long/lat to screen or logic. The sample files are only in C#, so they don’t help.

    I’m at the start of my journey with this component so any help would be gratefully received!

    Thanks

    Dan

  • Posted 6 May 2024, 9:16 pm EST - Updated 6 May 2024, 11:59 pm EST

    …and I’ve fixed my own problem! I noticed that the example:

    'set the geometry shape for vector placemark
    vpl.Geometry = New GeoPoint(75, 25)
    showed a location in Rajasthan but when I put those coordinates into Google Maps, it put me in the Barents Sea, north of Finland. Then I realised that the coordinates are the wrong way round.

    I am used to putting the location as (Latitude, Longitude) but the GeoPoint function requires (Longitude,Latitude)!

  • Posted 6 May 2024, 9:43 pm EST

    Hello Dan,

    You can use GeoPoint(x, y)[https://developer.mescius.com/componentone/docs/win/online-maps/C1.Win.Map.4.8~C1.FlexMap.GeoPoint.html] to set the Latitude and Logitude points in the C1Map as follows:

    Dim vpl As New C1.Win.Map.VectorPlacemark()
    vpl.Style.BackColor = Color.Aqua
    vpl.Marker.Shape = MarkerShape.Diamond
    vpl.Marker.Size = New SizeF(10, 10)
    vpl.Geometry = New GeoPoint(75, 25)
    layer.Items.Add(vpl)


    To calculate the logical and screen points from the geographical points, you can use C1Map.GeographicToLogic() and C1Map.GeographicToScreen() methods as follows:

    Dim logicalPoint = C1Map1.GeographicToLogic(vpl.Geometry.Center)
    Dim screenPoint = C1Map1.GeographicToScreen(vpl.Geometry.Center)


    Please refer to the attached sample for implementation. (see Map_CoordinatesSample.zip)

    We are sorry but we currently do not have product samples in VB.NET. Rest assured, you can reach out to us at any time if you have any doubts or queries, and we’ll assist you in the best way possible.

    Regards,

    Uttkarsh.

  • Posted 7 May 2024, 12:02 am EST

    Thanks - I’ve seen this and it was the fact that coordinates are normally shown as Latitude/Longitude (y,x) but the GeoPoint function requires the coordinates swapped, ie: Longitude,Latitude (x,y).

    I’ve now got the control working and I’m really impressed with how good it is. Thank you!

  • Posted 7 May 2024, 2:44 pm EST

    Hello Dan,

    Thank you for your appreciation. We are glad to know that you got it working.

    If you require any further assistance or have any questions, please do not hesitate to reach out to us.

    Regards,

    Uttkarsh.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels