Title: Internet Maps
1Internet Maps
- John Porter
- University of Virginia
2Internet Maps
- Not surprisingly, mapping tools are increasingly
being found on the Internet - MapQuest and MapBlast trip planning
- Terraserver.microsoft.com aerial photos and
images of maps - However, setting up Internet map tools is not
restricted to large, specialized systems
3Software Choices
- ESRI
- ARC/IMS Internet Map Server
- Restricted to images and shape files
- ARC/SDE Spatial Database Engine
- Requires commercial relational database
- Provides data, not browsing tools
- Mapserver
- Open GIS freely available for UNIX PC
- Displays Shapefiles and selected image formats
4ARC/IMS Architecture
Figure from ESRI documentation
5ARC/IMS Architecture
Figure from ESRI documentation
6Arc/IMS
- Sample ARC/IMS page
- http//wetlands2.nwi.fws.gov/sites/nwi/viewer.htm
- Supports different types of viewers, with
different capabilities - Basic HTML limited, but stable
- Java more flexible, but can be buggy
7Mapserver
8(No Transcript)
9Mapserver
- This is a sample Mapserver application
- Setup consists of two files, plus the shapefiles
and images
10Mapserver Files
- A mapserver application requires two files
- HTML Provides the format for the screen
- May be standard HTML
- May be a template which has special (useful)
properties for map display - MAP Provides the details on the map to be
displayed
11Mapserver HTML
- The most basic way to display a mapserver map is
as an image in HTML - ltimg src"/cgi-bin/mapserv? map/htdocs/mapserver/
northampton/rtf100k.mapmodemap"gt
12Three Parts of the ltIMGgt
- ltimg src"/cgi-bin/mapserv? map/htdocs/mapserver/
northampton/rtf100k.mapmodemap"gt - Name of the Mapserver CGI program
- /cgi-bin/mapserv
- Location of the .map file
- /htdocs/mapserver/northampton/rtf100k.map
- That it should draw the map modemap
13Understanding the .MAP file
- The real instructions are in the .map file. It
needs to tell
- How large should the map be on the screen?
- What area should be displayed?
- e.g. a box with a SE corner of 31o N, 75o W, and
a NW corner of 35o N, 78o W - Where is the data for the map stored on the
server? - What Layers should be displayed?
14Map File Header Information
- comments start with a sign
- First, give a name for this map
- NAME rtf100k
- Specify the lower left and upper right
coordinates - use the units in the shape files (here, UTM)
- EXTENT 407404.0 4101773.0 443331.0 4159444.0
- How big should it display on the screen (in
pixels) - SIZE 400 400
- Where can the shapefiles be found?
- SHAPEPATH "/home/jhp7e/htdocs/northampton/shapefil
es/"
15Specifying Layers
- Layers can be either shapefiles or images. Basic
information is - A name for the Layer
- The name of the associated shapfile or image
- The Type of data (lines, polygons etc.)
- What color should be used?
16Layers - Syntax
- LAYER starts Layer object
- NAME "rtf100k gives name
- DATA rtf100k name of shapefile
- STATUS DEFAULT draw it always
- TYPE LINE line, not polygon
- CLASS start of class object
- COLOR 220 220 220 color as RGB
- END end of class object
- END end of layer object
17Putting it all together!
Sample map of Northampton Co. Roads
18Files used
MAP
HTML
- NAME rtf100k
- EXTENT 407404.0 4101773.0 443331.0 4159444.0
- SIZE 400 400
- SHAPEPATH "/home/jhp7e/htdocs/northampton/shapefil
es/" - LAYER
- NAME "rtf100k"
- DATA rtf100k
- STATUS DEFAULT
- TYPE LINE
- CLASS
- COLOR 255 0 0
- END end of class object
- END end of layer object
- END end of map file
- lth1gtTest Map of rtf100klt/h1gt
- ltimg src"/cgi-bin/mapserv?map/
home/jhp7e/htdocs/mapserver/northampton/rtf100k.ma
p modemap"gt - ltpgtDone!
Note some lines WRAP here that should be on ONE
line
19Controlling Map Displays
- In the previous example, all the lines were one
color - What if we want to use DIFFERENT colors?
- To control colors and symbols, we use multiple
CLASS objects within each LAYER object to select
and define symbols for features or groups of
features
20Example Land cover
CLASSITEM defines the default FIELD to be
examined in the EXPRESSION statement This
EXPRESSION statement selects only those features
where landcover Water The COLOR statements
apply only to this class, thus only Water would
be displayed
- CLASSITEM "landcover"
- CLASS
- NAME "Water"
- EXPRESSION 'Water'
- COLOR 0 0 240
- OUTLINECOLOR 0 0 0
- END
- END
21Expression Statements
- EXPRESSION statements can be more complex
- EXPRESSION (landcover ne Water) and
(nhtm93s3-ID ne 10) - Would select only non-water landcover polygons
and would exclude polygon number 10, even if it
was not water - Field names appear in s to distinguish them
from text or commands
22Expression Statements
- Expressions also can use what are referred to as
regular expressions - Regular expressions are commonly used in UNIX and
LINUX operating systems - The expressions are put between /s
- EXPRESSION /Fore/
- Selects landcovers that start with Fore
- EXPRESSION /S/
- Selects all landcovers that end with S
23Multiple CLASS objects
- CLASSITEM "landcover"
- CLASS water
- NAME "Water"
- EXPRESSION 'Water'
- COLOR 0 0 240
- OUTLINECOLOR 0 0 0
- END
- CLASS grassland
- NAME "Grassland"
- EXPRESSION /Planted/
- COLOR 0 240 0
- OUTLINECOLOR 0 0 0
- END
- CLASS forest
- NAME "Forest"
- EXPRESSION /Forest/
- COLOR 240 240 0
- OUTLINECOLOR 0 0 0
- END
- You can have multiple class objects within a
single layer each defining the display
characteristics for the features they select
24Multiple Layers
- .MAP files can contain multiple layer objects
- They are ordered so that the layers at the END of
the file DISPLAY LAST and thus are ON TOP of
previous layers - This is referred to as LIFO (last in, first out)
25Getting Information
Documentation on all the MAPSERVER map file
commands are available online
- http//mapserver.gis.umn.edu/doc36/mapfile-referen
ce.html
26(No Transcript)
27Interactive Maps
- Thus far, our MapServer maps have been dynamic
(they are generated directly from the data if
the data changes, so do they) but they have not
been interactive (users cant change what is
displayed) - To allow our maps to be interactive, we use what
are called TEMPLATES
28Templates
- Templates
- Typically HTML files
- Contain special codes contained in to specify
the values associated with a map - A mapext code in the file returns the current
map extent - A mapsize code returns the current map size
29(No Transcript)
30(No Transcript)
31Mapserver Help
- Tutorial
- http//terrasip.gis.umn.edu/projects/tutorial35/se
ctions.html - Map Files
- http//mapserver.gis.umn.edu/doc36/mapfile-referen
ce.html - Templates http//mapserver.gis.umn.edu/doc36/temp
late-reference.html - CGI Reference
- http//mapserver.gis.umn.edu/doc36/cgi-reference.h
tml
32HTML Tips
- There are several HTML structures that can be
useful in creating Template files for use with
Mapserver - ltTablegt helps control where things show up on
the screen - ltFormgt - allows you to get input, including
- SELECT
- RADIO buttons
- Checkboxes
33ltTablegt
- Tables consist of ROWS and DATA cells
- ltTRgt - TableRow - marks rows in the table
- ltTDgt - TableData marks cells in the table
- ltTABLEgt
- ltTRgt
- ltTDgtfirst cell contents, lt/TDgt
- ltTDgtsecond cell contents, 1st row lt/TDgt
- lt/TRgt
- ltTRgtltTDgtfirst cell contents, 2nd rowlt/TDgt
- ltTDgtsecond cell contents 2nd rowlt/TDgt
- lt/TRgt
- lt/TABLEgt
34ltFORMgt
- ltFORMgts allow you to pass user input to a program
(in this case, cgi-bin/mapserv) - Common Form Elements in Templates
- ltINPUTgt specifies values
- ltSELECTgt select off a list
35ltINPUTgt
- ltINPUT NAMEfieldnamegt
- Generates an input field for typing in
- However, it is most often used with the hidden
attribute to pass on values - ltINPUT TYPEHIDDEN NAMEcoverfile
VALUEmy_covergt - Sets the value of the coverfile field to
my_cover - It is often used with Template functions to set
values automatically
36Sample INPUT with TEMPLATE
- ltINPUT TYPEhidden NAMEimgext VALUEmapextgt
- Passes the mapextent data as the field mapextent
37ltSELECTgt
- ltSELECTgt allows you to specify a list on the
screen for users to select from - ltSELECT NAMElayergt
- ltOPTION VALUEmylandcovergtLand
Coverlt/OPTIONgt - ltOPTION VALUEhydrolayergtHydrologylt/OPTIONgt
- lt/SELECTgt
38Setting the selection
- If you want to have a default selection, you
can specify it with the word SELECTED in the
OPTION tag - ltSELECT NAMElayergt
- ltOPTION VALUEmylandcover SELECTEDgt Land
Coverlt/OPTIONgt - ltOPTION VALUEhydrolayergtHydrologylt/OPTIONgt
- lt/SELECTgt
- This would select Land Cover (unless changed by
the user)
39Selecting multiple elements
- ltSELECT MULTIPLE NAMElayersgt
- Allows multiple lines to be selected using SHIFT
and CONTROL keys while clicking
40SELECT and Templates
- The mylandcover_select template function
returns SELECTED if mylandcover was selected
in the last display - If it was NOT previously selected, it returns
mylandcover_select, which the web browser just
leaves alone and ignores