Skip to content
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

mapstore client does not let download geopackage from geoserver #509

Closed
lpasquali opened this issue Sep 20, 2021 · 11 comments
Closed

mapstore client does not let download geopackage from geoserver #509

lpasquali opened this issue Sep 20, 2021 · 11 comments
Assignees
Labels
Milestone

Comments

@lpasquali
Copy link

lpasquali commented Sep 20, 2021

GeoServer 2.19.x in current 3.3.x geonode and geonode-project branches is capable to export compatible layers in geopackage format (I used tiger_roads shapefile for test), once I upload layer through geonode, I can export it in geopackage format within geoserver Layer preview page.
On the contrary as in the video attached if I do this on development geonode updated to latest 3.3.x:

  • open incognito
  • https://development.demo.geonode.org
  • go to layer tasmania_cities try to download as geopackage will result in a file with "x" extension not working
  • go to giant_poligon layer, no geopackage option will be shown
  • got back to layer tasmania_cities, no more geopackage offered as dataformat for export.

Peek 2021-09-20 18-04

@tdipisa @giohappy

@lpasquali
Copy link
Author

FYI @simboss

@giohappy
Copy link

@tdipisa who could invetigate this?

@simboss simboss assigned allyoucanmap and unassigned tdipisa Sep 21, 2021
@allyoucanmap
Copy link
Collaborator

@giohappy @simboss After an investigation this is what I found out:

The LayerDownload makes a request to the WPS to understand if the gs:Download is available if so it uses WPS async download and if not it uses WFS sync download.
The formats for the WPS download are not automatically updated by MapStore so if we need new formats we have to configure them in localConfig.json overriding the default ones that not include GeoPackage. Here an example of configuration with default formats in MapStore + geopackage

{
    "name": "LayerDownload",
    "cfg": {
        "formats": [
            {"name": "application/json", "label": "GeoJSON", "type": "vector", "validServices": ["wps"]},
            {"name": "application/arcgrid", "label": "ArcGrid", "type": "raster", "validServices": ["wps"]},
            {"name": "image/tiff", "label": "TIFF", "type": "raster", "validServices": ["wps"]},
            {"name": "image/png", "label": "PNG", "type": "raster", "validServices": ["wps"]},
            {"name": "image/jpeg", "label": "JPEG", "type": "raster", "validServices": ["wps"]},
            {"name": "application/wfs-collection-1.0", "label": "wfs-collection-1.0", "type": "vector", "validServices": ["wps"]},
            {"name": "application/wfs-collection-1.1", "label": "wfs-collection-1.1", "type": "vector", "validServices": ["wps"]},
            {"name": "application/zip", "label": "Shapefile", "type": "vector", "validServices": ["wps"]},
            {"name": "text/csv", "label": "CSV", "type": "vector", "validServices": ["wps"]},
            {"name": "application/x-gpkg", "label": "GeoPackage", "type": "vector", "validServices": ["wps"]}
        ]
    }
},

I tried the above configuration and I'm getting this error after trying to download a geopackage with WPS

org.geotools.process.ProcessException: Don't know how to encode in mime type application/x-gpkg
Don't know how to encode in mime type application/x-gpkg

and I find this commit in the wps-download that include the geopackage format with tag 2.20 for the GeoServer.
Is the WPS download for GeoPackage working in the custom branch of GeoNode -> GeoServer 2.1.9?

geoserver/geoserver@01cd8fe

I think we need to:

  • verify that the GeoServer 2.19 version of geonode support WPS download for GeoPackage
  • when we are sure that geopackage is supported we could add the configuration in localConfig.json with formats for WPS download

possible improvements in MapStore/GeoServer:

  • add geopackage to the default one in MapStore so we don't need to override the config (but this means that the MapStore product must use a GeoServer that supports WPS download of GeoPackage)
  • it would be nice to get all available format from the wps-download module (if is there an enpoint for WPS download)

I think that sometimes it was working because it was using WFS download instead where the formats are described by the capabilities (maybe the wps-download were not working)

@giohappy
Copy link

verify that the GeoServer 2.19 version of geonode support WPS download for GeoPackage

It's been backported, according to this commit

I tried the above configuration and I'm getting this error after trying to download a geopackage with WPS

The right MIME should be application/geopackage+sqlite3

Please @allyoucanmap make a test using the Development demo.

@allyoucanmap
Copy link
Collaborator

