mardi 24 mars 2015

Bulk Converting Ordnance Survey to Google Map lat lng


Apologies if this is a simplistic question, I am learning!


I am attempting to use pyproj with Python.


The coordinates I wish to convert came from the Ordnance Survey Integrated Transport Layer.


I created a csv with the coordinates I wish to convert.


I found from here (1) that the Ordnance Survey system is epsg:27700. I found from here (2) that Google Maps uses epsg:3857


Thus, reading the csv of Ordnance survey coordinates, I tried this -



import csv
from pprint import pprint
from pyproj import Proj, transform

with open('./OScoords.csv', 'rU') as csvfile:
reader = csv.DictReader(csvfile)
lats = ['{Y}'.format(**row) for row in reader]
with open('./OScoords.csv', 'rU') as csvfile:
reader = csv.DictReader(csvfile)
lngs = ['{X}'.format(**row) for row in reader]

inProj = Proj(init='epsg:27700')
outProj = Proj(init='epsg:3857')

for lat, lng in zip(lats, lngs):
lat_1,lng_1 = lat, lng
lat_2, lng_2 = transform(inProj, outProj, lat_1, lng_1)
print(lat_2, lng_2)


However, as an example. Converting


(195333.973,508180.748)


gives


(-574037.831624532, 7251584.715074988)


This is not what I would expect and is not findable on google maps. Can anyone advise on what I may be doing wrong?


(1)- http://ift.tt/1FmkHLg (2)- EPSG 3857 or 4326 for GoogleMaps, OpenStreetMap and Leaflet





Aucun commentaire:

Enregistrer un commentaire