Cover image for Web Mapping Illustrated

Book description

With the help of the Internet and accompanying tools, creating and publishing online maps has become easier and rich with options. A city guide web site can use maps to show the location of restaurants, museums, and art venues. A business can post a map for reaching its offices. The state government can present a map showing average income by area. Developers who want to publish maps on the web often discover that commercial tools cost too much and hunting down the free tools scattered across Internet can use up too much of your time and resources. Web Mapping Illustrated shows you how to create maps, even interactive maps, with free tools, including MapServer, OpenEV, GDAL/OGR, and PostGIS. It also explains how to find, collect, understand, use, and share mapping data, both over the traditional Web and using OGC-standard services like WFS and WMS. Mapping is a growing field that goes beyond collecting and analyzing GIS data. Web Mapping Illustrated shows how to combine free geographic data, GPS, and data management tools into one resource for your mapping information needs so you don't have to lose your way while searching for it. Remember the fun you had exploring the world with maps? Experience the fun again with Web Mapping Illustrated. This book will take you on a direct route to creating valuable maps.

Table of Contents

  1. Web Mapping Illustrated
    1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
    2. A Note Regarding Supplemental Files
    3. Foreword
    4. Preface
      1. Youthful Exploration
      2. The Tools in This Book
      3. What This Book Covers
      4. Organization of This Book
      5. Conventions Used in This Book
      6. Safari Enabled
      7. Comments and Questions
      8. Acknowledgments
    5. 1. Introduction to Digital Mapping
      1. 1.1. The Power of Digital Maps
      2. 1.2. The Difficulties of Making Maps
        1. 1.2.1. Personal Maps
        2. 1.2.2. Technology Barriers
      3. 1.3. Different Kinds of Web Mapping
        1. 1.3.1. Web Map Users
        2. 1.3.2. Web Sites with a Web Mapping Component
          1. 1.3.2.1. Behind the web page
          2. 1.3.2.2. Making your own web mapping site
    6. 2. Digital Mapping Tasks and Tools
      1. 2.1. Common Mapping Tasks
      2. 2.2. Common Pitfalls, Deadends, and Irritations
        1. 2.2.1. Finding Good Source Data
        2. 2.2.2. Dependency on Digital Tools
        3. 2.2.3. Understanding Data Formats
        4. 2.2.4. Using the Right Tools
      3. 2.3. Identifying the Types of Tasks for a Project
        1. 2.3.1. Viewing and Mapping
        2. 2.3.2. Analysis
        3. 2.3.3. Creating and Manipulating
        4. 2.3.4. Conversion
        5. 2.3.5. Sharing
    7. 3. Converting and Viewing Maps
      1. 3.1. Raster and Vector
      2. 3.2. OpenEV
      3. 3.3. MapServer
        1. 3.3.1. Data Access and Performance
        2. 3.3.2. Portability
      4. 3.4. Geospatial Data Abstraction Library (GDAL)
        1. 3.4.1. Raster Formats Supported by GDAL
        2. 3.4.2. Programming Libraries
        3. 3.4.3. GDAL Utilities
      5. 3.5. OGR Simple Features Library
        1. 3.5.1. Vector Formats Supported by OGR
        2. 3.5.2. OGR Utilities and Examples
      6. 3.6. PostGIS
        1. 3.6.1. GIS Analysis with SQL
      7. 3.7. Summary of Applications
    8. 4. Installing MapServer
      1. 4.1. How MapServer Applications Operate
      2. 4.2. Walkthrough of the Main Components
        1. 4.2.1. MapServer Executable
        2. 4.2.2. MapServer's Map File
        3. 4.2.3. Data Sources
        4. 4.2.4. Output Map Image
      3. 4.3. Installing MapServer
        1. 4.3.1. Platforms
        2. 4.3.2. Acquiring MapServer Binaries
          1. 4.3.2.1. Windows versions
          2. 4.3.2.2. Linux binaries
          3. 4.3.2.3. Linux GIS distributions
          4. 4.3.2.4. Linux RPM versions
          5. 4.3.2.5. Debian Linux versions
          6. 4.3.2.6. Mac OS X
        3. 4.3.3. Compiling MapServer Source Code
          1. 4.3.3.1. Downloading sources
          2. 4.3.3.2. Configuring sources
          3. 4.3.3.3. configure options
          4. 4.3.3.4. Dependencies
          5. 4.3.3.5. Making a compile
          6. 4.3.3.6. Installation
          7. 4.3.3.7. A quick test of the install
      4. 4.4. Getting Help
    9. 5. Acquiring Map Data
      1. 5.1. Appraising Your Data Needs
        1. 5.1.1. Vector Maps or Raster Maps?
        2. 5.1.2. What Kind of Vector Data Do You Require?
        3. 5.1.3. What Kind of Raster Data Do You Require?
        4. 5.1.4. What Scale of Map Do You Require?
        5. 5.1.5. Do You Need Three Dimensions?
      2. 5.2. Acquiring the Data You Need
        1. 5.2.1. Finding Premade Maps
        2. 5.2.2. Finding Satellite Images or Shaded Surface Maps
        3. 5.2.3. Finding Map Data
    10. 6. Analyzing Map Data
      1. 6.1. Downloading the Demonstration Data
      2. 6.2. Installing Data Management Tools: GDAL and FWTools
      3. 6.3. Examining Data Content
        1. 6.3.1. Viewing Summary Information About Airports
        2. 6.3.2. Viewing Detailed Airport Location Information
        3. 6.3.3. Viewing Statistics About a Satellite Image
      4. 6.4. Summarizing Information Using Other Tools
        1. 6.4.1. Setting Up Processing Tools for Non-GNU Platforms
        2. 6.4.2. Using ogrinfo to List Data in a Shapefile
        3. 6.4.3. Using grep to Show Only the Names of the Airports
        4. 6.4.4. Using wc to Count the Number of Airport Names
        5. 6.4.5. Using sed to Find Specific Patterns in Airport Names
        6. 6.4.6. Use sed to Reformat Print Results
        7. 6.4.7. Using sed to Remove Lines and Trim the Front End of Lines
        8. 6.4.8. Using sort to Create a List of Ordered Elevations
        9. 6.4.9. Using uniq to Summarize Results of Duplicate Lines
        10. 6.4.10. Other Powerful Text-Processing Tools
    11. 7. Converting Map Data
      1. 7.1. Converting Map Data
      2. 7.2. Converting Vector Data
        1. 7.2.1. Geography Markup Language (GML)
        2. 7.2.2. Converting a Shapefile to GML
        3. 7.2.3. Creating a New File with Only a Subset of Point Features
        4. 7.2.4. Putting One Airport to a New Shapefile
        5. 7.2.5. Converting Shapefiles to Other File Formats
        6. 7.2.6. Converting to a PostgreSQL Database
      3. 7.3. Converting Raster Data to Other Formats
        1. 7.3.1. Translating an Image to Another Format
        2. 7.3.2. Using gdal_translate to Create a JPEG Preview of a Satellite Image
        3. 7.3.3. Clipping an Area of Interest and Creating a Small JPEG of a Satellite Image
    12. 8. Visualizing Mapping Data in a Desktop Program
      1. 8.1. Visualization and Mapping Programs
        1. 8.1.1. Other Open Source Mapping Programs
        2. 8.1.2. Other Free-to-Use Programs
        3. 8.1.3. Other Commercial Programs
      2. 8.2. Using OpenEV
        1. 8.2.1. Installing OpenEV
        2. 8.2.2. Loading Sample Map Data into OpenEV
        3. 8.2.3. Open the Airports Shapefile
        4. 8.2.4. Using the Layers Window
        5. 8.2.5. Changing General Layer Settings
        6. 8.2.6. Changing Draw Styles for Layers
        7. 8.2.7. Adding More Data to the View
      3. 8.3. OpenEV Basics
        1. 8.3.1. Zooming
        2. 8.3.2. Panning
        3. 8.3.3. Color Theming
        4. 8.3.4. Loading a Raster
        5. 8.3.5. Reprojecting Data to Match Another Layer
        6. 8.3.6. Creating a 3D View
          1. 8.3.6.1. Preparing the Digital Elevation Model
          2. 8.3.6.2. Preparing the drape image
          3. 8.3.6.3. Initiating the 3D view
          4. 8.3.6.4. Navigating the 3D view
    13. 9. Create and Edit Personal Map Data
      1. 9.1. Planning Your Map
        1. 9.1.1. Choosing a General Scale and Extent
        2. 9.1.2. Identifying Data Requirements for Your Base Map
        3. 9.1.3. What Are Your Sources?
          1. 9.1.3.1. GPS
          2. 9.1.3.2. Air photo interpretation
          3. 9.1.3.3. Derived products
          4. 9.1.3.4. Local knowledge
      2. 9.2. Preprocessing Data Examples
        1. 9.2.1. Clipping Out an Area of Interest
        2. 9.2.2. Starting to Draw Your Map Features
          1. 9.2.2.1. Mapping locations of interest (point data)
          2. 9.2.2.2. Creating and saving tabular attributes
          3. 9.2.2.3. Mapping roads and transportation paths (linear datalinear data
          4. 9.2.2.4. Mapping regions of interest (area/polygons data)
    14. 10. Creating Static Maps
      1. 10.1. MapServer Utilities
      2. 10.2. Sample Uses of the Command-Line Utilities
        1. 10.2.1. Acquire Some Mapping Data
        2. 10.2.2. Creating a Simple MapServer Map File
        3. 10.2.3. Map File Rules and Recommendations
        4. 10.2.4. Creating Your First Map Image
        5. 10.2.5. Adding Labels to the Map
        6. 10.2.6. Determining the Extent of a Country
        7. 10.2.7. Color Theming the Map
        8. 10.2.8. Understanding Operators
        9. 10.2.9. Creating a Map Legend
        10. 10.2.10. Adding a Scale Bar Using the scalebar Command
        11. 10.2.11. The Final Map File
      3. 10.3. Setting Output Image Formats
    15. 11. Publishing Interactive Maps on the Web
      1. 11.1. Preparing and Testing MapServer
        1. 11.1.1. MapServer for Windows (MS4W)
        2. 11.1.2. MapServer on Linux with Apache
        3. 11.1.3. Configuring Apache
          1. 11.1.3.1. Windows temporary image folder location
          2. 11.1.3.2. Linux temporary image folder location
        4. 11.1.4. Testing and Troubleshooting
          1. 11.1.4.1. Testing mapserv.exe on Windows
          2. 11.1.4.2. Testing mapserv with Apache on Linux
        5. 11.1.5. Testing the MapServer Setup Using a Demo Application
      2. 11.2. Create a Custom Application for a Particular Area
        1. 11.2.1. Changing the Initial Extent of the Map
        2. 11.2.2. Changing the Map Projection
          1. 11.2.2.1. Setting the map and layer projections
          2. 11.2.2.2. Choosing an output map projection
          3. 11.2.2.3. EPSG projection codes versus project details
          4. 11.2.2.4. Modifying the map extent
        3. 11.2.3. Modifying Image Size to Better Fit the Extent of the Map
        4. 11.2.4. Adding Zoom and Recenter Tools to the Web Page
        5. 11.2.5. Adding a List of Layers to Choose From
        6. 11.2.6. Adding a Legend to the Application
          1. 11.2.6.1. Removing the embedded legend from the map file
          2. 11.2.6.2. Adding the legend graphic to the web page
          3. 11.2.6.3. Adding a link to the legend image
        7. 11.2.7. Adding a Scale Bar to the Application
        8. 11.2.8. Adding an Overview/Reference Map to the Application
      3. 11.3. Continuing Education
    16. 12. Accessing Maps Through Web Services
      1. 12.1. Web Services for Mapping
      2. 12.2. What Do Web Services for Mapping Do?
        1. 12.2.1. Why Use These Services?
        2. 12.2.2. Internal Versus External Needs
      3. 12.3. Using MapServer with Web Services
        1. 12.3.1. Web Map Service (WMS)
          1. 12.3.1.1. Checking the capabilities of a WMS provider
          2. 12.3.1.2. Manually requesting a map from a WMS source
          3. 12.3.1.3. Adding a WMS layer to a MapServer map file
          4. 12.3.1.4. Using MapServer as a WMS server
          5. 12.3.1.5. Checking your own WMS capabilities document
        2. 12.3.2. Web Feature Service (WFS)
          1. 12.3.2.1. Checking the capabilities of a WFS provider
          2. 12.3.2.2. Manually requesting data from a WFS source
          3. 12.3.2.3. Adding a WFS layer to a MapServer map file
          4. 12.3.2.4. Using MapServer as a WFS server
          5. 12.3.2.5. Checking your own WFS capabilities document
      4. 12.4. Reference Map Files
    17. 13. Managing a Spatial Database
      1. 13.1. Introducing PostGIS
      2. 13.2. What Is a Spatial Database?
        1. 13.2.1. Server-Based GIS
      3. 13.3. Downloading PostGIS Install Packages and Binaries
        1. 13.3.1. PostGIS for Windows
        2. 13.3.2. PostGIS for Linux
          1. 13.3.2.1. RPM packages
          2. 13.3.2.2. Debian packages
        3. 13.3.3. PostGIS for Mac OS X
      4. 13.4. Compiling from Source Code
      5. 13.5. Steps for Setting Up PostGIS
        1. 13.5.1. Getting PostgreSQL Up and Running
        2. 13.5.2. Enabling pl/pgsql Language Support
        3. 13.5.3. Loading the postgis.sql Script
        4. 13.5.4. Loading the spatial_ref_sys.sql Script
        5. 13.5.5. Testing PostGIS Functionality
      6. 13.6. Creating a Spatial Database
      7. 13.7. Load Data into the Database
        1. 13.7.1. Using shp2pgsql
        2. 13.7.2. Using ogr2ogr
      8. 13.8. Spatial Data Queries
        1. 13.8.1. Building Spatial Indexes
        2. 13.8.2. Critical Tabular Indexes
        3. 13.8.3. Querying for Spatial Proximity
          1. 13.8.3.1. Find the county for a given point
          2. 13.8.3.2. Querying for nearby county polygons
          3. 13.8.3.3. Planning to visualize query results
      9. 13.9. Accessing Spatial Data from PostGIS in Other Applications
        1. 13.9.1. Exporting PostGIS Data into a Shapefile or GML
        2. 13.9.2. Viewing PostGIS Data in OpenEV
        3. 13.9.3. Viewing PostGIS Data in MapServer
          1. 13.9.3.1. Highlighting a subset of shapes
          2. 13.9.3.2. Using subqueries for more complex SQL
          3. 13.9.3.3. Using PostGIS attributes to draw labels
        4. 13.9.4. Using PostGIS in Other Applications
          1. 13.9.4.1. ArcMap and PostGIS
    18. 14. Custom Programming with MapServer's MapScript
      1. 14.1. Introducing MapScript
      2. 14.2. Getting MapScript
        1. 14.2.1. Building MapScript from Source Code
        2. 14.2.2. Obtaining Binary Versions of MapScript
        3. 14.2.3. Getting Help
      3. 14.3. MapScript Objects
      4. 14.4. MapScript Examples
        1. 14.4.1. Opening the Map File and Drawing the Map
        2. 14.4.2. Manipulating Map Settings
        3. 14.4.3. Creating a Map File from Scratch
      5. 14.5. Other Resources
      6. 14.6. Parallel MapScript Translations
    19. A. A Brief Introduction to Map Projections
      1. A.1. The Third Spheroid from the Sun
        1. A.1.1. Geographic Coordinate System
          1. A.1.1.1. Decimal degrees versus degrees minutes seconds
        2. A.1.2. Map Projections: Flattening the Spheroid
        3. A.1.3. Planar/Projected Coordinate System
      2. A.2. Using Map Projections with MapServer
        1. A.2.1. EPSG Codes
          1. A.2.1.1. EPSG versus epsg
      3. A.3. Map Projection Examples
        1. A.3.1. Simple Cylindrical Projection
          1. A.3.1.1. MapServer syntax
        2. A.3.2. Orthographic Projection
          1. A.3.2.1. MapServer syntax
        3. A.3.3. Mercator Projection
          1. A.3.3.1. MapServer syntax
        4. A.3.4. Transverse Mercator Projection
          1. A.3.4.1. MapServer syntax
        5. A.3.5. Albers Equal Area Projection
          1. A.3.5.1. MapServer syntax
        6. A.3.6. Stereographic Projection
          1. A.3.6.1. MapServer syntax
        7. A.3.7. Universal Transverse Mercator Projection
          1. A.3.7.1. MapServer syntax
      4. A.4. Using Projections with Other Applications
      5. A.5. References
    20. B. MapServer Reference Guide for Vector Data Access
      1. B.1. Vector Data
        1. B.1.1. MapServer and Vector Data Access
          1. B.1.1.1. Using OGR
        2. B.1.2. Data Format Types
          1. B.1.2.1. File-based data
          2. B.1.2.2. Directory-based data
          3. B.1.2.3. Database connections
      2. B.2. Data Format Guide
        1. ESRI Shapefiles (SHP)
        1. PostGIS/PostgreSQL Database
        1. MapInfo Files (TAB/MID/MIF)
        1. Oracle Spatial Database
        1. Web Feature Service (WFS)
        1. Geography Markup Language Files (GML)
        1. VirtualSpatialData (ODBC/OVF)
        1. TIGER/Line Files
        1. ESRI ArcInfo Coverage Files
        1. ESRI ArcSDE Database (SDE)
        1. Microstation Design Files (DGN)
        1. IHO S-57 Files
        1. Spatial Data Transfer Standard Files (SDTS)
        1. Inline MapServer Features
        1. National Transfer Format Files (NTF)
    21. About the Author
    22. Colophon
    23. SPECIAL OFFER: Upgrade this ebook with O’Reilly