Changeset 12473 in genesis
- Timestamp:
- Oct 17, 2013, 9:11:57 PM (11 years ago)
- Location:
- tools
- Files:
-
- 1 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/gformat.py
r12441 r12473 24 24 # WSGIScriptAlias /hello /var/www/cgi-bin/genesis/tools/gformat.py 25 25 # 26 # Package dependencies list: 27 # yum install python-yaml pyproj proj-epsg python-jinja2 26 28 # 27 29 # Rick van der Zwet <info@rickvanderzwet.nl> … … 42 44 import math 43 45 import random 44 import rdnap45 46 import re 46 47 import socket … … 49 50 import time 50 51 import urlparse 52 import pyproj 51 53 52 54 from pprint import pprint … … 145 147 return DHCP_SERVER 146 148 147 149 def etrs2rd(lat, lon): 150 p1 = pyproj.Proj(proj='latlon',datum='WGS84') 151 p2 = pyproj.Proj(init='EPSG:28992') 152 RDx, RDy = pyproj.transform(p1,p2,lon, lat) 153 return (RDx, RDy) 154 155 def rd2etrs(RDx, RDy): 156 p1 = pyproj.Proj(init='EPSG:28992') 157 p2 = pyproj.Proj(proj='latlon',datum='WGS84') 158 lon, lat = pyproj.transform(p1,p2, RDx, RDy) 159 return (lat, lon) 148 160 149 161 def get_yaml(item,add_version_info=True): … … 1826 1838 1827 1839 if datadump['rdnap_x'] and datadump['rdnap_y']: 1828 datadump['latitude'], datadump['longitude'] = rdnap.rd2etrs(datadump['rdnap_x'], datadump['rdnap_y'])1840 datadump['latitude'], datadump['longitude'] = map(lambda x: "%.5f" % x, rd2etrs(datadump['rdnap_x'], datadump['rdnap_y'])) 1829 1841 elif datadump['latitude'] and datadump['longitude']: 1830 datadump['rdnap_x'], datadump['rdnap_y'] = rdnap.etrs2rd(datadump['latitude'], datadump['longitude'])1842 datadump['rdnap_x'], datadump['rdnap_y'] = etrs2rd(datadump['latitude'], datadump['longitude']) 1831 1843 1832 1844 if datadump['nodename'].startswith('Proxy'):
Note:
See TracChangeset
for help on using the changeset viewer.