Question

I currently scratch my head for a few days about "How to cartography an UIView on iOS".

Explanations:

I have some data with a lot of locations (longitude and latitude). I'm searching how can I, from a country, display these locations. I can't use a MapView because it's only for one country. On this map, I would like display the locations. It's like Google Analytic do, but in web application: enter image description here

So, my question is: is it possible to "transform" an UIView into a map ? Do you have any idea how can I start this project ?

EDIT:

Maybe I have to use the MapBox SDK ?

EDIT 2:

Here one method which convert coordinate to a screen location (MapBox). It can be useful! coordinateToPixel

Thank you so much for your suggestions and ideas ;)

Best regards, Lapinou.

Was it helpful?

Solution

If its just a static image and there is no zooming then thats maybe not that complex, unless there's some complexity I'm overlooking.

Using the scale of the map image you can convert that to points i.e. 1 point vertically is 10 miles. Then if you have your plot point co-ordinates you should be able to convert those to UIView x.y co-ordinate.

You could pick a reference point in the UK whose lat/long you know as an anchor from which to calculate the lat and long offsets from for the points you want plot.

Lets say there is a hypothetical tiny island in the top left hand of your picture, you can find out the lat/long for it and plot it at x,y of 0,0 when displaying your map image. Then you can calculate the difference in lat/long from that reference point of your pins and convert that difference into an x,y offset from 0,0.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top