Changeset 10373 in genesis for tools


Ignore:
Timestamp:
Apr 7, 2012, 11:25:44 AM (13 years ago)
Author:
rick
Message:

Latitude and Longitude got shuffled around.

Related-To: beheer#167

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/rdnap.py

    r10058 r10373  
    11#
    2 # REMEMBER
     2# !!!REMEMBER!!!
    33# latitude  : phi
    44# longitude : lam
     
    3333    pass
    3434
    35 def etrs2rd(lam, phi):
    36   """ Convert etrs to rd """
     35def etrs2rd(phi, lam):
     36  """ Convert etrs to rd coordinates
     37  @Return: (X,Y)
     38  """
    3739 
     40  item['phi'] = phi
    3841  item['lam'] = lam
    39   item['phi'] = phi
    4042  item['func'] = 'etrs2rd'
    41   url = 'http://vanderzwet.net/rdnap/%(func)s/%(xrd)s/%(yrd)s/0/' % item
     43  url = 'http://vanderzwet.net/rdnap/%(func)s/%(phi)s/%(lam)s/0/' % item
    4244
    4345  f = urllib.urlopen(url)
     
    5153def rd2etrs(xrd, yrd, hnap=0.0):
    5254  """
    53   Convert rd to etrs 
     55  Convert rd to etrs
    5456  JavaScript Version: https://rdinfo.kadaster.nl/rd/transformator.html
     57  @Return: (latitude,longitude)
    5558  """
    5659  # Get cache is exists
     
    7679  item['func'] = 'rd2etrs'
    7780  url = 'http://vanderzwet.net/rdnap/%(func)s/%(xrd)s/%(yrd)s/%(hnap)s/' % item
    78   print "### Not in Cache, Fetching coordinate %s, %s from %s" % (xrd, yrd, url) 
     81  print "### Not in Cache, Fetching coordinate %s, %s from %s" % (xrd, yrd, url)
    7982  f = urllib.urlopen(url)
    8083  raw = f.read()
    81  
    82   # Coordinates returned in 'odd' order
     84
    8385  phi,lam,h = raw.split('/')
    84   coordinates[(xrd, yrd)] = (lam, phi)
     86  coordinates[(xrd, yrd)] = (phi, lam)
    8587  write_yaml(CACHE_FILE, coordinates)
    86   return (lam, phi)
     88  return (phi, lam)
Note: See TracChangeset for help on using the changeset viewer.