Gprojector turn azimuth map to equirectangular
Thus navigators may derive their course from the angle the straight course line As well as being conformal, it has the particular property that straight lines drawn on it are It is little used for land mapping purposes but is in almost universal use for All other parallels of latitude are straight lines and the meridiansĪre also straight lines at right angles to the equator, equally spaced. The equator as the single standard parallel. The Mercator map projection is a special limiting case of the Lambert Conic Conformal map projection with However when I try a different latitude value ex: 58.07 (just north of the UK) it displays as north of Spain.
#Gprojector turn azimuth map to equirectangular code#
When using the original code if the latitude value is positive it returned a negative point, so I modified it slightly and tested with the extreme latitudes-which should be point 0 and point 766, it works fine. Y = mapHeight - ((worldMapWidth / 2 * Math.log((1 + Math.sin(lat)) / (1 - Math.sin(lat)))) - mapOffsetY) int mapWidth = 991 ĭouble mapLonDelta = mapLonRight - mapLonLeft ĭouble mapLatBottomDegree = mapLatBottom * Math.PI / 180 ĭouble worldMapWidth = ((mapWidth / mapLonDelta) * 360) / (2 * Math.PI) ĭouble mapOffsetY = (worldMapWidth / 2 * Math.log((1 + Math.sin(mapLatBottomDegree)) / (1 - Math.sin(mapLatBottomDegree)))) ĭouble x = (lon - mapLonLeft) * (mapWidth / mapLonDelta) I've tried to use the code provided but I'm still having some problems with latitude conversion, longitude is fine. The latitude seems to be off by about 30px in the example I'm trying.
Determine the map scale (points per degree)ĭouble xScale = mapWidth/ (maxLong - minLong) ĭouble yScale = mapHeight / (maxLat - minLat) I've tried this piece of code: double minLat = -85.05112878 I need the formula to take into account the image size, width etc. I've seen various ways of doing this and a few questions on stack overflow-I've tried out the different code snippets and although I get the correct longitude to pixel, the latitude is always off-seems to be getting more reasonable though. I'm trying to convert a lat/long point into a 2d point so that I can display it on an image of the world-which is a mercator projection.