@giohappy I tried also using application/geopackage+sqlite3 with raster and vector layers but getting same error:

org.geotools.process.ProcessException: Don't know how to encode in mime type application/geopackage+sqlite3
Don't know how to encode in mime type application/geopackage+sqlite3

anyway once we are sure about the mime type we need to update geonode-mapstore-client with the correct configuration:

{
    "name": "LayerDownload",
    "cfg": {
        "disablePluginIf": "{!state('selectedLayerPermissions').includes('download_resourcebase')}",
        "formats": [
            {"name": "application/json", "label": "GeoJSON", "type": "vector", "validServices": ["wps"]},
            {"name": "application/arcgrid", "label": "ArcGrid", "type": "raster", "validServices": ["wps"]},
            {"name": "image/tiff", "label": "TIFF", "type": "raster", "validServices": ["wps"]},
            {"name": "image/png", "label": "PNG", "type": "raster", "validServices": ["wps"]},
            {"name": "image/jpeg", "label": "JPEG", "type": "raster", "validServices": ["wps"]},
            {"name": "application/wfs-collection-1.0", "label": "wfs-collection-1.0", "type": "vector", "validServices": ["wps"]},
            {"name": "application/wfs-collection-1.1", "label": "wfs-collection-1.1", "type": "vector", "validServices": ["wps"]},
            {"name": "application/zip", "label": "Shapefile", "type": "vector", "validServices": ["wps"]},
            {"name": "text/csv", "label": "CSV", "type": "vector", "validServices": ["wps"]},
            {"name": "application/geopackage+sqlite3", "label": "GeoPackage", "type": "vector", "validServices": ["wps"]},
            {"name": "application/geopackage+sqlite3", "label": "GeoPackage", "type": "raster", "validServices": ["wps"]}
        ]
    }
},

@giohappy
Copy link

@lpasquali @drumbsd do you confirm that the WPS Download with Geopacke support has been shipped with Geoserver 2.19.x for GeoNode?

@lpasquali
Copy link
Author

@giohappy I can't confirm and must deny because I followed documentation and it was not mentioned anywhere, it says only WPS is needed which is present: https://docs.geoserver.org/latest/en/user/community/geopkg/

@giohappy
Copy link

from a chat with @lpasquali the support for GeoPackage should be already be inside GeoNode 2.19.x for GeoNode, since the commit is from August.

@afabiani could you please make a quick invetigation? Quick recap:

@giohappy
Copy link

@allyoucanmap GeoServer 2.19 for GeoNode has been fixed (also development demo). Can you please try again the GPKG WP download?

@allyoucanmap
Copy link
Collaborator

@giohappy @simboss Added the format geopackage to the LayerDownload configuration and it's working but I noticed:

  • the name of the exported file is always result (we should verify if it's possible to change it maybe based on the name of the layer?)
  • the file are generated with the .geopackage+sqlite3 extension and to make them work on QGIS 3.18.3-Zürich I need to rename the file with the .gpkg extension

The configuration update has been merged on master and 3.3.x so we could try to update development instance to test it
Merged PR:

and just opened an issue in mapstore to add GeoPackage as default format geosolutions-it/MapStore2#7350

@giohappy
Copy link

the name of the exported file is always result (we should verify if it's possible to change it maybe based on the name of the layer?)

@allyoucanmap AFAIK the respone can be controlled with the <ows:Identifier> inside the <wps:RawDataOutput> element. From the docs I see the following, which makes me think that it was also used in MapStore to implement WPS download:

<wps:ResponseForm>
	<wps:RawDataOutput mimeType="application/zip">
		<ows:Identifier>result</ows:Identifier>
	</wps:RawDataOutput>
</wps:ResponseForm>

Could you make a test changing the defaults sent by MapStore?
This improvement would be useful for the other formats too.

the file are generated with the .geopackage+sqlite3 extension and to make them work on QGIS 3.18.3-Zürich I need to rename the file with the .gpkg extension

I haven't found something about this inside the WPS spec. @simboss who should we ask about this?

@giohappy giohappy added the Epic label Sep 23, 2021
@giohappy giohappy changed the title [3.3.x] mapstore client does not let download geopackage from geoserver mapstore client does not let download geopackage from geoserver Sep 23, 2021
@giohappy giohappy added this to the 3.3.0 milestone Sep 23, 2021
@giohappy giohappy closed this as completed Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants