pacificclimate / nchelpers

GNU General Public License v3.0
0 stars 2 forks source link

Invalid generated proj4 string #55

Open corviday opened 6 years ago

corviday commented 6 years ago

Given the following CRS:

int crs ;
        crs:grid_mapping_name = "latitude_longitude" ;
        crs:long_name = "CRS definition" ;
        crs:longitude_of_prime_meridian = 0. ;
        crs:semi_major_axis = 6378137. ;
        crs:inverse_flattening = 298.257222101 ;
        crs:spatial_ref = "GEOGCS[\"NAD83\",DATUM[\"North_American_Datum_1983\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6269\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4269\"]]" ;
        crs:GeoTransform = "-140.0041666666665 0.008333333332999999 0 61.9958333333325 0 -0.008333333332999999 " ;
        crs:semi_minor_axis = 6356752.31424518 ;

this string is generated by proj4_string(), specifically the latitude_longitude function:

+proj=longlat +a=6378137.0 +rf=298.257222101 +b=6356752.31424518 +lon_0=0.0

which results in the PyCRS error:

Exception: Could not find the required +ellps element, nor a manual specification of the +a or +f elements.

I am unfamiliar with proj4, and not sure if this is a data error or a code error.

jameshiebert commented 6 years ago

I'd call it a code error. The longlat projection in proj4 can be much simpler than this. E.g.: "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs".

corviday commented 6 years ago

Here's code I added to get rid of the error message so I could index the files. All it does is add the default ellps to the string, so it's not a workable long term solution.

corviday commented 6 years ago

According to the database, the rest of the files in this set, previously indexed, have the proj4 string +proj=longlat +a 6378137 +rf 298.257222101 +lon_0 0, which also lacks an ellps value.