[OpenLayers-Dev] How to display shapefile?
tschaub at opengeo.org
Tue Apr 14 11:51:19 EDT 2009
Kwong Hu Kiu wrote:
> Actually, i know of that way but do not want to use it since i have
> written a wms service in c# that serves WMS request.
> and want to do everything using my own little program.
> ThinkGeo's Mapsuite is using openlayers as well but they are supporting
> shapefile layer using their API.
> Anyone knows how that can be done ?
The answers you have been given already explain this - but you can't
have your browser render shapes from your shapefile directly.
If you choose to render your shapefile on the server and send the
results to the browser, then you can use a WMS or generate a cache of
tiles and serve those.
If you want to have the browser render the shapes, then you will need to
have your server serve up something other than the shapefile format
(multiple files would need to be archived first and unarchived by the
browser - or multiple requests and then a join - either way a mess).
So, as mentioned, use something like ogr2ogr - OpenLayers can parse
formats like GML, KML, and GeoJSON and render those in the browser.
You'll be limited in how many features you can display at a time this
way (think order of 100).
> > Date: Tue, 14 Apr 2009 10:57:13 -0400
> > To: kwonghu at hotmail.com
> > CC: dev at openlayers.org
> > Subject: Re: [OpenLayers-Dev] How to display shapefile?
> > From: crschmidt at metacarta.com
> > On Tue, Apr 14, 2009 at 10:11:11PM +0800, Kwong Hu Kiu wrote:
> > >
> > >
> > > Hi all,
> > >
> > > May i know how i can display shapefile using openlayers ?
> > > Shapefile works with ESRI. How can i include it in openlayers ?
> > >
> > > Any code example around ?
> > Generally speaking:
> > * Set Up MapServer
> > * Set up your shapefile data in MapServer
> > * Load MapServer Layer as a WMS.
> > --
> > Christopher Schmidt
> > MetaCarta
> Dev mailing list
> Dev at openlayers.org
OpenGeo - http://opengeo.org
Expert service straight from the developers.
More information about the Dev