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

top (lat>85) and left (lon<-175) not visible #308

Closed hummingbird-dev closed 7 years ago

hummingbird-dev commented 7 years ago

Thanks for that great plugin. I started to play around with Mapael and found that points plotted far left (approx. <-175) and at the top (approx. >85) are not visible (see figure, where less than the half of the large points is visible). Sure, I can change the viewBox of the svg like $(".map_container").find("svg").attr("viewBox", "-40 -30 1030 530"); which will solve this problem. But this introduces new problems, e.g. with the zoom. Thus I would like to ask if it is possible to have a full view of the map from -180 to 180 and -90 to 90? Thanks. mapael_boundary_test

neveldo commented 7 years ago

Hi @hummingbird-dev ,

You pointed out an interesting issue. For now, the only answer I have should be to modifiy the original map in order to add these margins, ie :

1 / Transform the JS map to SVG map (through the mapael to SVG convertor : https://www.vincentbroute.fr/mapael/svg-to-mapael.php ) 2 / With inkscape, add the margins all around the map 3 / Transform the SVG map back to a JS map : https://www.vincentbroute.fr/mapael/mapael-to-svg.php 4 / Adjust the getCoords() function to take into account the new top and left offsets.

I know this is not a trivial solution, but it should do the work, I'm still seeking for a better one, but feel free to contribute if you get it !

hummingbird-dev commented 7 years ago

Hi, Thanks for the answer. I will try your solution and let you know if it worked.

Indigo744 commented 7 years ago

@hummingbird-dev did you manage to do it? Or do you need more help?

hummingbird-dev commented 7 years ago

Unfortunately I was not able to try it yet, I'm quite busy at the moment with some other stuff. However, as soon as will find time I will try it and let you know.

Indigo744 commented 7 years ago

Can you explain me the need for such a thing? Do you want to plot something at the map limit?

hummingbird-dev commented 7 years ago

Yes, I'm using the jQuery-Mapael maps to plot scientific data taken during ship expeditions on the global oceans. This includes the Arctic, Antarctica as well as regions near the International Date Line.

Indigo744 commented 7 years ago

Alright. So maybe you should use a world map with Antarctica shown? Like this one or this one would be better.

Mercator projection should obviously be avoided, as it has issue with poles...

Indigo744 commented 7 years ago

If I can find some time today, I'll try to import one of these map into Mapael.

hummingbird-dev commented 7 years ago

Thanks a lot, that would be great. However, I think the "world_countries" map, I'm using, is not a Mercator projection. It looks rather like the equirectangular projection you sent in the first link. Anyway, an equirectangular projection from -180 to 180 and -90 to 90 would be perfect. Thanks again.

Indigo744 commented 7 years ago

See the PR neveldo/mapael-maps/pull/43

hummingbird-dev commented 7 years ago

Wow, thank you very much.

Indigo744 commented 7 years ago

Thank you :) hope this helps

hummingbird-dev commented 7 years ago

I've implemented the new map and it works like a charme (see figure). image

Indigo744 commented 7 years ago

Well, I don't quite understand what I'm seeing but I'm glad it helps you ;-)

Indigo744 commented 7 years ago

@hummingbird-dev for your information, the map world_countries_with_antarctica.js was renamed to world_countries_with_antarctica_full_long_and_lat.js (see PR neveldo/mapael-maps#44)

hummingbird-dev commented 7 years ago

Thanks.