Reprojection
While reprojection is less common these days, because of more advanced methods of data distribution, sometimes you need to reproject a shapefile. The pure Python utm module works for reference system conversion, but for a full reprojection we need some help from the OGR Python API.
As an example we'll use a point shapefile containing museum and gallery locations in the Lambert conformal projection. We'll reproject it to WGS84 geographic (or unproject it rather). You can download this zipped shapefile at:
https://geospatialpython.googlecode.com/files/NYC_MUSEUMS_LAMBERT.zip
The following minimalist script reprojects the shapefile. The geometry is transformed and then written to the new file, but the dbf file is simply copied to the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access