Note that there are some explanatory texts on larger screens.

plurals
  1. POMercator longitude and latitude calculations to x and y on a cropped map (of the UK)
    primarykey
    data
    text
    <p>I have this image: <a href="https://imgur.com/99tSz.png" rel="noreferrer">http://imgur.com/99tSz.png</a>. A map of the UK (not including Southern Ireland).</p> <p>I have successfully managed to get a latitude and longitude and plot it onto this map by taking the leftmost longitude and rightmost longitude of the UK and using them to work out where to put the point on the map.</p> <p>This is the code (for use in Processing.js but could be used as js or anything):</p> <pre><code>// Size of the map int width = 538; int height = 811; // X and Y boundaries float westLong = -8.166667; float eastLong = 1.762833; float northLat = 58.666667; float southLat = 49.95; void drawPoint(float latitude, float longitude){ fill(#000000); x = width * ((westLong-longitude)/(westLong-eastLong)); y = (height * ((northLat-latitude)/(northLat-southLat))); console.log(x + ", " + y); ellipseMode(RADIUS); ellipse(x, y, 2, 2); } </code></pre> <p>However, I haven't been able to implement a Mercator projection on these values. The plots are reasonably accurate but they are not good enough and this projection would solve it.</p> <p>I can't figure out how to do it. All the examples I find are explaining how to do it for the whole world. <a href="http://wiki.openstreetmap.org/index.php/Mercator" rel="noreferrer">This</a> is a good resource of examples explaining how to implement the projection but I haven't been able to get it to work.</p> <p>Another resource is the <a href="http://en.wikipedia.org/wiki/Extreme_points_of_the_United_Kingdom" rel="noreferrer">Extreme points of the United Kingdom</a> where I got the latitude and longitude values of the bounding box around the UK. They are also here:</p> <pre><code>northLat = 58.666667; northLong = -3.366667; eastLat = 52.481167; eastLong = 1.762833; southLat = 49.95; southLong = -5.2; westLat = 54.45; westLong = -8.166667; </code></pre> <p>If anyone could help me with this, I would greatly appreciate it!</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload