New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how get proper coordinates to new map #11
Comments
Hello mancho-ged, In order to be able to locate plots on your map, you have to fill the getCoords() function with the proper algorithm. The algorithm depends on the projection of your map (mercator, miller, ...). More on projections : http://en.wikipedia.org/wiki/Map_projection . The simpliest projection is the equi-rectangular one (http://en.wikipedia.org/wiki/Equirectangular_projection) where you can easily compute x and y coordinates from latitude and longitude : x = ax long + bx Do you know what is the projection of your map ? |
No, I don't know. I've got this svg from wikimedia. But Georgia is small country, about half of France. How can I put the coordinates on my map? I don't need to be very accurate, I only want it to work somehow. Where can I get this xoffset and xfactor? what are they? Sorry if I'm asking stupid questions, I am not strong in geography at all. |
I saw this map of Georgia on wikimedia commons that is based on an equi-rectangular projection : http://commons.wikimedia.org/wiki/File:Georgia_location_map.svg. You have to calculate ax (x factor), bx (x offset), ay (y factor) and by (y offset) in order to be able to convert lat,long to x,y. Here is the method that I've used for the map of France : For ax and bx : you position two plots on your map by using x and y parameters : one at the most east, and the other at the most west. Then, you get the corresponding longitude for these two plots by using Google Maps. Now, you have two points where x and corresponding longitude are known. In order to calculate ax and bx from these values, you just have to solve a simple equation with two unknowns (you can use a tool to resolve the equation : http://ncalculators.com/algebra/2-variable-equation-solver.htm) Then, you have to do exactly the same thing for ay and by. FYI, map of France uses the equi-rectangular projection (with ax, bx, ay and by specifics to the map). |
Hi neveldo, I'm trying to understand how to do this for a map of germany (equi-rectangular projection) and I don't really get what I have to do at my getCoords function =/ |
neveldo could you provide an example for the calculation of france? |
Hello cefuroX, The if statement is here for the 'Corse' region. This island is closer to France on the map than in the real world. That why there are specific ax (x factor), bx (x offset), ay (y factor) and by (y offset) for this region. Here is an example to compute ax and bx for the map of France with an equi-rectangular projection : You have to take a point at the most west of the country on google map in order to retrieve the longitude : https://maps.google.fr/maps?q=48.037692,-4.729042&hl=fr&ll=46.935261,0.834961&spn=8.656949,21.643066&num=1&t=m&z=6 . Do the same to get the longitude of a point at the most east of the country : https://maps.google.fr/maps?q=48.967597,8.222809&hl=fr&ll=46.392411,3.010254&spn=8.74399,21.643066&num=1&t=m&z=6 . Then, with mapael, you have to position manually a small point on the map with x and y parameters in order to find the matching x coordinates. You should now be in front of an equation with two unknowns (this is not real values for the x) : 2 = ax * -4.729042 + bx ax and bx are now easy to find with a tool like http://ncalculators.com/algebra/2-variable-equation-solver.htm. Then, you have to do exactly the same for latitude (y axis). I hope this will help you ! |
just in case to get it right, for y axis it will be: Y1 = ay * lat1 + by Am I right? |
That's it ! For the y axis, you will have to take two points at the most north and at the most south of the map. |
Thx! Now it works! ;) I am a little bit brain dead today xD but thx for the help. |
You are welcome :) Feel free to contribute by adding your new map in the dedicated repository when you are done : https://github.com/neveldo/mapael-maps |
Hi neveldo you give an example I do not how to get x1, x2, y1, y2. |
Hi, 2 is the x coordinate of a point at the most west of the map from mapael and that matches with the longitude -4.729042. When you have an equation like : 2 = ax * -4.729042 + bx You can easily resolve it with a small tool like : http://ncalculators.com/algebra/2-variable-equation-solver.htm This is the way to get ax and bx in order to translate a longitude to a x coordinate. You have to do the same in order to get ay and by to translate a latitude to an y coordinate. Be carefull, it will only works for maps with an equi-rectangular projection. |
Thanks for your prompt reply. |
Com todas as explicações, ainda estou com dúvidas. Talvez por não dominar a língua inglesa. O mapa é esse: https://goo.gl/maps/WHHGn |
Hello, Sorry, I don't speak portuguese, but here is a complete tutorial to create your own map for Mapael : http://www.vincentbroute.fr/mapael/create-map.php . I hope it will help you ! |
Can anyone help me generate the coordinates with the data below? (SVG) (CustomMAP.js) |
Hello, I think there is an error with the width and height attributes of your map. The width should be close to 800 and the height should be close to 1225. Ensure that you have ungrouped all SVG objects through Inskcape (you shouldn't not have any element in the XML editor), then go to the document properties, and click on "resize page to drawing". Regarding the getCoords() function, the latitudes and longitudes you've picked up on Google Maps seems to be right. Then , you just have to do the same thing on your mapael map. You can position points by x and y on your map. You have to find the x coordinates that match the west and east longitudes you have picked up, and do the same for the north and south latitudes.
Then, you just have to fill this form in order to get the getCoords() function content : http://www.vincentbroute.fr/mapael/getcoords.php . It just resolves the equations with two unknowns. |
All right. Thank you very much. |
All issue seems to be resolved. This thread will be closed. Feel free to open a new issue if you have any problem. Thanks! |
I am trying to make map of custom country (Tbilisi, georgia) with mapael. Everything is ok, but the plots. I cannot coordinate them properly with latitude and languitude. How can I do this? I tryed to do according to usa map but it don't work :( where and what I should put?
saqartvelos_regionebi : {
width : 844.8,
height : 469.2,
latLngToGrid: function(lat, lng, phi1, phi2, midLng, scale) {
var pi =Math.PI
, midLat = (phi1 + phi2) / 2
, n, tmp1, tmp2, tmp3, x, y, p;
The text was updated successfully, but these errors were encountered: