[Users] How to create legend panel using OpenLayers.Layer.MapServer layer...
stela anders
stelaanders at gmail.com
Mon Jan 11 17:00:21 CET 2010
I updated GeoExt....
Worked fine now!
Thanks for the patience !
Stella
2010/1/11 Andreas Hocevar <ahocevar at opengeo.org>
> Hi,
>
> which version of GeoExt are you using? Providing imageFormat in defaults
> only works with current trunk. Version 0.6 had a different way of doing
> this.
>
> Regards,
> Andreas.
>
> stela anders wrote:
>
>> Thanks Andreas...
>>
>> The fact is :
>> - Now I have all image symbol in png format
>> - My mapfile is configured to generate PNG images
>> - My legendPanel:
>>
>> var legendPanel = new GeoExt.LegendPanel({
>> defaults: { style: 'padding:5px',
>> imageFormat: "image/png" },
>> title: 'Legend',
>> bodyStyle: 'padding:5px',
>> width: 350,
>> autoScroll: true });
>>
>>
>> But the legend url generated my GeoExt is:
>>
>>
>> http://localhost/cgi-bin/mapserv.exe?MAP=Map.map&TRANSPARENT=true&FORMAT=image%2Fgif&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=Roads<
>> http://localhost/cgi-bin/mapserv.exe?MAP=Map.map&TRANSPARENT=true&FORMAT=image%2Fgif&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=Roads>
>>
>>
>> It is in GIF, why? If I manually change to "...&FORMAT=image%2Fpng" the
>> legend is generated fine...
>>
>> Any help?
>>
>> Thanks
>>
>> Stella
>>
>> 2010/1/8 Andreas Hocevar <ahocevar at opengeo.org <mailto:
>> ahocevar at opengeo.org>>
>>
>> stela anders wrote:
>>
>> Thanks Andreas... ;)
>> displayInLayerSwitcher did the trick !!!
>>
>> I have some point layer with image symbol (.gif - 16x15) ... The
>> legend icon in that case stay ugly (only part of image appears)...
>>
>>
>> Not a GeoExt issue for sure. GeoExt just loads the image and
>> displays it in its original extent and dimensions. But you could
>> define a png24 format in your mapfile, and configure your
>> legendPanel with something like
>>
>> defaults: {imageFormat: "image/png"}
>>
>>
>> Any idea why that? Or maybe is a restriction?
>>
>>
>> Again, you might want to ask about GetLegendGraphic on the mapserver
>> users list or look in the mapserver docs.
>>
>> Regards,
>> Andreas.
>>
>>
>> Thanks so much! U r saving my week ;)
>>
>> Stella
>>
>> 2010/1/8 Andreas Hocevar <ahocevar at opengeo.org
>> <mailto:ahocevar at opengeo.org> <mailto:ahocevar at opengeo.org
>>
>> <mailto:ahocevar at opengeo.org>>>
>>
>>
>> stela anders wrote:
>>
>> Hello Andreas...
>>
>> All sublayers is with status ON, they are draw on map,
>> but in my
>> legend I got ONLY "Layer1" label printed...
>> My layers:
>> OpenLayers.Layer.WMS("Layer1",
>> mycgi, {
>> map: mymapfile,
>> layers: ['Sublayer11','Sublayer12',
>> 'Sublayer13'],
>> format: "image/png",
>> transparent: "true"
>> }, {
>> isBaseLayer: true,
>> visibility: true
>> }),
>>
>>
>> The above should cause three GetFeatureInfo requests to be
>> issued:
>> one for each of your sublayers. If you just see the label, then
>> MapServer does not send you an image on the GetFeatureInfo
>> request.
>> Here is what you can try: enable the Net panel on firebug and
>> look
>> at the GetFeatureInfo request that the browser issues. Copy
>> them,
>> open them in a browser window/tab, and fix your mapfile until
>> they
>> work (more help available in mapserver docs/lists).
>>
>>
>> OpenLayers.Layer.WMS("Layer2",
>> mycgi, {
>> map: mymapfile,
>> layers: ['Sublayer21','Sublayer22',
>> 'Sublayer23'],
>> format: "image/png",
>> transparent: "true"
>> }, {
>> isBaseLayer: false,
>> displayInLayerSwitcher: false,
>> visibility: true
>> }),
>>
>>
>> This won't display anything, because you have set
>> "displayInLayerSwitcher" to false.
>>
>> So, What is your suggestion in building a legend to Map with
>> GeoExt sublayers? I need all sublayers appears on my legend
>> (each one has different images...)
>>
>>
>> The LegendPanel does exactly that. It requests one image per
>> sublayer (now that you provided a code snippet and I finally
>> know
>> what you meant by "sublayer"). My suggestion is: fix your
>> mapfile so
>> Mapserver can answer GetFeatureInfo requests correctly.
>>
>> Regards,
>> Andreas.
>>
>> -- Andreas Hocevar
>> OpenGeo - http://opengeo.org/
>> Expert service straight from the developers.
>>
>>
>>
>>
>> -- Andreas Hocevar
>> OpenGeo - http://opengeo.org/
>> Expert service straight from the developers.
>>
>>
>>
>
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100111/064f30d1/attachment-0001.htm
More information about the Users
mailing list