![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Oct 2007
Posts: 1
Rep Power: 0
![]() |
help mapping latitude, longitude in svg
this is a general programming question but i'm using java so i'm posting it here...
i am trying to map geographical coordinates in a plane. given are 2 geographical points (latitude longitude), the width and height of the svg in pixels and a third geographical point. given the values, i would like to know what will be the coordinates of the third geographical point in the svg... i am having trouble finding a right formula for this one.. what i did is i subtract lat1 from lat2 and given the difference, i divided it with the width of the svg file. i am thinking that this will give me n decimal per pixel... to be able to map the third geographical point in the svg, i subtracted lat1 from the latitude of the third point and divided it with the n decimal per pixel... i think that my math is right but apparently it's not.. please correct me because the coordinates is way off.. thanks..![]() please help me!!! |
|
|
|
|
|
#2 |
|
Professional Programmer
|
Re: help mapping latitude, longitude in svg
OK, based on that drawing, I've come up with this.
latRatio = newLat/(lat2-lat1) longRatio = newLong/(long1-long2) This is specialized to those particular coordinates, but you can look at it like this.... If you used the first 2 coordinates to form a rectangle, then it would be: latRatio = newLat/recWidth longRatio = newLong/recHeight Basically, just finding a ratio of how far in the 3rd point is in the x direction, how far in the y direction. Then apply it to the SVG dimensions to find the coordinates. newCoordX = latRatio * svgWidth newCoordY = longRatio * svgHeight
__________________
http://www.kevinherron.com/ |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need help with mapping | metsfan | Other Web Development Languages | 1 | Nov 14th, 2006 6:34 PM |
| need help with texture mapping (C and openGL) :( | Johnny Redburn | C | 2 | Jun 3rd, 2006 6:55 PM |
| File Mapping in Visual Basic? | bmad6 | Visual Basic .NET | 4 | May 16th, 2006 9:37 PM |