1

I'm using PHP's cURL to upload Shapefiles to my GeoServer. It works fine but, sometimes, some of the Shapefiles got correctly uploaded but they aren't published automatically. Other times they do (thats what I want).

If I try to manually publish one layer uploaded this way I got two errors:

Errors on publish

I see in the config that my native SRS shows as UNKNOWN and the declared SRS is empty (I'm sorry for the screenshot, my GeoServer is automatically configured in Catalan and I can't set the language to English):

SRS Config

I guess the problem comes from the .PRJ file in my Shapefile, but I don't know if that's true and if there's really an error there...

A sample .PRJ on my files:

PROJCS[
    "ETRS89_UTM_zone_31N",
    GEOGCS[
        "GCS_ETRS_1989",
        DATUM[
            "D_ETRS_1989",
            SPHEROID["GRS_1980",6378137,298.257222101]
        ],
        PRIMEM["Greenwich",0],
        UNIT["Degree",0.017453292519943295]
    ],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",3],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["Meter",1]
]

My correct SRS should be EPSG:3043 (or the equivalent EPSG:25831). Is there something wrong with my .PRJ?


UPDATE

After Andrea's answer, all of my uploaded Shapefiles get the correct SRS but in some cases they aren't still published due to the Field 'latLonBoundingBox' is required error. So,

Is there a way to force the calculation of the BoundingBox at upload time (best option) or after upload with another API call (not that good...)?

2

Nothing wrong, but GeoServer won't recognize that's EPSG:3043 because the WKT lacks the code and it's using ESRI own projection and datum names (instead of the EPSG ones). Set this in the prj instead:

PROJCS["ETRS89 / TM31", GEOGCS["ETRS89", DATUM["European Terrestrial Reference System 1989", SPHEROID["GRS 1980", 6378137.0, 298.257222101, AUTHORITY["EPSG","7019"]], TOWGS84[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], AUTHORITY["EPSG","6258"]], PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH], AUTHORITY["EPSG","4258"]], PROJECTION["Transverse Mercator", AUTHORITY["EPSG","9807"]], PARAMETER["central_meridian", 3.0], PARAMETER["latitude_of_origin", 0.0], PARAMETER["scale_factor", 0.9996], PARAMETER["false_easting", 500000.0], PARAMETER["false_northing", 0.0], UNIT["m", 1.0], AXIS["Easting", EAST], AXIS["Northing", NORTH], AUTHORITY["EPSG","3043"]]

You can use http://prj2pepsg.org to translate ESRI WKTs to EPSG ones.

GeoServer 2.11 (to be released in March) got better at figuring out ESRI own WKT names and migth work without you touching the prj file. You can give it a try by downloading a nightly build here: http://ares.boundlessgeo.com/geoserver/master/

  • With your PRJ all of my Shapefiles got the right SRS (thank you!) but some of them aren't still published due to the BoundingBox issue... I've updated my question. – Jordi Nebot Jan 24 '17 at 15:59
  • Uh, unusure... just a guess, might it be that they have the wrong SRS and GeoServer cannot reproject the native bounding box to lat/lon? – Andrea Aime Jan 24 '17 at 16:41
  • Do you mean that the Shapefiles aren't really in EPSG:3043? Mmm... if I force the calculation of the BoundingBox on the GeoServer interface it works fine and I can publish and preview the layer without problem. – Jordi Nebot Jan 25 '17 at 8:42
  • Then I have no clue, sorry. Maybe best do switch the discussion to geoserver-users and share some sample data, as it's becoming a debugging problem instead of a straight question/answer – Andrea Aime Jan 25 '17 at 13:54

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.