| 235 | |
| 236 | = Creating a MapGuide WMS Feature Source = |
| 237 | This section describes how to create a MapGuide WMS feature source that will be associated with the configuration document. |
| 238 | == Creating the Feature Source Document == |
| 239 | To create the feature source document, copy the follow XML to a text editor: |
| 240 | |
| 241 | {{{ |
| 242 | |
| 243 | <?xml version="1.0" encoding="utf-8"?> |
| 244 | <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"> |
| 245 | <Provider>OSGeo.WMS</Provider> |
| 246 | <Parameter> |
| 247 | <Name>FeatureServer</Name> |
| 248 | <Value>%WMSService% </Value> |
| 249 | </Parameter> |
| 250 | <ConfigurationDocument>config.xml</ConfigurationDocument> |
| 251 | </FeatureSource> |
| 252 | |
| 253 | }}} |
| 254 | |
| 255 | Replace the %WMSService% with the address of the WMS service. This corresponds to what goes in the Server field of the WMS feature source editor in Studio. |
| 256 | |
| 257 | Save the file. |
| 258 | == Creating the Feature Source in MapGuide == |
| 259 | The next step is to upload the feature source document onto the MapGuide site. The steps to do this are as follows: |
| 260 | 1. Start a web browser and go to the location http://<machinename>/mapguide/mapagent/index.html, where machinename is the location in which MapGuide is installed. |
| 261 | 2. Click on the SetResource link in the left frame. A SETRESOURCE form will appear in the right frame. |
| 262 | 3. In the Resource ID field, type the name of the resource that you want to create. Make sure that the name ends with .FeatureSource. The resource name is case-sensitive. |
| 263 | 4. For the Content field, browse to the feature source XML document that was created in the “Create a feature source document” section. |
| 264 | 5. Leave the Header field blank. |
| 265 | 6. Click Submit on the SETRESOURCE form. |
| 266 | 7. If you have not authenticated yet with the MapGuide site, a login dialog will appear. Enter the credentials of a MapGuide author or administrator user. |
| 267 | |
| 268 | After completing the steps above, a blank web page will take the place of the SETRESOURCE form. |
| 269 | |
| 270 | = Attaching the Configuration Document = |
| 271 | This section describes how to attach the configuration document created above to the feature source. |
| 272 | 1. Start a web browser and go to the location http://<machinename>/mapguide/mapagent/index.html, where machinename is the location in which MapGuide is installed. Figure 1 above shows how the web page should look. |
| 273 | 2. Click on the SetResourceData link in the left frame. A SETRESOURCEDATA form will appear in the right frame. |
| 274 | 3. In the Resource ID field, type the name of the resource to which you want to add the configuration document. This is the same feature source resource that you created above. The resource name is case sensitive. |
| 275 | 4. Enter config.xml in the Data Name field. |
| 276 | 5. Enter Stream in the Data Type field. |
| 277 | 6. For the Data field, browse to the location of the configuration document that you created above. |
| 278 | 7. Click Submit on the SETRESOURCEDATA form. |
| 279 | 8. If you have not authenticated yet with the MapGuide site, a login dialog will come up. Enter the credentials of a MapGuide author or administrator user. |
| 280 | |
| 281 | After completing the steps above, a blank web page will take the place of the SETRESOURCEDATA form. |
| 282 | |
| 283 | It is generally a good idea to test your uploaded configuration document to ensure that it is valid. The best way to do this is to use the GETRESOURCEDATA operation. If the returned XML does not parse correctly, then you most likely had a problem with the XML that you tried to upload and will have to fix any syntax errors or typos and try again. |
| 284 | |
| 285 | = Use the Feature Source = |
| 286 | After all of the above steps have been done, you can now start Studio and use the feature source to create layer definitions. |
| 287 | |
| 288 | If Studio was running when you created the feature source you may have to refresh the site explorer to make it show up. |
| 289 | |
| 290 | |
| 291 | |