[Geoserver-devel] Expanding shapefile datastore

I have some shape files that I want to use in geoserver (read only), but they are stored within zip files, and I don’t want to have to unzip them to other directories. I was thinking of writing my own datastore based on the existing one for shape files, and just changing the I/O methods to access the files where ever they actually were. Does anyone have a comment on my choice of method.

On another matter, where can I find the documentation of programtically adding data files to a geoserver instance.

John

Hi John,

This is a cool idea, and I think quite useful. I could see this perhaps being rolled into the regular datastore once its working. However I suspect it will require some major changes as the current datastore makes a lot of assumptions about the shapefile actually being on disk. I could be wrong though... i am not all that familiar with the Shapefile datastore.

An easier route might be a sort of "wrapper" datastore which unzipped the zip file to some temp directory or and delegated to the regular datastore. However this might not fit your original use case.

Regardless, if you do experiment we would be very interested in hearing about your findings.

As for programatically adding files to GeoServer this is not really supported. However people have gotten it to work by manually writing all the necessary xml files to the data directory and then restarting Geoserver via this method:

http://geoserver.org/display/GEOSDOC/Alternative+for+reloading+the+Geoserver+catalog

Not nice... but people have gotten it to work.

-Justin

John Preston wrote:

I have some shape files that I want to use in geoserver (read only), but they are stored within zip files, and I don't want to have to unzip them to other directories. I was thinking of writing my own datastore based on the existing one for shape files, and just changing the I/O methods to access the files where ever they actually were. Does anyone have a comment on my choice of method.

On another matter, where can I find the documentation of programtically adding data files to a geoserver instance.

John
!DSPAM:4007,48626b5c155621431913854!

------------------------------------------------------------------------

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php

!DSPAM:4007,48626b5c155621431913854!

------------------------------------------------------------------------

_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

!DSPAM:4007,48626b5c155621431913854!

--
Justin Deoliveira
The Open Planning Project
jdeolive@anonymised.com

John Preston ha scritto:

I have some shape files that I want to use in geoserver (read only), but they are stored within zip files, and I don't want to have to unzip them to other directories. I was thinking of writing my own datastore based on the existing one for shape files, and just changing the I/O methods to access the files where ever they actually were. Does anyone have a comment on my choice of method.

You can go and look the shapefile datastore into the GeoTools
library. Most of the code assumes NIO can be used, and most of it
it's not trivial either.

You can try to hunt down a very old version of GeoTools where
the shapefile datastore was still able to use plain streams,
probably around 2.1 release time. A bit of warning thought,
due to compression you'll loose the ability to perform random
scans. A gut feeling estimate is that a version serving out of
a zip file will be an order of magnitude slower for sequential
scans, and at least two if you start to need using spatial
indexes to access the data.

If you don't want to have your filesystem littered with many
small files, have you considered using a spatial enabled database
instead? PostGIS can give you very good performance with a very
low footprint on your system. H2 is an embedded database that
can do good too and can be already used in GeoServer 1.7.x, thought
it does not have spatial indexes (but given that you're planning
to use zipped shapefiles, you probably don't care to start with?).

Cheers
Andrea