×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Regular Contributor
    Join Date
    May 2008
    Posts
    53

    converting latitude and longitude into x y

    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.

  2. #2
    Wiki Moderators
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,779

    Re: converting latitude and longitude into x y

    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
    Pankaj Nathani
    www.croozeus.com

  3. #3
    Regular Contributor
    Join Date
    Mar 2008
    Posts
    151

    Re: converting latitude and longitude into x y

    Check out Nick Burch's excellent site on lat/long conversions, getting internal gps position etc. His code is here http://gagravarr.org/code/

  4. #4
    Regular Contributor
    Join Date
    Dec 2007
    Location
    Kuopio, Finland
    Posts
    50

    Re: converting latitude and longitude into x y

    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

  5. #5
    Regular Contributor
    Join Date
    Sep 2005
    Location
    Finland, Helsinki
    Posts
    323

    Re: converting latitude and longitude into x y

    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?

  6. #6
    Wiki Moderators
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,779

    Re: converting latitude and longitude into x y

    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
    Pankaj Nathani
    www.croozeus.com

  7. #7
    Regular Contributor
    Join Date
    May 2008
    Posts
    53

    Re: converting latitude and longitude into x y

    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)

  8. #8
    Regular Contributor
    Join Date
    May 2008
    Posts
    53

    Re: converting latitude and longitude into x y

    oops sorry for pasting not indented code, but when i pasted it itappeared indented before posting.
    is there any special way for identing?

  9. #9
    Wiki Moderators
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,779

    Re: converting latitude and longitude into x y

    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.
    Pankaj Nathani
    www.croozeus.com

  10. #10
    Regular Contributor
    Join Date
    May 2008
    Posts
    53

    Re: converting latitude and longitude into x y

    cool, thanks

Similar Threads

  1. Set Exif Gps Info Latitude.
    By shashishaw in forum Symbian
    Replies: 15
    Last Post: 2009-03-24, 16:50
  2. reading latitude and longitude from EXIF header
    By Larry101 in forum Mobile Java General
    Replies: 0
    Last Post: 2008-03-14, 10:45
  3. 9210 City latitude and longitude
    By nickct in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2002-08-16, 10:38

Posting Permissions

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