You Are Here:

Community: Developer Discussion Boards

#1 Old converting latitude and longitude into x y - 2008-05-19, 15:04

Join Date: May 2008
Posts: 53
oyuky
Offline
Regular Contributor
hello, i would like to know if there is a way of converting latitude and longitude data (from internal gps from n95) into x and y values that can fit on my canvas size. I would like to make a python game that can use my movement in the city to control an avatar . Is there any formula for suck a task?


any hint would be aprreciated.

oyuky.
Reply With Quote

#2 Old Re: converting latitude and longitude into x y - 2008-05-19, 15:08

Join Date: May 2007
Posts: 2,738
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
Quote:
Originally Posted by oyuky View Post
hello, i would like to know if there is a way of converting latitude and longitude data (from internal gps from n95) into x and y values that can fit on my canvas size. I would like to make a python game that can use my movement in the city to control an avatar . Is there any formula for suck a task?


any hint would be aprreciated.

oyuky.
Hi oyuky,

You can have your own formula, but 1st you need to find out the relationship between the Latitude and Longitude values and the X & Y coordinates on the CANVAS. This has its applications in Location based Services (LBS) that make use of maps.
If Someone is working on a similar project, he might be able to help you; otherwise you need to do some testing and on the basis of that devise an formula or algorithm that works.

Best Regards,
Croozeus
Reply With Quote

#3 Old Re: converting latitude and longitude into x y - 2008-05-19, 15:27

Join Date: Mar 2008
Posts: 127
jtullis
Offline
Regular Contributor
Check out Nick Burch's excellent site on lat/long conversions, getting internal gps position etc. His code is here http://gagravarr.org/code/
Reply With Quote

#4 Old Re: converting latitude and longitude into x y - 2008-05-19, 17:02

Join Date: Dec 2007
Posts: 50
Location: Kuopio, Finland
ilpo55
Offline
Regular Contributor
Quote:
Originally Posted by jtullis View Post
Check out Nick Burch's excellent site on lat/long conversions, getting internal gps position etc. His code is here http://gagravarr.org/code/
LocationRequestor module is not mandatory.

There is some possibly useful information at:http://www.ga.gov.au/geodesy/datums/distance.jsp

Ilpo
Reply With Quote

#5 Old Re: converting latitude and longitude into x y - 2008-05-19, 21:44

Join Date: Sep 2005
Posts: 314
Location: Finland, Helsinki
aaaaapo
Offline
Regular Contributor
Quote:
Originally Posted by oyuky View Post
i would like to know if there is a way of converting latitude and longitude data (from internal gps from n95) into x and y values that can fit on my canvas size.
I'm working with a similar project. How about this:
  1. convert WGS84 coordinates (from GPS) to UTM (XY) coordinates
  2. scale UTM coordinates to fit your canvas

If lat and lon from the internal GPS are N60.2 E25.00 the corresponding UTM coordinates are 389130 (Easting) 6675364 (Northing), zone 35V. Units are meters.

So if you have 100px*100px canvas and 1 pixel is 100 meters, you should be able to show 10km*10km geographical area. If
389130 6675364 is in the middle,
389130 6674364 should be 10 pixels below.

Python library to handle LatLongUTMconversion

Some mapping guru could tell me if I'm missing something here?
Reply With Quote

#6 Old Re: converting latitude and longitude into x y - 2008-05-20, 05:53

Join Date: May 2007
Posts: 2,738
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
Quote:
Originally Posted by aaaaapo View Post
I'm working with a similar project. How about this:
  1. convert WGS84 coordinates (from GPS) to UTM (XY) coordinates
  2. scale UTM coordinates to fit your canvas

If lat and lon from the internal GPS are N60.2 E25.00 the corresponding UTM coordinates are 389130 (Easting) 6675364 (Northing), zone 35V. Units are meters.

So if you have 100px*100px canvas and 1 pixel is 100 meters, you should be able to show 10km*10km geographical area. If
389130 6675364 is in the middle,
389130 6674364 should be 10 pixels below.

Python library to handle LatLongUTMconversion

Some mapping guru could tell me if I'm missing something here?
Hi aaaaapo,

I think oyuky would be quite happy with that input of yours

Best Regards,
Croozeus
Reply With Quote

#7 Old Re: converting latitude and longitude into x y - 2008-05-20, 11:24

Join Date: May 2008
Posts: 53
oyuky
Offline
Regular Contributor
yes, thanks for the replies, that LatLongUTMconversion module is cool and works fine, i been experimenting with it, but now i have a new problem: i been trying to adapt the non blocking call of the python for s60 documentation, but instead of printing in the console im trying ti print the latitude and longitude(and the x y converted wih latlongutmconversion) in the canvas, the problem im having is when i run the script my program stays in the console window, do anybody know what is going wrong?

here is the code:



import LatLongUTMconversion
from LatLongUTMconversion import LLtoUTM, UTMtoLL
from graphics import *
import appuifw
import e32
import positioning


appuifw.app.screen='normal'
appuifw.app.title=unicode('My Test App')
canvas=appuifw.Canvas()
appuifw.app.body=canvas


positioning.select_module(positioning.default_module())

positioning.set_requestors([{"type":"service",
"format":"application",
"data":"test_app"}])

def cb(event):
e = d["position"]
canvas.clear()
canvas.text( (2,12), unicode(str(e["latitude"])))
canvas.text( (2,24), unicode(str(e["longitude"])))
l=LLtoUTM(19, e["latitude"], e["longitude"])
canvas.text( (2,34), unicode(str(l[1])))
canvas.text( (2,46), unicode(str(l[2])))
e32.ao_yield()
e32.ao_sleep(1115)


d= positioning.position(course=1,satellites=1,callback=cb, interval=500000,partial=0)
Reply With Quote

#8 Old Re: converting latitude and longitude into x y - 2008-05-20, 11:27

Join Date: May 2008
Posts: 53
oyuky
Offline
Regular Contributor
oops sorry for pasting not indented code, but when i pasted it itappeared indented before posting.
is there any special way for identing?
Reply With Quote

#9 Old Re: converting latitude and longitude into x y - 2008-05-20, 11:29

Join Date: May 2007
Posts: 2,738
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
Quote:
Originally Posted by oyuky View Post
oops sorry for pasting not indented code, but when i pasted it itappeared indented before posting.
is there any special way for identing?
You need to use the CODE tags (#) for keeping your posts to the indent.
Reply With Quote

#10 Old Re: converting latitude and longitude into x y - 2008-05-20, 15:11

Join Date: May 2008
Posts: 53
oyuky
Offline
Regular Contributor
cool, thanks
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Set Exif Gps Info Latitude. shashishaw General Symbian C++ 15 2009-03-24 17:50
Format of longitude and latitude asparov Location Based Services and Navigation 6 2008-10-09 10:54
reading latitude and longitude from EXIF header Larry101 Mobile Java General 0 2008-03-14 11:45
JSR 179 -Getting Longitude Latitude Values of Current Location satyarajasekhar Location Based Services and Navigation 6 2007-12-31 13:55
9210 City latitude and longitude nickct Symbian Tools & SDKs 1 2002-08-16 11:38

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia