Mapsui: Displaying a marker with an image at a specific position.

Created on 20 Jul 2018  路  7Comments  路  Source: Mapsui/Mapsui

Hello!

As described in issue 148*, I am also trying to create a marker within my map.
I have implemented the map in a docking window and would like to place a marker at a certain position (long, lat) using a method. I would like to give the marker its own image and call up a text label with the information Latitude and Longitude by clicking on the marker.
The problem is that as a student I still have little experience with C# and map libraries and I'm going around in circles when it comes to how to place such a marker.

Thank you very much for your help in advance!

*(https://github.com/Mapsui/Mapsui/issues/148)

question

All 7 comments

Hello, I updated a some of the documentation. I hope this is helpful.
https://github.com/Mapsui/Mapsui/blob/master/docfx/documentation/projections.md#the-most-common-scenario

Also look at the PointsSample where lat/lon coordinates are placed on the map:
https://github.com/Mapsui/Mapsui/blob/master/Samples/Mapsui.Samples.Common/Maps/PointsSample.cs

Hello Paul!

Thanks to your answer I can now display markers specifically on my map!

Now I am facing two other problems:

  • Is it possible to display an own image instead of a point and to open a text label when clicking on the marker, which e.g. contains the coordinates as information? Where do I have to start to implement this?

  • If I want to create a marker at a certain coordinate, the coordinates are converted by the function "public Mapsui.Geometries.Point FromLonLat(double lon, double lat)" and finally displayed at a completely different location on the map. Do I still have to apply a transformation of the coordinates?

Thanks for your time and help =)

capture

Using your own image. The sample I pointed to uses a custom image:
https://github.com/Mapsui/Mapsui/blob/master/Samples/Mapsui.Samples.Common/Maps/PointsSample.cs

I don't understand your second problem. How is it different from your initial problem? Are you sure lat and lon are not inverted?

Thanks a lot the sample really helped me .
the coordinate problem was because of a wrong tranformation on my side.
displaying an image was solved using a MemoryStream object.
this issue can be closed now.
Thanks a lot =)

Thanks for the feedback.

Hi @othmaniav, i have same issue, unable to show icons on maps, can you share the code how you done it. I tried using symbol style but couldnt able to get the image as marker to a location on map,

Why is simple displaying marker so complicated? This is a basic feature in every map library.

Was this page helpful?
0 / 5 - 0 ratings