Skip to content

Instantly share code, notes, and snippets.

@dnomadb
Created December 19, 2014 18:58
Show Gist options
  • Save dnomadb/0a64def8a792ab3e427f to your computer and use it in GitHub Desktop.
Save dnomadb/0a64def8a792ab3e427f to your computer and use it in GitHub Desktop.
from rasterio import coords
from pyproj import Proj, transform
## bbox from input
bbox = coords.BoundingBox(left=-2699073.2235329347,
bottom=-1588806.0694413616,
right=2697926.7764670653,
top=1588193.9305586384)
## custom crs
inCRS = {
u'a': 6371229,
u'lon_0': 262.5,
u'no_defs': True,
u'y_0': 0,
u'b': 6371229,
u'proj': u'lcc', u'x_0': 0,
u'units': u'm',
u'lat_2': 38.5,
u'lat_1': 38.5,
u'lat_0': 38.5
}
frProj = Proj(inCRS)
toProj = Proj(init='epsg:4326')
#get lower left coord in WGS84
x1, y1 = frProj(bbox.left, bbox.bottom)
projected = transform(frProj, toProj, x1, y1)
# def not printing the correct coords
print projected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment