[OSM-newbies] Squashed Display (Not JOSM)

Matthew Aidekman User matthewaudio at gmail.com
Sat Aug 10 03:04:16 UTC 2013


Ivan,  I gave your quick and dirty way a shot,  (the scope of my project is very small so quick and dirty might work)  but I must be doing something wrong.  Currently my display is squashed vertically and if I'm interpreting your suggestion correctly, it only has the capability of vertically squashing the image even more.  

You're suggesting something like this?

quickProjection(x y,centerOfDisplayY){
    return [x   ,   y*cos(vertCenterOfDisplay/180*pi)   ];
}

Multiplying anything*cos(anything) will only squash the results.  

What an I missing?  

Thanks for your help,
-matt


I made that with my thumbs!

On Aug 9, 2013, at 2:43 AM, "Iván Sánchez Ortega" <ivan at sanchezortega.es> wrote:

> 
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/newbies/attachments/20130809/cdf04b05/attachment.html>


More information about the newbies mailing list