[OSM-newbies] Squashed Display (Not JOSM)
"Iván Sánchez Ortega"
ivan at sanchezortega.es
Fri Aug 9 06:43:36 UTC 2013
El Vie, 9 de Agosto de 2013, 3:38, Matthew Aidekman User escribió:
> Is there some extra math I'm supposed to employ to display lon/lat
> coordinates beyond just scaling them to the dimensions of the display?
You can do it the quick&dirty way, or the right way.
The quick&dirty way is multiplying every vertical coordinate by the cosine
of the latitude (as measured in whatever point of the viewport's
vicinity). It won't work on large areas, but it's not a lot of math.
The right way is leveraging a projection library, such as proj4
(http://trac.osgeo.org/proj/). Everyone loves proj4: the majority GIS
software out there uses it to do the math underneath. e.g. if you're using
PostGIS to store the data, or Mapnik to render it, you're using proj4 to
do the math.
So you grab your data, you tell the library it's on EPSG:4326 projection,
ask for the data back in EPSG:3857, and bam! everything looks square.
And, as other people have already said, take a crash course on map
projections. I heartily recommend you start your quest at
https://en.wikipedia.org/wiki/Map_projection
Cheers,
--
Iván Sánchez Ortega <ivan at sanchezortega.es>
Un ordenador no es un televisor ni un microondas, es una herramienta
compleja.
More information about the newbies
mailing list