Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 17th, 2007, 1:00 PM   #1
hardc0d3r
Newbie
 
Join Date: Oct 2007
Posts: 1
Rep Power: 0 hardc0d3r is on a distinguished road
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!!!
hardc0d3r is offline   Reply With Quote
Old Oct 17th, 2007, 9:32 PM   #2
andro
Professional Programmer
 
Join Date: Oct 2005
Location: California
Posts: 290
Rep Power: 3 andro is on a distinguished road
Send a message via AIM to andro
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/
andro is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:49 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC