MapServer / MapServer-import

3 stars 2 forks source link

[WMS-Server] enable Attribution element in Capabilities XML #1298

Open tbonfort opened 12 years ago

tbonfort commented 12 years ago

Reporter: tomkralidis Date: 2005/03/26 - 21:15

For WMS 1.1.1, Capabilitities XML allows for an optional 'Attribution' element,
which is described as follows:

(from http://schemas.opengeospatial.net/wms/1.1.1/capabilities_1_1_1.dtd)

<!-- Attribution indicates the provider of a Layer or collection of Layers.
The provider's URL, descriptive title string, and/or logo image URL may be
supplied.  Client applications may choose to display one or more of these
items.  A format element indicates the MIME type of the logo image located at
LogoURL.  The logo image's width and height assist client applications in
laying out space to display the logo. -->
<!ELEMENT Attribution ( Title?, OnlineResource?, LogoURL? )>
<!ELEMENT LogoURL (Format, OnlineResource) >
<!ATTLIST LogoURL
          width NMTOKEN #REQUIRED
          height NMTOKEN #REQUIRED>

MapServer's existing metadata directives would already support the inclusion of
Attribution to mapwms.c, leveraging:

wms_service_onlineresource
wms_contactorganization
wms_logourl_href
wms_logourl_format
wms_logourl_width
wms_logourl_height

...when implemented, this will allow MapServer to reuse the existing metadata
and add another element to Capabilities metadata.  Plus, it would provide for
capabilities parsers the ability to display an icon of the WMS, etc.

I have implemented this change in mapwms.c, line 1877.  XML-wise, this change
shows up in the root Layer element, between BoundingBox and ScaleHint.
tbonfort commented 12 years ago

Author: tomkralidis Date: 2005/03/26 - 21:16


...and here's the change to mapwms.c:

  msIO_printf("    <Attribution>\n");
  msOWSPrintEncodeMetadata(stdout, &(map->web.metadata), "MO",
"contactorganization", OWS_WARN, "
 <Title>%s</Title>\n", map->name);

  msOWSPrintEncodeMetadata(stdout, &(map->web.metadata), "MO",
"service_onlineresource", OWS_NOERR,
"  <OnlineResource xmlns:xlink=\"http://www.w3.org/1999/xlink\"
xlink:href=\"%s\"/>\n", script_url_e
ncoded);

  msOWSPrintURLType(stdout, &(map->web.metadata), "MO","logourl",
                             OWS_NOERR, NULL, "LogoURL", NULL,
                             " width=\"%s\"", " height=\"%s\"",
                             ">\n             <Format>%s</Format",
                             "\n             <OnlineResource "
                             "xmlns:xlink=\"http://www.w3.org/1999/xlink\""
                             " xlink:type=\"simple\" xlink:href=\"%s\"/>\n"
                             "          ",
                             MS_FALSE, MS_TRUE, MS_TRUE, MS_TRUE, MS_TRUE,
                             NULL, NULL, NULL, NULL, NULL, "          ");

  msIO_printf("    </Attribution>\n");
tbonfort commented 12 years ago

Author: dmorissette Date: 2005/03/28 - 17:22

Tom, why was <Attribution> created if it's just a duplication of already
existing information? It doesn't make sense to me to just duplicate existing
information only for the sake of providing an <Attribution> element. Should
there not be new metadata items for this new element?
tbonfort commented 12 years ago

Author: tomkralidis Date: 2005/03/29 - 00:57

As per the DTD comments, Attribution exists to specify provider information for
a specific Layer or set of Layer (remember Attribution is available to Layer at
*any* level of nesting).  So, in the spec sense, one use case is that it's there
if one WMS happens to serve layers from multiple data providers.  This would
allow data providers to have attribution :), and the *service* metadata would be
info for the service provider.

What I've seen in implementations is that alot of WMSs are setup so that
Attribution metadata repeats whatever service metadata there is.  Capabilities
parsers can then decipher between the two.

Still, I see what you are saying.  My initial wish for this was to leverage the
LogoURL element of a WMS, which is available in Attribution.  It's a cool way to
 identify WMS servers in client apps, etc.

Perhaps we can enable the following metadata:

wms_attribution_title
wms_attribution_onlineresource
wms_attribution_logourl_href
wms_attribution_logourl_format
wms_attribution_logourl_width
wms_attribution_logourl_height

...then, if defined in WEB/METADATA this would go  in the root Layer element. 
If defined in the LAYER/METADATA element this would get defined in the data
Layer elements.

Of course, this all gets shuffled around when OWS Common rolls into play.  But
that's another story we don't have to worry about for now.

My suggestion, given level of effort and the forthcoming OWS Common would be to
enable this for only root Layer level element.

Comments?
tbonfort commented 12 years ago

Author: tomkralidis Date: 2005/04/06 - 19:43


Here's what the code would look like given the proposal of new metadata (for
WEB/METADATA -> ROOT Layer element) as per comment 3:

  msIO_printf("    <Attribution>\n");

  msOWSPrintEncodeMetadata(stdout, &(map->web.metadata), "MO",
"attribution_title", OWS_WARN, "
 <Title>%s</Title>\n", map->name);

  msOWSPrintEncodeMetadata(stdout, &(map->web.metadata), "MO",
"attribution_onlineresource", OWS_NOERR,
"  <OnlineResource xmlns:xlink=\"http://www.w3.org/1999/xlink\"
xlink:href=\"%s\"/>\n", script_url_encoded);

  msOWSPrintURLType(stdout, &(map->web.metadata), "MO","attribution_logourl",
                             OWS_NOERR, NULL, "LogoURL", NULL,
                             " width=\"%s\"", " height=\"%s\"",
                             ">\n             <Format>%s</Format",
                             "\n             <OnlineResource "
                             "xmlns:xlink=\"http://www.w3.org/1999/xlink\""
                             " xlink:type=\"simple\" xlink:href=\"%s\"/>\n"
                             "          ",
                             MS_FALSE, MS_TRUE, MS_TRUE, MS_TRUE, MS_TRUE,
                             NULL, NULL, NULL, NULL, NULL, "          ");

  msIO_printf("    </Attribution>\n");

If this is okay and can be patched into mapwms.c, I can post some info about
this element and new metadata for documentation.
tbonfort commented 12 years ago

Author: assefa Date: 2005/05/25 - 21:44

Reassigning to me.

I will add the code according to comment #4.
tbonfort commented 12 years ago

Author: assefa Date: 2005/05/26 - 17:03

Tom,

 quick questions on this :

    should there be a test to see if any of the attribution metadata is 
defined before outputing the <Attribution> element. I find it a bit 
inconsistent to output a warning message on the attribution_title metadata 
when the Attribution is not a manadatory element. Here is the xml I get for a 
test wms map file with no attribution metadat defined :

...
    <BoundingBox SRS="EPSG:4326"
                minx="-2" miny="-2" maxx="-1" maxy="6" />
    <Attribution>
<!-- WARNING: Mandatory metadata '..._attribution_title' was missing in this 
context. -->
       <Title>MS</Title>
       <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" 
xlink:href="http://www2.dmsolutions.ca/cgi-bin/mswms_ogc_cite?"/>
    </Attribution>
    <Layer queryable="1" opaque="0" cascaded="0">
    ....
tbonfort commented 12 years ago

Author: tomkralidis Date: 2005/05/26 - 17:09

Yes, there should be a test as it's not a required element.  Can it be processed
/ outputted in the same manner as optional elements?
tbonfort commented 12 years ago

Author: assefa Date: 2005/05/26 - 18:02

I will implement it as the other optional paramters testing if one of the 
attrbution_title/onlineresource/logo exists. 
Only those with a metadata will be outputted. I do not thonk that there is a 
need to use default values if the metadada does not exist (eg map->name for 
the title element). Is this ok ?
tbonfort commented 12 years ago

Author: tomkralidis Date: 2005/05/26 - 18:09

This is ok.
tbonfort commented 12 years ago

Author: assefa Date: 2005/05/26 - 23:23

Added the support : web level metadata needed fot the output are :

 wms/ows_attribution_title
 wms/ows_attribution_onlineresource" 
 wms/ows_attribution_logourl_width" 
 wms/ows_attribution_logourl_height" 
 wms/ows_attribution_logourl_format" 
 wms/ows_attribution_logourl_href"

 Tom if things are ok, i will assign it to jeff for doc update. Also if you 
have some notes you want to add to the doc, please update the bug.
tbonfort commented 12 years ago

Author: tomkralidis Date: 2005/05/26 - 23:41


Tested; works.  Nice!

OK, I'll add some docu to this bug too.  Jeff, you can paraphrase from the WMS
1.1.1 DTD:

<!-- Attribution indicates the provider of a Layer or collection of Layers.
The provider's URL, descriptive title string, and/or logo image URL may be
supplied.  Client applications may choose to display one or more of these
items.  A format element indicates the MIME type of the logo image located at
LogoURL.  The logo image's width and height assist client applications in
laying out space to display the logo. -->

 wms/ows_attribution_title
 wms/ows_attribution_onlineresource
 wms/ows_attribution_logourl_width
 wms/ows_attribution_logourl_height
 wms/ows_attribution_logourl_format
 wms/ows_attribution_logourl_href
tbonfort commented 12 years ago

Author: assefa Date: 2005/05/27 - 00:26

Reassign to Jeff for Documentation update.
tbonfort commented 12 years ago

Author: jmckenna@dmsolutions.ca Date: 2005/06/09 - 19:39

moving to documentation Component
tbonfort commented 12 years ago

Author: jmckenna@dmsolutions.ca Date: 2005/06/11 - 20:39

added attribution metadata to wms-server doc, in CVS.