Hi,
I’m writing this mail to propose (on behalf of a sponsor) a small new feature for GetFeatureInfo,
that is, the ability to report the number of matched features in the requested area as part
of the legend.
It is not the more commonly requested “show only the entries with at least one item in the map”,
but it lowers its implementation bar significantly, making it more likely to get sponsored in the future.
The request would look like:
http://host/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&LAYER=topp:states // std legend graphics so far
&SRS=EPSG%3A4326&SRCWIDTH=768&SRCHEIGHT=330&BBOX=-97.7783203125%2C37.078857421875%2C-89.3408203125%2C40.704345703125 // identify area of interest
&LEGEND_OPTIONS=countMatched:true // activate the counting mode
In order:
- A standard GetLegendGraphics request, but with a layer parameter (normally optional, but mandatory in this case)
- The part of a GetMap that identifies the current area, using the same syntax as GetMap, minus the “src” prefix for width and height, as they would otherwise conflict with the legend icon size
- A legend option to enable it (the implementation of the “return only the rules show in the map” would differ only in this bit)
The output would be something like this, with the count within parenthesis: (graphics as text for the sake of expediency):
[greenSquare] Parks and green spaces (10)
[blueSquare] Water (3)
[graySquare] Urban (150)
Implementation wise, I’m still a bit torn between a CountVisitor call and a StreamingRenderer pass, but I believe
I’ll do the second. Rationale: the logic of a count would need to consider symbols sizes and whether the output
actually contributes to the visible map, and with a thematic map would end up having to issue multiple queries,
and would end up returning a count that does not always exactly match the map on screen.
A StreamingRenderer call against a fake Graphics2D would do a single pass instead (faster than the equivalent
GetMap for sure) and would end up counting what the user actually sees instead (it would be in line with
the current GetFeatureInfo implementation, doing the same).
Feedback welcomed. If you think something needs to be changed I would appreciate if you could mark
such comments clearly (I often get confused by comments that is not meant to ask for a change, but could be
interpreted as such).
Cheers
Andrea
···
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.
The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.