[fdo-users] RE: [mapguide-users] Advanced WMS provider configuration

Jason Birch Jason.Birch at nanaimo.ca
Fri Apr 13 16:54:16 EDT 2007


Hi Chris,

It looks like the config file editor in Studio either doesn't work
properly for WMS, or I'm doing something wrong.  I've made it past this
but run into another roadblock.  I'll outline my steps so far though.

The MapAgent API test pages are required for this process.  The default
location for these is:
http://localhost:8008/mapguide/mapagent/index.html

Here's a quickie overview:

The WMS Data Connection is actually known as a FeatureSource in the
MapGuide repository, and is stored as a Resource.  To find the
ResourceID for your WMS data connection, log into the above URL and run
the EnumerateResources call.  The most recently added resources are
generally at the bottom of the list.  In my case, the ResourceID for my
FeatureSource was "Library://NASA_WMS.FeatureSource"

All resources have a ResourceHeader (which defines what type of content
they contain - we don't have to care about this) and a ResourceContent
(which contains information describing the resource, in this case the
connection parameters).  These can be viewed by clicking on the
appropriate links in the lower-left pane:  GetResourceHeader and
GetResourceContent.  Fill in your ResourceID and click on Submit.

For my WMS resource, the ResourceContent looks like:

<?xml version="1.0" encoding="utf-8"?>
<FeatureSource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xsi:noNamespaceSchemaLocation="FeatureSource-1.0.0.xsd">
  <Provider>OSGeo.WMS</Provider>
  <Parameter>
    <Name>FeatureServer</Name>
    <Value>http://wms.jpl.nasa.gov/wms.cgi</Value>
  </Parameter>
</FeatureSource>

What you need to do to link your configuration document (stored as
ResourceData) with this FeatureSource is to add a line to this resource
content.  The easiest way to do this is to view the source of the above
call, save it to the text file, and then edit it.  You need to add a
ConfigurationDocument element to the ResourceContent, making it look
something like this:

<?xml version="1.0" encoding="utf-8"?>
<FeatureSource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xsi:noNamespaceSchemaLocation="FeatureSource-1.0.0.xsd">
  <Provider>OSGeo.WMS</Provider>
  <Parameter>
    <Name>FeatureServer</Name>
    <Value>http://wms.jpl.nasa.gov/wms.cgi</Value>
  </Parameter>
  <ConfigurationDocument>config.xml</ConfigurationDocument>
</FeatureSource>

(assuming your configuration XML is called config.xml)

When you have edited this file, use the SetResource call in the MapAgent
API pages.  Fill in your ResourceID, browse for your new ResourceContent
xml file in the Content area, leave the Header area blank, and click on
Submit.

As an aside, users that don't have Studio can upload the config file
through this web interface using the SetResourceData call.

This is where I hit a roadblock.  I've been using the NASA config file
from the unit tests and the server is complaining because it can't
validate the document (can't find FdoDocument.xsd).  I'm wondering if
there is an easy workaround, like uploading the schema document to
MapGuide, but don't have time right now to play with it.

Jason

-----Original Message-----
From: Chris Tweedie
Subject: [fdo-users] Advanced WMS provider configuration

Hi Jason, thanks for the additional info.

I'm still a little confused on the relationship between the config file
attached to the data connection and the mapguide layer. I used the
multi-layer XML example to define multiple layers, however how do i then
create a new mapguide layer based on the custom commands? If i try to
create a layer based off the connection, it simply queries the WMS
featureserver again and gives me a list of the featuretypes as usual?

<Layer name="srtm_mag">
 <Style name="default"/>
</Layer>
<Layer name="global_mosaic">
 <Style name="pseudo"/>
</Layer>

If i can finish this last step it certainly will solve my problems

Chris


More information about the fdo-users mailing list