Opened 19 years ago

Closed 19 years ago

#1298 closed defect (fixed)

[WMS-Server] enable Attribution element in Capabilities XML

Reported by: tomkralidis Owned by: jmckenna@…
Priority: high Milestone: 4.6 release
Component: Documentation - MapServer Version: unspecified
Severity: normal Keywords:
Cc:

Description

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.

Change History (16)

comment:1 by tomkralidis, 19 years ago

...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");

comment:2 by dmorissette, 19 years ago

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?

comment:3 by dmorissette, 19 years ago

Milestone: 4.6 release

comment:4 by tomkralidis, 19 years ago

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?

comment:5 by tomkralidis, 19 years ago

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.

comment:6 by assefa, 19 years ago

Cc: mapserver-bugs@… added
Owner: changed from mapserverbugs to assefa
Reassigning to me.

I will add the code according to comment #4.

comment:7 by assefa, 19 years ago

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">
    ....
 

comment:8 by tomkralidis, 19 years ago

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?

comment:9 by assefa, 19 years ago

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 ?

comment:10 by tomkralidis, 19 years ago

This is ok.

comment:11 by assefa, 19 years ago

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.

comment:12 by tomkralidis, 19 years ago

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

comment:13 by assefa, 19 years ago

Owner: changed from assefa to jmckenna@…
Reassign to Jeff for Documentation update.

comment:14 by jmckenna@…, 19 years ago

Component: WMS ServerMapServer Documentation
moving to documentation Component

comment:15 by jmckenna@…, 19 years ago

Status: newassigned

comment:16 by jmckenna@…, 19 years ago

Resolution: fixed
Status: assignedclosed
added attribution metadata to wms-server doc, in CVS.
Note: See TracTickets for help on using tickets.