[mapserver-users] zipped shapefile

Even Rouault even.rouault at spatialys.com
Wed Jun 22 23:49:49 PDT 2016


Le jeudi 23 juin 2016 01:03:03, Jeff McKenna a écrit :
> I had tried that also.  I am unable to get this to work with MapServer
> 7.0.1 (MS4W 3.1.4).  No problems with ogrinfo.

Definitely not in the DATA that must be a layer name or SQL SELECT, but in CONNECTION.
It is important to put the absolute path, as the SHAPEPATH directive will have no effect on
a /vsizip/ filename. As Mike raised, it is recommended to put the filename of the shape too.
(you may omit it if the .shp is at the root of the .zip and there's no other "extra" file than the ones
expected for a shapefile. When you omit it, the zip is recognized as a directory and it is the
same logic as doing ogrinfo on a directory that is applied. Will work with directory of shapefiles
and .tab/.mif for example)

The following works form me for example :

  CONNECTIONTYPE OGR
  CONNECTION "/vsizip//home/even/popplace.zip/popplace.shp"
  DATA "popplace"

Note that if max performance is needed, using a shapefile in a zip is not the best strategy.

> 
> -jeff
> 
> > You need to include the name of the shapefile in the DATA statement, eg
> > DATA "/vsizip/myzipfile.zip/shapefile.shp"
> > 
> > Mike
> > 
> > ----
> > Michael Smith
> > 
> > US Army Corps
> > Remote Sensing GIS/Center
> > michael.smith at usace.army.mil
> > 
> > 
> > 
> > 
> > -----Original Message-----
> > From: mapserver-users <mapserver-users-bounces at lists.osgeo.org> on behalf
> > of Jeff McKenna <jmckenna at gatewaygeomatics.com>
> > Date: Wednesday, June 22, 2016 at 6:46 PM
> > To: <mapserver-users at lists.osgeo.org>
> > Subject: Re: [mapserver-users] zipped shapefile
> > 
> >> I'm also unable to get this to work.  I agree that it should (with the
> >> layer specified in the "DATA" statement), but I can't seem to get
> >> 
> >> MapServer 7.0.1 to draw a map.  The error message is quite generic:
> >>   OGROpen(/vsizip/test.zip)
> >>   msOGRFileOpen(): OGR error. Open failed for OGR connection in layer
> >> 
> >> 'test'.  File not found or unsupported format.
> >> 
> >> 
> >> I believe you have found a nice enhancement.  I think you should file
> >> this in the issue tracker: https://github.com/mapserver/mapserver/issues
> >> 
> >> 
> >> -jeff
> >> 
> >> 
> >> 
> >> --
> >> Jeff McKenna
> >> MapServer Consulting and Training Services
> >> http://www.gatewaygeomatics.com/
> >> 
> >> On 2016-06-22 5:57 PM, lagrange123 wrote:
> >>> Hi,
> >>> 
> >>> I have a bunch of shapefiles in zip format for disk space reasons. And
> >>> I want to be able to server their contents with mapserver. Is this
> >>> possible?
> >>> 
> >>> I was thinking that I could use CONNECTIONTYPE OGR. And then, since
> >>> gdal/ogr
> >>> can read a zipped data source (per
> >>> https://trac.osgeo.org/gdal/wiki/UserDocs/ReadInZip), this would enable
> >>> mapserver to serve such a data source. However, I am not having much
> >>> luck,
> >>> and I don't know if this is even supported in mapserver.
> >>> 
> >>> My layer definition is:
> >>> 
> >>> LAYER
> >>> 
> >>> 		NAME "my_shapefile"
> >>> 		CONNECTIONTYPE OGR
> >>> 		CONNECTION "/vsizip/path/to/file.zip"
> >>> 		TYPE POLYGON
> >>> 		STATUS ON
> >>> 
> >>> END
> 
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the mapserver-users mailing list