Skip to content

Instantly share code, notes, and snippets.

@fscottfoti
Created July 13, 2015 20:46
Show Gist options
  • Save fscottfoti/ddc7c7ad3b0f6c337ac5 to your computer and use it in GitHub Desktop.
Save fscottfoti/ddc7c7ad3b0f6c337ac5 to your computer and use it in GitHub Desktop.
Change CRS of Pandana network
import pyproj
import pandas as pd
s = pd.HDFStore('osm_bayarea.h5', "r")
s2 = pd.HDFStore('osm_bayarea4326.h5', "w")
s2["edges"] = s["edges"]
po = s["nodes"]
print po.describe()
x_name = "x"
y_name = "y"
p1 = pyproj.Proj('+init=epsg:%d' % 3740)
p2 = pyproj.Proj('+init=epsg:%d' % 4326)
x2, y2 = pyproj.transform(p1, p2,
po[x_name].values,
po[y_name].values)
po[x_name], po[y_name] = x2, y2
print po.describe()
s2["nodes"] = po
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment