Mapserver Documentation Release 5.2.1
Total Page:16
File Type:pdf, Size:1020Kb
MapServer Documentation Release 5.2.1 The MapServer Team February 08, 2009 CONTENTS 1 About 3 2 An Introduction to MapServer 5 2.1 MapServer Overview ........................................... 5 2.2 Anatomy of a MapServer Application .................................. 6 2.3 Installation and Requirements ...................................... 8 2.4 Introduction to the Mapfile ........................................ 14 2.5 Making the Site Your Own ........................................ 22 2.6 Enhancing your site ........................................... 23 2.7 How do I get Help? ............................................ 25 3 Installation 27 3.1 Compiling on Unix ............................................ 27 3.2 Compiling on Win32 ........................................... 35 3.3 PHP MapScript Installation ....................................... 42 3.4 .NET MapScript Compilation ...................................... 48 3.5 IIS Setup for MapServer ......................................... 53 3.6 Oracle Installation ............................................ 56 4 FAQ 61 4.1 Where is the MapServer log file? .................................... 61 4.2 What books are available about MapServer? .............................. 61 4.3 How do I compile MapServer for Windows? .............................. 61 4.4 What do MapServer version numbers mean? .............................. 61 4.5 Is MapServer Thread-safe? ........................................ 61 4.6 What does STATUS mean in a LAYER? ................................. 63 4.7 How can I make my maps run faster? .................................. 63 4.8 What does Polyline mean in MapServer? ................................ 63 4.9 What is MapScript? ........................................... 64 4.10 Does MapServer support reverse geocoding? .............................. 64 4.11 Does MapServer support geocoding? .................................. 64 4.12 How do I set line width in my maps? .................................. 64 4.13 Why do my JPEG input images look crappy via MapServer? ...................... 64 4.14 Which image format should I use? .................................... 65 4.15 Why doesn’t PIL (Python Imaging Library) open my PNGs? ...................... 65 4.16 Why do my symbols look poor in JPEG output? ............................ 66 4.17 How do I add a copyright notice on the corner of my map? ....................... 66 4.18 How do I have a polygon that has both a fill and an outline with a width? ............... 67 4.19 How can I create simple antialiased line features? ............................ 68 i 4.20 Which OGC Specifications does MapServer support? .......................... 68 4.21 Why does my requested WMS layer not align correctly? ........................ 69 4.22 When I do a GetCapabilities, why does my browser want to download mapserv.exe/mapserv? .... 70 4.23 Why do my WMS GetMap requests return exception using MapServer 5.0? .............. 70 4.24 Where do I find my EPSG code? ..................................... 71 4.25 How can I reproject my data using ogr2ogr? .............................. 71 5 Mapfile 73 5.1 CLASS .................................................. 73 5.2 Expressions ................................................ 76 5.3 FEATURE ................................................ 81 5.4 FONTSET ................................................ 82 5.5 INCLUDE ................................................ 83 5.6 GRID ................................................... 84 5.7 JOIN ................................................... 85 5.8 LABEL .................................................. 90 5.9 LAYER .................................................. 93 5.10 LEGEND ................................................. 99 5.11 MAP ................................................... 99 5.12 OUTPUTFORMAT ........................................... 103 5.13 PROJECTION .............................................. 105 5.14 QUERYMAP ............................................... 107 5.15 REFERENCE .............................................. 107 5.16 SCALEBAR ............................................... 107 5.17 STYLE .................................................. 108 5.18 SYMBOL ................................................ 111 5.19 Cartographic Symbol Construction with MapServer .......................... 112 5.20 Symbology Examples .......................................... 133 5.21 Templating ................................................ 136 5.22 Variable Substitution ........................................... 144 5.23 WEB ................................................... 144 5.24 Notes ................................................... 145 6 MapScript 147 6.1 Introduction ............................................... 147 6.2 SWIG MapScript API Reference .................................... 148 6.3 PHP MapScript .............................................. 184 6.4 Python MapScript Appendix ....................................... 228 6.5 Python MapScript Image Generation .................................. 230 6.6 Mapfile Manipulation .......................................... 233 6.7 Querying ................................................. 236 6.8 MapScript Variables ........................................... 238 7 Data Input 245 7.1 Vector Data ................................................ 245 7.2 Raster Data ................................................ 301 8 Output Generation 313 8.1 AGG Rendering Specifics ........................................ 313 8.2 AntiAliasing with MapServer ...................................... 316 8.3 Dynamic Charting ............................................ 319 8.4 Flash Output ............................................... 323 8.5 HTML Legends with MapServer .................................... 329 8.6 HTML Imagemaps ............................................ 337 8.7 PDF Output ................................................ 340 ii 8.8 SVG ................................................... 345 8.9 Tile Mode ................................................ 352 9 OGC Support and Configuration 357 9.1 WMS Server ............................................... 357 9.2 WMS Client ............................................... 376 9.3 WMS Time ................................................ 383 9.4 Map Context ............................................... 388 9.5 WFS Server ............................................... 395 9.6 WFS Client ................................................ 405 9.7 WFS Filter Encoding ........................................... 408 9.8 SLD .................................................... 415 9.9 WCS Server ............................................... 424 9.10 WCS Use Cases ............................................. 434 9.11 SOS Server ................................................ 439 9.12 MapScript Wrappers for WxS Services ................................. 451 10 Optimization 461 10.1 Mapfile .................................................. 461 10.2 Vector ................................................... 463 10.3 Raster ................................................... 465 10.4 FastCGI .................................................. 466 10.5 Tile Indexes ............................................... 469 11 Utilities 473 11.1 legend .................................................. 473 11.2 msencrypt ................................................ 473 11.3 scalebar .................................................. 475 11.4 shp2img ................................................. 475 11.5 shptree .................................................. 477 11.6 shptreevis ................................................. 478 11.7 sortshp .................................................. 479 11.8 sym2img ................................................. 481 11.9 tile4ms .................................................. 482 11.10 Batch Scripting .............................................. 486 11.11 File Management ............................................. 486 12 CGI 489 12.1 MapServer CGI Introduction ....................................... 489 12.2 mapserv .................................................. 490 12.3 Map Context Files ............................................ 490 12.4 MapServer CGI Controls ......................................... 491 12.5 Run-time Substitution .......................................... 495 12.6 A Simple CGI Wrapper Script ...................................... 497 13 Community Activities 499 13.1 IRC .................................................... 499 13.2 Mailing Lists ............................................... 500 13.3 MapServer Wiki Pages .......................................... 501 13.4 MapServer Service Providers ...................................... 501 14 Development 503 14.1 Sponsors ................................................. 503 14.2 Bug Submission ............................................. 503 14.3 Subversion ................................................ 504 iii 14.4 Documentation Development Guide ................................... 505 14.5 Testing .................................................. 509 14.6 Request for Comments .......................................... 515 14.7 Mapfile Editing .............................................. 655 14.8 External Links .............................................. 657 15 Glossary 659 16 Errors 663 16.1 drawEPP(): EPPL7 support is not available ..............................