[GIS] Allowing user to download shapefiles via GeoServer

downloadgeoext-2geoserveropenlayersshapefile

We provide layers via shapefiles and/or PostGIS PostGreSQL database in geoserver-2.x.x with GCS Geometry.

geoserver-2.x.x itself uses this shapefiles to render maps.

The shapefiles are located on the server machine where geoserver-2.x.x is installed.

I was just thinking to allow user to download specific shapefile(s) of specific layer(s).

I want user to download the shapefile via the website developed using OpenLayers 3 and GeoExt JavaScript libraries with Spring 4,Jsp, Hibernate.

As per this link:

WFS Output for shapefile

Case 1: Layer which is from PostGIS

Case 2: Layer from shapefile (.shp) (located somewhere in D:\shape\Layer.shp on server)

  1. In both above cases will same code work for allowing user to download shapefiles?

  2. If the files may too large or the data table used in PostGIS is too wide, still it will allow user to download the shapefile?

  3. For case 2 will it create a shapefile by itself?

  4. Because my layers are mixing of above two cases. Would I have same logic?

  5. I want to understand how it works. Because I want to give bulk download also for group layers.

  6. Is this possible? I also want to give the same feature in one of my project in world wind.

Any help is invited.

Best Answer

If you use geoserver's Shapefile Output on the WFS service, it doesn't matter what the source of the data was. It doesn't matter whether the data is coming from Shapefiles or PostGIS or something else.

Let me try to provide answers to all your sub-questions.

It doesn't matter about how big the table was, or how many features it contained, Geoserver can export the vector data as shapefiles (You should pay attention to the maxFeatures parameter. You need to set it such that all your required features are exported. If you set it to some lower figure, then only those first N features will be present in the shapefile.)

The exported shapefile will have to be compatible with shapefile standards, hence the datatypes might change slightly, the fields names will be changed to meet the requirements, and if you have more than 255 columns in you Database, then the exported shapefile will have only the first 255 columns (If your table has so many columns, you have bigger problems, which you should solve first)

You cannot serve out group layers as WFS, so exporting them to shapefile is not possible at all.

Related Question