neveldo / jQuery-Mapael

jQuery plugin based on raphael.js that allows you to display dynamic vector maps
https://www.vincentbroute.fr/mapael/
MIT License
1.01k stars 195 forks source link

getCoords function #370

Open ravivermas opened 6 years ago

ravivermas commented 6 years ago

Hi @neveldo,

I am new to Mapael and I have used this plugin to convert my own svg map to mapael. But I am facing challenge with getCoords function and I am not able to plot markers with the longitude and latitude which I have for cities on map. Frankly speaking, I am not able to understand and apply the logic of x and y in getCoords function.

Can you please help me.

neveldo commented 6 years ago

Hello @ravivermas ,

As said in the other thread, we need more details in order to be able to help you :) . Providing the SVG map should be a good first start.

That said, the algorithm to set for the getCoords() function depends on the projection within your map (equi-rectangular (the simpliest one to handle), mercator, etc). If you don't know the the projection used for your map, it will unfortunatelly not be feasible to write the getCoords() function for it.

ravivermas commented 6 years ago

Hello @neveldo ,

Thanks for your reply. Here by attaching the svg map and the map js that was converted through Mapael. map.zip

ravivermas commented 6 years ago

Please reply it as soon as possible since the project delivery timelines are too tight.

ravivermas commented 6 years ago

Dear @neveldo,

Any update on this?

neveldo commented 6 years ago

Hello @ravivermas ,

Unfortunatelly, I haven't not enough information on your map in order to help you, as I said :

That said, the algorithm to set for the getCoords() function depends on the projection within your map (equi-rectangular (the simpliest one to handle), mercator, etc). If you don't know the the projection used for your map, it will unfortunatelly not be feasible to write the getCoords() function for it.

We need to know which projection is used on your map in order to be able to find the proper algorithm to convert geo coordinates into x,y on the map. DO you know it ?

ravivermas commented 6 years ago

Dear @neveldo ,

Thanks for the reply. Yes, there is a problem with the projection. I am sharing with you the whole zip having files for the projection. Can you please look in to it and help me?

Thanks, Ravi map.zip

neveldo commented 6 years ago

Hello @ravivermas ,

Thanks for the package but by "projection", I mean the kind of projection used to build the SVG source map, ie : https://en.wikipedia.org/wiki/Map_projection - depending on the projection used, the map will look differently. So the SVG that you have used to build your mapael map use a specific projection (for instance : equi-rectangular, Lambert, Mercator, etc ...) that we need to know in order to use the proper algorithm for translating latitude,longitude to SVG coordinates.

ravivermas commented 6 years ago

Dear @neveldo,

Thanks for the clarification. The projection that I am using is "equi-rectangular'.

neveldo commented 6 years ago

Ok, so this is the simplest projection to work with, and I have documented the steps to generate the getCoords() function for it here : https://www.vincentbroute.fr/mapael/create-map.php#getcoords .

In order to get the coordinates of the four extreme points of your map needed to feed the algorithm parameters, you can load your map (that need to be reachable through an url) in this tool : https://www.vincentbroute.fr/mapael/try.html (use the option 'Spot a point on click'). As described in the tutorial, the matching latitude and longitude for these four points can be retrieved on google maps for instance. Then, you just have to feed this form in order to genenrate the getCoords() function : https://www.vincentbroute.fr/mapael/getcoords.php .

I hope it will help you, feel free to ask if you are stuck to a particular step.

ravivermas commented 6 years ago

Thanks @neveldo, I had gone through with the steps shared but no success. Will it be possible for you to share the get coordinates using the map shared by me?

neveldo commented 6 years ago

Hello @ravivermas ,

I would be glad to help you if you tell me exactly at which step are you stuck.