|
From: Mauro B. <mau...@ge...> - 2013-12-13 08:09:40
|
2013/12/13 Arunava Dey <the...@gm...>
> Hello,
>
> I am still struggling to print my map layer legends. Following is my spec
> file, encoded URL for icons as suggested by Mauro:
> {
> "units" : "degrees",
> "srs" : "EPSG:4326",
> "layout" : "A4 Landscape",
> "dpi" : 150,
> "mapTitle" : "MP GeoPortal Map",
> "comment" : "This map is printed using MP GeoPortal.",
> "resourcesUrl" : "http://localhost/mpgeoportal/img",
> "layers" : [{
> "baseURL" : "http://localhost:8080/geoserver/mpgeoportal/wms",
> "opacity" : 1,
> "singleTile" : true,
> "type" : "WMS",
> "layers" : ["mpgeoportal:sagar_geomorphology"],
> "format" : "image/png",
> "styles" : [""],
> "customParams" : {
> "TRANSPARENT" : true
> }
> }
> ],
> "pages" : [{
> "center" : [78.800618943104, 23.871591352951],
> "scale" : 100000,
> "rotation" : 0
> }
> ],
> "legends" : [{
> "name" : "Geomorphology",
> "classes" : [{
> "name" : "",
> "icons" :
> "http%3A%2F%2Flocalhost%3A8080%2Fgeoserver%2Fmpgeoportal%2Fwms%3Fversion%3D1.3.0%26TRANSPARENT%3DTRUE%26SERVICE%3DWMS%26REQUEST%3DGetLegendGraphic%26EXCEPTIONS%3Dapplication%2Fvnd.ogc.se_xml%26LAYER%3Dmpgeompgeoportal%3Asagar_geomorphology%26FORMAT%3Dimage%2Fpng"
> }
> ]
> }
> ]
> }
>
>
I can see one more inconsistency: from the documentation examples (
http://www.mapfish.org/doc/print/protocol.html#print-pdf) the "icons"
property should be an array, so it should be written "icons": ["..."].
> I am having doubts about the name and icons block in legend definition. Is
> it for individual classes in my layer or it is for the entire layer? For
> example, for my geomorphology layer, I have, say 15 classes, namely g1, g2,
> g3 and so on. What should be the content for name block within classes. I
> am leaving it blank. Also the URL in icons gives the legend graphic for the
> entire layer (g1, g2...).
>
It depends on how you organize your layers/styles. From what I have seen,
you have a single GetLegendGraphic call that is giving you back a set of
icons (one for each Rule in the style) in a single image. In this use case
you have one layer (Geomorphology) and only one class for the entire layer
(rules are managed server side by GeoServer). This class has only one icon
and no name (the rule names are also contained in the icons image).
Mapfish-print allows you also to build your legend client side, by having a
layer with many classes, each with a label on a side (before or after the
icons) and a set of icons, each with its url.
Regards,
Mauro Bartolomeoli
--
==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.
==
Dott. Mauro Bartolomeoli
@mauro_bart
Senior Software Engineer
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------
|