planetfederal / qgis-suite-plugin

GNU General Public License v2.0
25 stars 17 forks source link

Cannot Publish QGIS Raster to GeoServer #166

Open simondavies22 opened 9 years ago

simondavies22 commented 9 years ago

Hello All,

I'm a complete newcomer to both QGIS and OpenGeo Explorer. I've set up GeoServer on my Synology NAS, and I can both connect to the server and interact with the sample data.

I can also create GeoServer workspaces, but when I try and publish a raster layer from QGIS to GeoServer I receive an error:

Validation failed Traceback (most recent call last): File "C:/Users/Administrator/.qgis2/python/plugins\opengeo\gui\explorer.py", line 119, in run command(*params) File "C:/Users/Administrator/.qgis2/python/plugins\opengeo\gui\confirm.py", line 18, in publishLayer catalog.publishLayer(layer, workspace, overwrite, name) File "C:/Users/Administrator/.qgis2/python/plugins\opengeo\qgis\catalog.py", line 384, in publishLayer self.upload(layer, workspace, overwrite, title) File "C:/Users/Administrator/.qgis2/python/plugins\opengeo\qgis\catalog.py", line 252, in upload self._uploadRest(layer, workspace, overwrite, name) File "C:/Users/Administrator/.qgis2/python/plugins\opengeo\qgis\catalog.py", line 196, in _uploadRest overwrite=overwrite) File "C:\Users\Administrator.qgis2\python\plugins\opengeo\ext-libs\gsconfig-0.6.9-py2.7.egg\geoserver\catalog.py", line 471, in create_coveragestore raise UploadError(response)

UploadError: Could not save the layer 20140717-fowlmere-02_fowlmere2_02_fowlmere2_03_mosaic_crop_VI, there was an upload error: Validation failed

I'm stuck! I'd be very grateful for any assistance.

My thanks in advance,

Simon.

ischneider commented 9 years ago

There have been some changes in GeoServer to attempt to avoid layers with names that eventually cause problems when these names are used in XML.

Overzealous or not, the problem with this name is that it starts with a number.

See here: http://www.mail-archive.com/geoserver-devel%40lists.sourceforge.net/msg27930.html

simondavies22 commented 9 years ago

Thanks very much for your reply - problem solved! I simply renamed the raster layer in QGIS and now I can publish to GeoServer without error. Great!

Unfortunately, our entire archive of hyperspectral raster data all starts with the date in yyyymmdd. I think I'll change our naming convention.....

volaya commented 9 years ago

@dakcarto is working on an improvement for checking the validity of names used in the plugin. I am not sure he is aware of this limitation in GeoServer (I wasn't), but it is worth considering it as well. Thank @ischneider!

dakcarto commented 9 years ago

Hi @simondavies22,

The upcoming XML validation for names in the plugin will be:

Text must be a valid XML name:
  * Can contain letters, numbers, and other characters
  * Cannot start with a number or punctuation character
  * Cannot start with the letters 'xml' (case-insensitive)
  * Cannot contain spaces

With a case-insensitive regular expression of:

r'^(?!XML|\d|\W)[a-z]\S*'

This is a lightweight check against valid XML names, but does not allow for any punctuation to start the name, i.e. all names should start with [a-z] or [A-Z].

Another restriction will be applied for workspace names, which will be limited to 10 characters, as per GeoServer documentation.

ischneider commented 9 years ago

Unfortunately, our entire archive of hyperspectral raster data all starts with the date in yyyymmdd. I think I'll change our naming convention.....

If I followed the GeoServer discussion correctly, this hopefully won't be required but it's possible the invalid XML names will make some services not function properly. For example, if you are using WMS only, there should be no problems it seems.

The restriction was put into place as it was surprising to users that they could publish a name that would break certain XML responses.