3

I'm currently trying to get a couple of layers uploaded to a geoserver and I'm having trouble getting the projection recognized. The result of the curl command is that the two layers are both missing the Native SRS, which should be EPSG: 3857.

I'm able to fix by manually going to the layer, choosing a Declared SRS, and computing the Lat/Lon Bounding Box from the native bounds. This allows me access to the layer via WMS ,which is what I want.

But this is not a good solution. I have a lot of layers that I need to upload, so I don't want to manually fix the missing Native SRS problem for each layer. So how can I fix the shapefiles so that geoserver can find the Native SRS on its own?

I got the correct .prj file from here: http://hub.qgis.org/issues/7368 So both the .prj and the .qpj files are set to this for the two shapefiles:

PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Mercator_1SP"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",EAST],AXIS["Y",NORTH],EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext  +no_defs"],AUTHORITY["EPSG","3857"]]
  • I am currently dealing with same problem. I cant get native SRS to read my .prj files. Did you managed to solve this problem? Bye. – dkocich Oct 6 '14 at 18:38
1

We have had this same issue. And FYI, when you import that shapefile into POSTGIS, you will likely not have an SRID code there as well.

What I curiously found, was that when you do a "save as", and choose the correct projection, we were choosing EPSG:4326, QGIS writes a *.prj file, yes, but the prj file does not have any EPSG metadata, authority descriptors etc.

But QGIS also writes a *.qpj file, and this file has the correct EPSG metadata / authority descriptors written. SO I copied the entire file to be the *.prj file, replacing it, and it works in geoserver!

SO I thought hmmm.... surely this is not a workable workflow ... !?

So I started exploring some of the menus in QGIS ... and found this menu progression: Vector -> Data Management -> Define Current Projection

Make sure you choose Output Spatial Reference, then Predefined Spatial Reference, and find EPSG:4326, or whichever EPSG you prefer. Ignore the message that says your setting it to the same as it already is ...

And if you look on your disk, where ever your shapefile is physicaly located, you will see that the *.prj file should have a timestamp that reflects your current computer time ... i.e. it is the most recent file in the directory etc. If you open it up, you should be able to verify that it now has the EPSG metadata ... We then moved this shapefile to a new Geoserver store, and chose this layer to publish. And indeed the EPSG:4326 now appears in the Native SRS selector!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.