Changeset 2812
- Timestamp:
- 02/27/04 09:51:49 (5 years ago)
- Files:
-
- branches/branch-4-0/mapserver_docs/wms-server-howto.xml (modified) (4 diffs)
- trunk/mapserver_docs/wms-server-howto.xml (modified) (31 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/branch-4-0/mapserver_docs/wms-server-howto.xml
r2772 r2812 16 16 </affiliation> 17 17 </author> 18 <date>2004-02- 19</date>18 <date>2004-02-27</date> 19 19 <abstract> 20 20 <!-- a short description of the contents of the doc --> … … 23 23 the use of MapServer v3.5 (and later). 24 24 </para> 25 <para>Last Updated: 2004-02- 19</para>25 <para>Last Updated: 2004-02-27</para> 26 26 </abstract> 27 27 </articleinfo> … … 536 536 MapLab's <ulink url="http://www.maptools.org/maplab/">MapBrowser</ulink> is a web-based WMS client. 537 537 </para> 538 </listitem> 538 </listitem> 539 539 <listitem> 540 540 <para> … … 550 550 <listitem> 551 551 <para> 552 <ulink url="http://cgdi-dev.geoconnections.org/prototypes/owsview/index.html">GeoConnections' OWSVIEW</ulink> is an online application 553 that also allows users to add WMS & WFS layers.</para> 554 </listitem> 552 The <ulink url="http://cgdi-dev.geoconnections.org/prototypes/owsview/index.html">OWSVIEW</ulink> Viewer Client Generator is an online application that allows users to add WMS and WFS layers by validating WMS and WFS Capabilities XML.</para> 553 </listitem> 555 554 </itemizedlist> 556 555 <para> trunk/mapserver_docs/wms-server-howto.xml
r2772 r2812 4 4 <!-- $Id$ --> 5 5 <article> 6 <articleinfo>7 <title>Mapserver WMS Server HOWTO - Version 4.1</title>8 <author>9 <firstname>Jeff</firstname>10 <surname>McKenna</surname>11 <affiliation>12 <orgname>DM Solutions Group Inc.</orgname>13 <address>14 <email>jmckenna@dmsolutions.ca</email>15 </address>16 </affiliation>17 </author>18 <date>2004-02-19</date>19 <abstract>20 <!-- a short description of the contents of the doc -->21 <para>6 <articleinfo> 7 <title>Mapserver WMS Server HOWTO - Version 4.1</title> 8 <author> 9 <firstname>Jeff</firstname> 10 <surname>McKenna</surname> 11 <affiliation> 12 <orgname>DM Solutions Group Inc.</orgname> 13 <address> 14 <email>jmckenna@dmsolutions.ca</email> 15 </address> 16 </affiliation> 17 </author> 18 <date>2004-02-27</date> 19 <abstract> 20 <!-- a short description of the contents of the doc --> 21 <para> 22 22 This document describes the procedures for setting up an OGC compliant Web Map Server (WMS) through 23 23 the use of MapServer v3.5 (and later). 24 24 </para> 25 <para>Last Updated: 2004-02-19</para>26 </abstract>27 </articleinfo>28 <sect1 id="intro">29 <title>Introduction</title>30 <para>25 <para>Last Updated: 2004-02-27</para> 26 </abstract> 27 </articleinfo> 28 <sect1 id="intro"> 29 <title>Introduction</title> 30 <para> 31 31 A WMS (or Web Map Server) allows for use of data from several different servers, and enables for the creation of a 32 32 network of Map Servers from which clients can build customized maps. … … 34 34 Open GIS Consortium's (OGC) Web Map Server Interfaces Implementation Specification v1.1.0</ulink>. 35 35 </para> 36 <para>36 <para> 37 37 MapServer v3.5 or more recent is required to implement WMS features. At the time this document was written, Mapserver 38 38 supports the following WMS versions: 1.0.0, 1.0.7, and 1.1.0 (a.k.a. 1.0.8). 39 39 </para> 40 <para>40 <para> 41 41 This document assumes that you are already familiar with certain aspects of MapServer: 42 42 </para> 43 <itemizedlist>44 <listitem>45 <para>43 <itemizedlist> 44 <listitem> 45 <para> 46 46 MapServer application development and setting up .map files. 47 47 </para> 48 </listitem>49 <listitem>50 <para>48 </listitem> 49 <listitem> 50 <para> 51 51 Familiarity with the WMS spec would be an asset. A link to the WMS specification document is included in 52 52 the <link linkend="links">"WMS-Related Information"</link> section below. 53 53 </para> 54 </listitem>55 </itemizedlist>56 <sect2 id="howitworks">57 <title>How does a WMS Work</title>58 <para>54 </listitem> 55 </itemizedlist> 56 <sect2 id="howitworks"> 57 <title>How does a WMS Work</title> 58 <para> 59 59 WMS servers interact with their clients via the HTTP protocol. In most cases, 60 60 a WMS server is a CGI program. This is also the case with MapServer. 61 61 </para> 62 <para>62 <para> 63 63 The WMS specification defines a number of request types, and for each of 64 64 them a set of query parameters and associated behaviors. A WMS-compliant 65 65 server MUST be able to handle at least the following 2 types of WMS requests: 66 66 </para> 67 <orderedlist>68 <listitem>69 <para>70 <emphasis>GetCapabilities:</emphasis> return an XML document with metadata of the Web Map67 <orderedlist> 68 <listitem> 69 <para> 70 <emphasis>GetCapabilities:</emphasis> return an XML document with metadata of the Web Map 71 71 Server's information 72 72 </para> 73 </listitem>74 <listitem>75 <para>76 <emphasis>GetMap:</emphasis> return an image of a map according to the user's needs.77 </para> 78 </listitem>79 </orderedlist>80 <para>73 </listitem> 74 <listitem> 75 <para> 76 <emphasis>GetMap:</emphasis> return an image of a map according to the user's needs. 77 </para> 78 </listitem> 79 </orderedlist> 80 <para> 81 81 And support for the following types is optional: 82 82 </para> 83 <orderedlist continuation="continues">84 <listitem>85 <para>86 <emphasis>GetFeatureInfo:</emphasis> return info about feature(s) at a query (mouse click)83 <orderedlist continuation="continues"> 84 <listitem> 85 <para> 86 <emphasis>GetFeatureInfo:</emphasis> return info about feature(s) at a query (mouse click) 87 87 location. MapServer supports 3 types of responses to this request: 88 88 </para> 89 <orderedlist>90 <listitem>91 <para>89 <orderedlist> 90 <listitem> 91 <para> 92 92 Text/plain output with attribute info. 93 93 </para> 94 </listitem>95 <listitem>96 <para>94 </listitem> 95 <listitem> 96 <para> 97 97 Text/html output using MapServer query templates specified in the CLASS template parameter. 98 98 The MIME type returned by the Class templates defaults to text/html and can be controlled using the 99 99 metadata <link linkend="mime_type">"wms_feature_info_mime_type"</link>. 100 100 </para> 101 </listitem>102 <listitem>103 <para>101 </listitem> 102 <listitem> 103 <para> 104 104 Gml features. 105 105 </para> 106 </listitem>107 </orderedlist>108 </listitem>109 <listitem>110 <para>111 <emphasis>DescribeLayer:</emphasis> return an XML description of one or more map layers. This106 </listitem> 107 </orderedlist> 108 </listitem> 109 <listitem> 110 <para> 111 <emphasis>DescribeLayer:</emphasis> return an XML description of one or more map layers. This 112 112 applies only to SLD WMS servers and is not currently supported by 113 113 MapServer. 114 114 </para> 115 </listitem>116 </orderedlist>117 <para>115 </listitem> 116 </orderedlist> 117 <para> 118 118 With respect to MapServer specifically, it is the "mapserv" CGI program that 119 119 knows how to handle WMS requests. So setting up a WMS server with MapServer … … 121 121 appropriate metadata in it. This is covered in the rest of this document. 122 122 </para> 123 </sect2>124 <sect2 id="links">125 <title>Links to WMS-Related Information</title>126 <itemizedlist>127 <listitem>128 <para>123 </sect2> 124 <sect2 id="links"> 125 <title>Links to WMS-Related Information</title> 126 <itemizedlist> 127 <listitem> 128 <para> 129 129 The Mapserver WMS Client HOWTO: 130 130 <ulink url="http://mapserver.gis.umn.edu/doc/wms-client-howto.html"> 131 131 http://mapserver.gis.umn.edu/doc/wms-client-howto.html</ulink> 132 </para>133 </listitem>134 <listitem>135 <para>132 </para> 133 </listitem> 134 <listitem> 135 <para> 136 136 Open GIS Consortium (OGC) Home Page: 137 137 <ulink url="http://www.opengis.org/">http://www.opengis.org/</ulink> 138 </para>139 </listitem>140 <listitem>141 <para>138 </para> 139 </listitem> 140 <listitem> 141 <para> 142 142 WMS 1.0.0 specification: 143 143 <ulink url="http://www.opengis.org/docs/00-028.pdf"> 144 144 http://www.opengis.org/docs/00-028.pdf</ulink> 145 </para>146 </listitem>147 <listitem>148 <para>145 </para> 146 </listitem> 147 <listitem> 148 <para> 149 149 WMS 1.1.0 specification: 150 150 <ulink url="http://www.opengis.org/docs/01-047r2.pdf"> 151 151 http://www.opengis.org/docs/01-047r2.pdf</ulink> 152 </para>153 </listitem>154 <listitem>155 <para>152 </para> 153 </listitem> 154 <listitem> 155 <para> 156 156 WMS 1.1.1 specification: 157 157 <ulink url="http://www.opengis.org/docs/01-068r2.pdf"> 158 158 http://www.opengis.org/docs/01-068r2.pdf</ulink> 159 </para>160 </listitem>161 <listitem>162 <para>159 </para> 160 </listitem> 161 <listitem> 162 <para> 163 163 WMS-Dev mailing list and archive: 164 164 <ulink url="http://www.intl-interfaces.net/mailman/listinfo/wms-dev"> 165 165 http://www.intl-interfaces.net/mailman/listinfo/wms-dev</ulink> 166 </para>167 </listitem>168 <listitem>169 <para>166 </para> 167 </listitem> 168 <listitem> 169 <para> 170 170 WMS FAQ: 171 171 <ulink url="http://www.intl-interfaces.net/cookbook/WMS/faq/faqw.py?req=home"> 172 172 http://www.intl-interfaces.net/cookbook/WMS/faq/faqw.py?req=home</ulink> 173 </para>174 </listitem>175 <listitem>176 <para>173 </para> 174 </listitem> 175 <listitem> 176 <para> 177 177 WMS XML Capabilities validator: 178 178 <ulink url="http://www.digitalearth.gov/wmt/xml/validator.html"> 179 179 http://www.digitalearth.gov/wmt/xml/validator.html</ulink> 180 </para>181 </listitem>182 <listitem>183 <para>180 </para> 181 </listitem> 182 <listitem> 183 <para> 184 184 WMS Cookbook: 185 185 <ulink url="http://www.intl-interfaces.net/cookbook/WMS/"> 186 186 http://www.intl-interfaces.net/cookbook/WMS/</ulink> 187 </para>188 </listitem>189 </itemizedlist>190 </sect2>191 </sect1>192 <!-- Section1: Integration or developing an application-->193 <sect1 id="settingup">194 <title>Setting Up a WMS Server Using Mapserver</title>195 <sect2 id="install">196 <title>Install the Required Software</title>197 <para>187 </para> 188 </listitem> 189 </itemizedlist> 190 </sect2> 191 </sect1> 192 <!-- Section1: Integration or developing an application--> 193 <sect1 id="settingup"> 194 <title>Setting Up a WMS Server Using Mapserver</title> 195 <sect2 id="install"> 196 <title>Install the Required Software</title> 197 <para> 198 198 WMS requests are handled by the "mapserv" CGI program. Not all versions of the 199 199 mapserv program do include WMS support (it is included by default when you … … 202 202 use the "-v" command-line switch and look for "SUPPORTS=WMS_SERVER". 203 203 </para> 204 <example>205 <title>On Unix:</title>206 <programlisting>204 <example> 205 <title>On Unix:</title> 206 <programlisting> 207 207 $ ./mapserv -v 208 208 MapServer version 3.5 (pre-alpha) OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP … … 210 210 INPUT=GDAL INPUT=SHAPEFILE 211 211 </programlisting> 212 </example>213 <example>214 <title>On Windows:</title>215 <programlisting>212 </example> 213 <example> 214 <title>On Windows:</title> 215 <programlisting> 216 216 C:\apache\cgi-bin> mapserv -v 217 217 MapServer version 3.5 (pre-alpha) OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP … … 219 219 INPUT=GDAL INPUT=SHAPEFILE 220 220 </programlisting> 221 </example>222 </sect2>223 <sect2 id="mapfile">224 <title>Setup a Mapfile For Your WMS</title>225 <para>221 </example> 222 </sect2> 223 <sect2 id="mapfile"> 224 <title>Setup a Mapfile For Your WMS</title> 225 <para> 226 226 Each instance of WMS server that you setup needs to have its own mapfile. 227 227 It is just a regular MapServer mapfile in which some parameters and some … … 229 229 to produce a valid GetCapabilites output. 230 230 </para> 231 <para>231 <para> 232 232 Here is the list of parameters and metadata items that usually optional with 233 233 MapServer, but are required (or strongly recommended) for a WMS configuration: 234 234 </para> 235 <para>235 <para> 236 236 At the map level: 237 237 </para> 238 <itemizedlist>239 <listitem>240 <para>238 <itemizedlist> 239 <listitem> 240 <para> 241 241 Map NAME 242 242 </para> 243 </listitem>244 <listitem>245 <para>243 </listitem> 244 <listitem> 245 <para> 246 246 Map PROJECTION 247 247 </para> 248 </listitem>249 <listitem>250 <para>248 </listitem> 249 <listitem> 250 <para> 251 251 Map Metadata (in the WEB Object): 252 252 </para> 253 <itemizedlist>254 <listitem>255 <para>253 <itemizedlist> 254 <listitem> 255 <para> 256 256 wms_title 257 257 </para> 258 </listitem>259 <listitem>260 <para>258 </listitem> 259 <listitem> 260 <para> 261 261 wms_onlineresource 262 262 </para> 263 </listitem>264 <listitem>265 <para>263 </listitem> 264 <listitem> 265 <para> 266 266 wms_srs (unless PROJECTION object is defined using "init=epsg:...") 267 267 </para> 268 </listitem>269 </itemizedlist>270 </listitem>271 </itemizedlist>272 <para>268 </listitem> 269 </itemizedlist> 270 </listitem> 271 </itemizedlist> 272 <para> 273 273 And for each layer: 274 274 </para> 275 <itemizedlist>276 <listitem>277 <para>275 <itemizedlist> 276 <listitem> 277 <para> 278 278 Layer NAME 279 279 </para> 280 </listitem>281 <listitem>282 <para>280 </listitem> 281 <listitem> 282 <para> 283 283 Layer PROJECTION 284 284 </para> 285 </listitem>286 <listitem>287 <para>285 </listitem> 286 <listitem> 287 <para> 288 288 Layer Metadata 289 289 </para> 290 <itemizedlist>291 <listitem>292 <para>290 <itemizedlist> 291 <listitem> 292 <para> 293 293 wms_title 294 294 </para> 295 </listitem>296 <listitem>297 <para>295 </listitem> 296 <listitem> 297 <para> 298 298 wms_srs (optional since the layers inherit the map's SRS value) 299 299 </para> 300 </listitem>301 </itemizedlist>302 </listitem>303 </itemizedlist>304 <para>300 </listitem> 301 </itemizedlist> 302 </listitem> 303 </itemizedlist> 304 <para> 305 305 Let's go through each of these paramters in more detail: 306 306 </para> 307 <itemizedlist>308 <listitem>309 <para>307 <itemizedlist> 308 <listitem> 309 <para> 310 310 Map Name and wms_title: 311 311 </para> 312 <para>312 <para> 313 313 WMS Capabilities requires a Name and a Title tag for every layer. The 314 314 Map's NAME and wms_title metadata will be used to set the root layer's … … 316 316 WMS context corresponds to the whole mapfile. 317 317 </para> 318 </listitem>319 <listitem>320 <para>318 </listitem> 319 <listitem> 320 <para> 321 321 Layer Name and wms_title metadata: 322 322 </para> 323 <para>323 <para> 324 324 Every individual layer needs its own unique name and title. 325 325 Layer names are also used in GetMap and GetFeatureInfo requests to refer 326 326 to layers that should be included in the map output and in the query. 327 327 </para> 328 </listitem>329 <listitem id="projection_srs">330 <para>328 </listitem> 329 <listitem id="projection_srs"> 330 <para> 331 331 Map PROJECTION and wms_srs metadata: 332 332 </para> 333 <para>333 <para> 334 334 WMS servers have to advertise the projection in which they are able to 335 335 serve data using EPSG projection codes (see … … 338 338 Recent versions of the PROJ4 library come with a table of EPSG 339 339 initialization codes and allow users to define a projection like this: </para> 340 <programlisting>340 <programlisting> 341 341 PROJECTION 342 342 "init=epsg:4269" 343 343 END 344 344 </programlisting> 345 <para>345 <para> 346 346 (Note that "epsg" has to be in lowercase when used in the PROJ4 'init' directive.) 347 347 </para> 348 <para>348 <para> 349 349 If the MAP PROJECTION block is provided in the format "init=epsg:xxxx" then 350 350 MapServer will also use this information to generate a <BoundingBox> tag for … … 352 352 element of WMS capabilities, but it is good practice to allow MapServer to include it when possible. 353 353 </para> 354 <para>354 <para> 355 355 The above is sufficient for MapServer to recognize the EPSG code and 356 356 include it in SRS tags in the capabilities output (wms_srs metadata is not … … 361 361 definition of the data's projection. 362 362 </para> 363 <para>363 <para> 364 364 Here is an example of a server whose data is in an Lambert Conformal Conic 365 365 projection (for which there is no EPSG code). It's capabilities output … … 367 367 PROJECTION object is set to the real projection that the data is in: 368 368 </para> 369 <programlisting>369 <programlisting> 370 370 NAME DEMO 371 371 ... … … 390 390 ... 391 391 </programlisting> 392 <para>392 <para> 393 393 In addition to EPSG:xxxx projections, a WMS server can advertize projections in the AUTO:xxxx namespace. AUTO projections 42001 to 42005 are internally supported by MapServer. However, AUTO projections are useful only with smart WMS clients, since the client needs to define the projection parameters in the WMS requests to the server. For more information see Annex E of the <ulink url="http://www.opengis.org/docs/01-068r2.pdf">WMS 1.1.1 specification</ulink> and section 6.5.5.2 of the same document. See also the <link linkend="FAQ">FAQ</link> on AUTO projections at the end of this document. 394 394 </para> 395 </listitem>396 <listitem>397 <para>395 </listitem> 396 <listitem> 397 <para> 398 398 Layer PROJECTION and wms_srs metadata: 399 399 </para> 400 <para>400 <para> 401 401 By default in the WMS context, layers inherit the SRS or their parent layer 402 402 (the map's projection in the MapServer case). For this reason it is not … … 404 404 for every layer. 405 405 </para> 406 <para>406 <para> 407 407 However, if your server wants to advertise multiple projections, then at least 408 408 a PROJECTION object is required in every layer, otherwise the layers won't … … 410 410 MapServer. 411 411 </para> 412 <para>412 <para> 413 413 Layer PROJECTION and wms_srs metadata are defined exactly the same way as 414 414 the map's PROJECTION and wms_srs metadata. 415 415 </para> 416 <para>416 <para> 417 417 For vector layers, if a PROJECTION block is provided in the format "init=epsg:xxxx" then 418 418 MapServer will also use this information to generate a <BoundingBox> tag for … … 420 420 element of WMS capabilities, but it is good practice to allow MapServer to include it when possible. 421 421 </para> 422 </listitem>423 <listitem id="wms_onlineresource">424 <para>422 </listitem> 423 <listitem id="wms_onlineresource"> 424 <para> 425 425 The "wms_onlineresource" metadata: 426 426 </para> 427 <para>427 <para> 428 428 The wms_onlineresource metadata is set in the map's web object metadata and 429 429 specifies the URL that should be used to access your server. This is … … 433 433 recommended that you provide the wms_onlineresource metadata. 434 434 </para> 435 <para>435 <para> 436 436 See section 6.2.1 of the <ulink url="http://www.opengis.org/docs/01-047r2.pdf"> 437 437 WMS 1.1.0 specification</ulink> for the whole story about … … 440 440 parameter, and and terminated by "?" or "&". 441 441 </para> 442 <para>442 <para> 443 443 Here is a valid online resource URL: 444 444 </para> 445 <programlisting>445 <programlisting> 446 446 http://my.host.com/cgi-bin/mapserv?map=mywms.map& 447 447 </programlisting> 448 <para>448 <para> 449 449 By creating a wrapper script on the server it is possible to hide the 450 450 "map=" parameter from the URL and then your server's online resource 451 451 URL could be something like: 452 452 </para> 453 <programlisting>453 <programlisting> 454 454 http://my.host.com/cgi-bin/mywms? 455 455 </programlisting> 456 <para>456 <para> 457 457 This is covered in more detail in the section <link linkend="onlineresourceurl"> 458 458 "More About the Online Resource URL"</link> below. 459 459 </para> 460 </listitem>461 </itemizedlist>462 </sect2>463 <sect2 id="test">464 <title>Test Your WMS Server</title>465 <sect3 id="val_capabilities">466 <title>Validate the Capabilities Metadata</title>467 <para>460 </listitem> 461 </itemizedlist> 462 </sect2> 463 <sect2 id="test"> 464 <title>Test Your WMS Server</title> 465 <sect3 id="val_capabilities"> 466 <title>Validate the Capabilities Metadata</title> 467 <para> 468 468 OK, now that we've got a mapfile, we have to check the XML capabilities 469 469 returned by our server to make sure nothing is missing. 470 470 </para> 471 <para>471 <para> 472 472 Using a web browser, access your server's online resource URL to which you 473 473 add the parameter "REQUEST=GetCapabilities" to the end, e.g. 474 474 </para> 475 <programlisting>475 <programlisting> 476 476 http://my.host.com/cgi-bin/mapserv?map=mywms.map&REQUEST=GetCapabilities 477 477 </programlisting> 478 <para>478 <para> 479 479 This should return a document of MIME type application/vnd.ogc.wms_xml, so 480 480 your browser is likely going to prompt you to save the file. Save it and 481 481 open it in a text editor (Emacs, Notepad, etc.) 482 482 </para> 483 <para>483 <para> 484 484 If you get an error message in the XML output then take necessary actions. 485 485 Common problems and solutions are listed in the <link linkend="FAQ">FAQ</link> at the end of this 486 486 document. 487 487 </para> 488 <para>488 <para> 489 489 If everything went well, you should have a complete XML capabilities document. 490 490 Search it for the word "WARNING"... MapServer inserts XML comments starting … … 494 494 otherwise things are likely not going to work. 495 495 </para> 496 </sect3>497 <sect3 id="val_getmap">498 <title>Test With a GetMap Request</title>499 <para>496 </sect3> 497 <sect3 id="val_getmap"> 498 <title>Test With a GetMap Request</title> 499 &nb
