Thursday, 19 January 2017

coordinate system - Converting Lambert Conformal Conic to WGS84 using Proj.4


I am attempting to transform data from Lambert Conformal Conic lat/long and I am having some issues with the results.


The shapefile I am attemtping to transform can be found here: http://tfr.faa.gov/save_pages/0_8326.shp.zip


Since I am using proj.4 I used GDAL/srs to convert the WKT to a proj.4 init string. In order to do that I had to change the WKT projection from "Lambert_Conformal_Conic" to "Lambert_Conformal_Conic_SP2".


The WKT I used:


PROJCS["North_America_Lambert_Conformal_Conic",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic_SP2"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-77.03638889],PARAMETER["Standard_Parallel_1",38.69259533705237],PARAMETER["Standard_Parallel_2",39.02625053604863],PARAMETER["Latitude_Of_Origin",40.0],UNIT["Meter",1.0]]


The resulting proj.4 string from the WKT:


"+proj=lcc +lat_1=38.69259533705237 +lat_2=39.02625053604863 +lat_0=40 +lon_0=-77.03638889 +x_0=0 +y_0=0 +ellps=GRS80 +units=m +no_defs"

The proj.4 string I use for WGS84 lat/long:


"+proj=longlat +ellps=WGS84 +no_defs"

When I get a Lambert Conformal Conic point from the shapefile, I transform it to Lat/Long using this line of code:


pj_transform(pj_lcc, pj_latlong, 1, 1, &fX, &fY, NULL );

Where pj_lcc is my Lambert Conformal Conic projection info, pj_latlong is my WGS84 lat/long projection info and fX, fY are the Lambert Conformal Conic point.



An example result from the above transform is:


lcc point: {4842.47, -71287.5} --- long, lat: {-1.34356, 0.686926}

The lat, long should be around 38º51'34"N, 77º02'11"W (center of the shape according to http://tfr.faa.gov/save_pages/detail_0_8326.html )


Any clues as to what I am doing wrong?



Answer



Try


ogr2ogr -t_srs EPSG:4326 out.shp in.shp


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...