Created
February 23, 2018 14:44
-
-
Save kirkmawa/fc25592e094bfcf490b3e88a1e6b5140 to your computer and use it in GitHub Desktop.
CGI script to convert lat/long to cartesian coordinates for the Lambert Conformal Conic projection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# This file gets raw cartesian coordinates for the Lambert Conformal Conic projection given a latitude/longitude pair. | |
# It is used to cross reference a user's location with an ESRI shapefile database. | |
import os | |
from urlparse import parse_qs | |
print "Content-type: text/html\n\n" | |
from pyproj import Proj | |
p = Proj(proj='lcc',ellps='WGS84') | |
qs = parse_qs(os.environ['QUERY_STRING']) | |
cdt = p(qs['lon'][0], qs['lat'][0]) | |
print '{0},{1}'.format(cdt[0], cdt[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment