Changeset 8293 in genesis


Ignore:
Timestamp:
Aug 10, 2010, 1:27:13 PM (14 years ago)
Author:
rick
Message:

Fixed CNodeRick coordinates using make-map new function

Location:
nodes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • nodes/CNodeRick/wleiden.conf

    r8289 r8293  
    88$status='up';
    99
    10 
    1110# edugis x,y
    12 $X='92434';
    13 $Y='461987';
     11$X='92280';
     12$Y='461707';
    1413
    1514$config{'vr0'}=sprintf <<SIS0;
  • nodes/make-map.py

    r8285 r8293  
    1111import urllib
    1212import yaml
     13import math
    1314
    1415def get_yaml(gfile):
     
    2728coordinates = None
    2829
     30def etrs2rd(lam, phi):
     31  """ Convert rd to etrs """
     32 
     33  item = dict()
     34  (remainder, item['lam_deg']) = math.modf(lam)
     35  remainder *= 60
     36  (remainder, item['lam_min']) = math.modf(remainder)
     37  item['lam_sec'] = remainder * 60
     38
     39  (remainder, item['phi_deg']) = math.modf(phi)
     40  remainder *= 60
     41  (remainder, item['phi_min']) = math.modf(remainder)
     42  item['phi_sec'] = remainder * 60
     43
     44  item['func'] = 'etrs2rd'
     45
     46  args = "&".join(["%s=%s" % (k,v) for k,v in item.iteritems()])
     47  url = 'http://www.rdnap.nl/cgi-bin/rdetrs.pl?%s' % args
     48  print "### Fetching coordinate %s, %s using: %s" % (phi, lam, url)
     49  f = urllib.urlopen(url)
     50  raw = f.read()
     51 
     52  r = re.compile('name="([a-z_]+)" value="([0-9\.]+)"')
     53  for i in r.finditer(raw):
     54    name, value = i.group(1,2)
     55    value = float(value)
     56    item[name] = value
     57  return (item['xrd'], item['yrd'])
     58
     59
    2960def rd2etrs(xrd, yrd, hnap=0.0):
    3061  """ Convert rd to etrs """
    3162  global coordinates
     63  xrd = float(str(xrd))
     64  yrd = float(str(yrd))
    3265  if coordinates == None:
    3366    try:
     
    4376  item['yrd'] = yrd
    4477  item['hnap'] = hnap
    45   f = urllib.urlopen('http://www.rdnap.nl/cgi-bin/rdetrs.pl?func=rd2etrs&xrd=%(xrd)s&yrd=%(yrd)s&hnap=%(hnap)s' % item)
     78  item['func'] = 'rd2etrs'
     79  args = "&".join(["%s=%s" % (k,v) for k,v in item.iteritems()])
     80  url = 'http://www.rdnap.nl/cgi-bin/rdetrs.pl?%s' % args
     81  print "### Fetching coordinate %s, %s from %s" % (xrd, yrd, url)
     82  f = urllib.urlopen(url)
    4683  raw = f.read()
    4784 
     
    5491  lam = item['lam_deg'] + (item['lam_min'] + (item['lam_sec'] / 60)) / 60
    5592  phi = item['phi_deg'] + (item['phi_min'] + (item['phi_sec'] / 60)) / 60
    56   coordinates[(xrd, yrd)] = (phi, lam)
     93  coordinates[(xrd, yrd)] = (lam, phi)
    5794  write_yaml(CACHE_FILE, coordinates)
    5895  return (lam, phi)
Note: See TracChangeset for help on using the changeset viewer.