English 中文(简体)
Dynamic MapServer on OpenLayers
原标题:

I m struggling with a peculiar set up: we have a WMS layer in OpenLayers (within a GeoExt web interface) invoking a MapServer string (e.g. http://mydomain/cgi-bin/mapserv.exe?map=someMapFile.map&etcetc).

Now we need to split the dataset into several layers. We tried by instanciating n separate WMS layers and it s way too slow, so we re trying a pretty simple solution: generating a custom mapFile containing only the required layers. This dynamic mapfile is returned by a service:

http://mydomain/myservice/get?layers=listoflayers,otherparams,etc that returns the path to the custom mapfile. This solution is very simple and efficient.

So now we should update the WMS layer in order to replace this mapfile on the fly, without reloading the whole page.

So my questions are:

  • Is this possible?

  • Is it ok to have a separate layer list (not the default one offered by OpenLayers) and trigger an event "changeLayers"? Are there any examples of this setup?

Thanks in advance for any hints!

Mulone

问题回答

You shouldn t need dynamic mapfiles for this. The GetMap request has a parameter LAYERS.

LAYERS=layer_list: Comma-separated list of one or more map layers. Optional if SLD parameter is present. (http://mapserver.org/ogc/wms_server.html)

Or are you doing anything else but selecting a subset of layers?

In my opinion, in the case like you mentioned, it is good to break down the WMS mapfile into several layers. Even in some cases the data are from exact same source but you can still apply some filter to have multiple layers in your WMS.

For example, there are 1 million road in a place that stored in a table in database, to publish the road feature, you could potentially have several layers for this dataset. Layers can be filter by year, or by type or whatever you want based on the attribute or spatial relationship. This happens when using filter in your layer block or layer file parsing the string to query via database connection. The layers name can be dynamic when you generate your request string so i think that s maybe what you are looking for.

So after this, when you only interested in, say, interstate road, instead of using the WMS endpoint for the whole bunch of layers in your WMS request, you can query only against the interstate layer by using layer=interstate_road in the request. Then only interstate road would be returned not exhaustively scanning/rendering the whole dataset.

And if you don t mind read a little bit more, there are spatial, non-spatial filter in MapServer as well. For example the filter encoding, would provide you spatial/non spatial query at feature level. And it is also dynamic because the filter is within the request url which you can change dynamically as well.





相关问题
Dynamic MapServer on OpenLayers

I m struggling with a peculiar set up: we have a WMS layer in OpenLayers (within a GeoExt web interface) invoking a MapServer string (e.g. http://mydomain/cgi-bin/mapserv.exe?map=someMapFile.map&...

transparent labels on mapserver using a mapfile

i m trying to add a watermark layer in my mapfile with a DEFAULT layer: LAYER OPACITY 20 NAME "copyright" METADATA "wms_title" "copyright" END STATUS DEFAULT ...

what is actually "EXTENT" in gis slang?

I am not clearly understanding the extent parameter in GIS applications. for ex, In mapserver map file we are using NAME "CGI-CONTEXT-DEMO" STATUS ON SIZE 400 300 **EXTENT -2200000 -712631 3072800 ...

how to add map layer overlays in openlayers?

i have 3 shapefile ready in a map file, and rendering it on mapserver. what i need is to and these layer overlay one over the other.how can i do this

downgrade mapserver

a question, as I can uninstall and install mapserver an older version, since I is causing roughly following error and I think is the version of the same Warning: [MapServer Error]: msLoadSymbolSet(): ...

Mapserver mapinfo styling

Is it possible to use mapinfo embedded graphic style for features with mapserver? I don t want to describe again width and color of lines, polygones and so on.

OpenLayers, Mapserver & Tilecache

I would like to improve the performance of my application that displays thematic maps using OpenLayers, Google Maps & MapServer with TileCache (http://tilecache.org). Therefore I followed the ...

热门标签