[Mapserver-dev] mapwms.c and mapwfs.c hacks for LegendURL, MetadataURL, and DataURL

Kralidis,Tom [Burlington] Tom.Kralidis at ec.gc.ca
Mon Jul 19 15:31:04 EDT 2004


Hi,

Thought I'd post/share this:

My organization has requirements for the following in OGC Capabilities
documents:

- LegendURL (WMS 1.1.0+, encoded as StyleURL in 1.0.0)
- MetadataURL (WMS 1.1.0+ WFS 1.0.0)
- DataURL (WMS [all versions])

..so I made a hack in the following files to enable this as per below:

mapwms.c: line 591

   /* HACK BEGIN */
   msOWSPrintEncodeMetadata(stdout, &(lp->metadata), NULL,
"wms_metadataurl_href", OWS_NOERR,
                 "        <MetadataURL
type=\"FGDC\">\n\t\t<Format>text/html</Format>\n\t\t<OnlineResource
xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink
:href=\"%s\"/>\n\t</MetadataURL>\n", NULL);

   msOWSPrintEncodeMetadata(stdout, &(lp->metadata), NULL,
"wms_dataurl_href", OWS_NOERR,
                 "
<DataURL>\n\t\t<Format>text/html</Format>\n\t\t<OnlineResource
xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"%s\"/>\n\t
</DataURL>\n", NULL);


   printf("     <Style>\n");
   printf("       <Name>default</Name>\n");
   printf("       <Title>Default</Title>\n");
   printf("       <LegendURL width=\"20\" height=\"10\">\n");
   printf("         <Format>image/png</Format>\n");
   printf("           <OnlineResource
xmlns:xlink=\"http://www.w3.org/1999/xlink\"
xlink:href=\"%sversion=1.1.1&amp;service=WMS&amp;request=GetLegendGraphi
c&amp;layer=%s&amp;format=image/png\"/>\n", msOWSGetOnlineResource(map,
"wms_onlineresource", NULL), lp->name);
   printf("       </LegendURL>\n");
   printf("     </Style>\n");

   /* HACK END */

mapwfs.c: line 379

   /* HACK BEGIN */

   msOWSPrintEncodeMetadata(stdout, &(lp->metadata), NULL,
"wms_metadataurl_href", OWS_NOERR,
                 "        <MetadataURL type=\"FGDC\"
format=\"XML\">%s</MetadataURL>\n", NULL);

   /* HACK END */

As this is a hack, there's most certainly a better way to do this, as
the following info is not integrated/supported:

- wms_legendurl_width and wms_legendurl_height not used/integrated.
There should be a test to test for these in mapfile, if not there, go
with default (20x10?).  I didn't know how to fit more than one mapfile
parameter as an argument in msOWSPrintEncodeMetadata -- is there a way?

- wms_dataurl_format and wms_metadataurl_format not used/integrated.  I
didn't know how to fit more than one mapfile parameter as an argument in
msOWSPrintEncodeMetadata -- is there a way?

..Tom

=========================
Tom Kralidis
Systems Scientist
Environment Canada
Tel: +01-905-336-4409
http://www.ec.gc.ca/





More information about the mapserver-dev mailing list