Skip to content

Instantly share code, notes, and snippets.

@mbainrot
Created July 5, 2015 12:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbainrot/3ccbb6de15905e4c469f to your computer and use it in GitHub Desktop.
Save mbainrot/3ccbb6de15905e4c469f to your computer and use it in GitHub Desktop.
ACT Coordiniate System Info
EPSG Code - EPSG::5825
Name - AGD66 / ACT Standard Grid
Conversion: http://epsg.io/5825
proj4: +proj=tmerc +lat_0=-35.31773627777778 +lon_0=149.0092948305555 +k=1.000086 +x_0=200000 +y_0=600000 +ellps=aust_SA +towgs84=-117.808,-51.536,137.784,0.303,0.446,0.234,-0.29 +units=m +no_defs
WKT: PROJCS["AGD66 / ACT Standard Grid",GEOGCS["AGD66",DATUM["Australian_Geodetic_Datum_1966",SPHEROID["Australian National Spheroid",6378160,298.25,AUTHORITY["EPSG","7003"]],TOWGS84[-117.808,-51.536,137.784,0.303,0.446,0.234,-0.29],AUTHORITY["EPSG","6202"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4202"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",-35.31773627777778],PARAMETER["central_meridian",149.0092948305555],PARAMETER["scale_factor",1.000086],PARAMETER["false_easting",200000],PARAMETER["false_northing",600000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","5825"]]
import urllib
import json
import osr
import ogr
# Setup for coord system transform
# I <3 you http://gis.stackexchange.com/questions/78838/how-to-convert-projected-coordinates-to-lat-lon-using-python
inputEPSG = 5825
outputEPSG = 4326
inSpatialRef = osr.SpatialReference()
inSpatialRef.ImportFromWkt('PROJCS["AGD66 / ACT Standard Grid",GEOGCS["AGD66",DATUM["Australian_Geodetic_Datum_1966",SPHEROID["Australian National Spheroid",6378160,298.25,AUTHORITY["EPSG","7003"]],TOWGS84[-117.808,-51.536,137.784,0.303,0.446,0.234,-0.29],AUTHORITY["EPSG","6202"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4202"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",-35.31773627777778],PARAMETER["central_meridian",149.0092948305555],PARAMETER["scale_factor",1.000086],PARAMETER["false_easting",200000],PARAMETER["false_northing",600000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","5825"]]')
outSpatialRef = osr.SpatialReference()
outSpatialRef.ImportFromEPSG(outputEPSG)
coordTransform = osr.CoordinateTransformation(inSpatialRef, outSpatialRef)
# Now take our data.gov.au data (and its delicious AGD66/ACT coords) and convert it to WGS84 coord system
url = 'http://data.gov.au/api/action/datastore_search?resource_id=16fc7944-d81e-43af-baa8-3f90fe60584a'
response = urllib.urlopen(url)
data = json.loads(response.read())
data_len = len(data["result"]["records"])
for i in range(0, data_len):
row = data["result"]["records"][i]
x = int(row["TOLT_X_POS"])
y = int(row["TOLT_Y_POS"])
point = ogr.Geometry(ogr.wkbPoint)
point.AddPoint(x, y)
void = point.Transform(coordTransform)
print "%f %f" % (point.GetY(),point.GetX())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment