-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove dependency on external prj2epsg service/api #21
Comments
Updates/Memos: I will be playing with it and reporting back later. |
A initial fix has been pushed to appsdev server, which makes use of a new function newly introduced in GDAL 2.3. Since GDAL 2.3 is still in development phase (latest stable release is 2.2.3), we should evaluate the potential risk of pushing a pre-release GDAL to our production server. |
The external service prj2ersi is still down. Since this issue has been blocking GIS app from normal use on apps server for more than 2 weeks over the break. |
@martinseul I was able to open this shapefile in ArcMap (it failed to open in GRASS) . |
A brief summary and take-away for this issue. GeoServer requires to know EPSG code for all incoming data
|
I pasted here the email conversion I had with Shawn on this issue
Drew to Shawn:
I then checked the error log on server and it seems the prj2epsg service is partially down.
I am looking at your code that send prj string to prj2epsg to get a list of matched epsg dict and then pin a epsg url like http://prj2epsg.org/epsg/3003.json to get more info.
But this http://prj2epsg.org/epsg/XXXX.json endpoint it down now.
Could you remind me again why we need to know the epsg code before we upload data to geoserver? (I am sure you told me the reason before but it is not on the top of my head)
Thanks
Shawn Crawley
Dec 19 (2 days ago)
to me
We need the epsg code because there are certain rasters/shapefiles that had a projection that GeoServer did not recognize, even though they are valid (i.e. recognized by ArcMap and other authorities on projections). In some cases, the prj was missing the EPSG code. Another problem is that some projections have multiple epsg codes (a great example is the Google projection. see https://en.wikipedia.org/wiki/Web_Mercator#Identifiers). This prj2epsg service was a work-around to find the more common epsg code, or at least a closest fit. If the closest fit does not match what is already set as the prj, the new epsg code returned from the prj2epsg service is used to "edit" the file with the correct "corrected" epsg using the gdal_edit function (see https://github.com/hydroshare/tethysapp-hydroshare_gis/blob/master/tethysapp/hydroshare_gis/utilities.py#L1510). The gdal_edit function does not reproject or change the actual underlying coordinate data, it just rewrites the project info stored.
I believe there is a better route, but I took the above route initially because I seem to recall that David Tarboton had an issue with my other idea. However, I still think my other idea would be best. I think the best work-around would be to just reproject EVERY dataset into the Web Mercator (3857) projection or the WSG84 (4326) projection. Whichever one openlayers is using to display the data. GeoServer has to reproject the data on the fly anyway if the data is not already in the requested projection. Also, I think it is the on-the-fly reprojecting that causes some weird artifacts in the tiles. I don't remember exactly why Dr. Tarboton rejected it (and maybe he didn't). In the case that it was not, and is not, seen as a bad idea from anyone, that is the change that I suggest. Then we wouldn't need to depend on the prj2epsg service.
Thanks for looking into it, Drew! Let me know if you have anymore questions.
Zhiyu (Drew) Li [email protected]
Dec 19 (2 days ago)
to Shawn
Thanks I see.
I think reprojecting anything into 3857 is a doable approach. But the tool does the reprojection should recognize the original projection first, right? Apparently ArcMap can do it, but can GDAL or any other open source tool recognize all of these uncommon/strange/weird prj string? Also is Geoserver already using GDAL to handle reprojection under the hood?
Thanks
Zhiyu (Drew) Li [email protected]
Dec 19 (2 days ago)
to Shawn
Looks like geoserver doc recommends reprojection if native prj has no matched EPSG code
http://docs.geoserver.org/2.7.1/user/advanced/crshandling/configurecrs.html
Shawn Crawley
Dec 19 (2 days ago)
to me
Cool. Yeah, I guess I'd go with GeoServer on that one, then. And I'm not sure if they are using GDAL under the hood, but they likely are.
Zhiyu (Drew) Li [email protected]
Dec 19 (2 days ago)
to Shawn
OK. I think we are close.
We should let GIS app use GDAL to test each file
Plan A:
If GDAL can recognize prj file and can find a matched EPSG code, we then upload the file to GeoServer directly (assuming GeoServer uses GDAL and can do the same thing)
If GDAL can recognize prj file but cant find a matched EPSG code, we reproject it into 3857
if GDAL cant recognize prj file we throw out a error (ask user to reproject it in ArcMap)
Plan B
we reproject anything into 3857 using GDAL
throw error once GDAL fails to do it (ask user to reproject it in ArcMap)
what do you think?
Thanks
Shawn Crawley
Dec 20 (1 day ago)
to me
Hm... I see benefits to both plans. However, how do you foresee GDAL being used to test each file for a matched EPSG code? Or how would we determine that "GDAL can recognize prj file but cant find a matched EPSG code"? Are you referring to using gdalinfo and parsing the results (like the app already does) to see if it returns an EPSG code in the projection info? I'd almost lean more towards Plan B, just because I think that running the reproject function (which I think is gdalwarp) on every file is the most straight-forward way of checking if a file "passes the projection test" so to speak. And though it would be a little more overhead (loading time) up front, the rendering of the layers would happen quicker since they wouldn't be reprojected on the fly. However, if you do have a good strategy, the will power, and the time to do Plan A, then I'd say that one would be fine.
Let me know.
The text was updated successfully, but these errors were encountered: