gis and the internet mapserver application development

19
GIS and the Internet MapServer Application Development

Upload: jane-carson

Post on 16-Dec-2015

220 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: GIS and the Internet MapServer Application Development

GIS and the Internet

MapServer Application Development

Page 2: GIS and the Internet MapServer Application Development

Web Browse Applications

Page 3: GIS and the Internet MapServer Application Development

Web Object

WEBIMAGEPATH pathIMAGEURL urlTEMPLATE file|urlMINSCALEDENOM n (MAXSCALEDENOM)MINTEMPATE file|url (MAXTEMPLATE)ERROR url

EMPTY urlHEADER fileFOOTER file

END

Page 4: GIS and the Internet MapServer Application Development

MapServer Templates...

• Defined in the Web Object• Can be HTML files or fully qualified URLs• HTML files can contain anything including

Javascript or Java• File templates names must end

with .html/.html/.xml/.wml• Substitutions in URL templates are escaped,

this is not the case with file templates

Page 5: GIS and the Internet MapServer Application Development

…MapServer Templates

• Substitution strings delinitiated by [ ]’s

• Substitutions are case sensitive

• Escaped versions are retrieved by appending _esc to the parameter [foo_esc]

• Any parameter passed into the server can be retrieved, that is a variable named foo can be retrieved in template using [foo]

Page 6: GIS and the Internet MapServer Application Development

Zooming

• Use zoom: factors from -25 to 25

• Use zoomsize/zoomdir in combination– zoomsize: factors from 1 to 25– zoomdir: -1, 0 or 1

• Panning default (zoom = 0/1, zoomdir = 0)

Page 7: GIS and the Internet MapServer Application Development

Panning

Image

(0,0)

You can create pan tools(images or text) by simulating mouse clicks outside the image. See IMGXY parameter in the online MapServer CGI reference.

Page 8: GIS and the Internet MapServer Application Development

Maintaining State

• Pass thru CGI vars

• Layer and zoom replacement strings

• Javascript

Examples: [name_select|check][zoom_n_select|check][zoomdir_-1|0|1_select|check]

Page 9: GIS and the Internet MapServer Application Development

Web Query Applications

Page 10: GIS and the Internet MapServer Application Development

Many Modes of MapServer

• All queries are accompanied by a mode change: query, nquery and many others

• Extension of a pan/zoom interface, that is, same form variables are used

• Queries allow you to get at the attributes for a feature(s) and present them via templates

Page 11: GIS and the Internet MapServer Application Development

Extension to Layer/Class Objects

CLASS...TEMPLATE file|url

END

LAYER...HEADER fileFOOTER fileTEMPLATE file|url

END

Page 12: GIS and the Internet MapServer Application Development

Query Mode

• Single result is sought in one or more layers (restrict query using qlayer)

• Uses point input

• Uses layer TOLERANCE to determine success or failure for each feature

• Single template return, as defined in the layer or class object

Page 13: GIS and the Internet MapServer Application Development

nQuery Mode...

• Multiple results are sought in one or more layers (restrict query using qlayer)

• Uses point or area of interest input

• Uses layer TOLERANCE to determine success or failure for each feature

• multiple template return, as defined in several places in the map file

Page 14: GIS and the Internet MapServer Application Development

…nQuery Mode

Template parsing sequence:1) header (web object)

2) layer header (layer object)

3) query template (query object)

-- repeat 3) for each feature --

4) layer footer (layer object)

-- repeat 2) to 4) for each layer --

5) footer (web object)

Page 15: GIS and the Internet MapServer Application Development

Query Templates

• Identical to browse templates in concept• Add substitutions for attribute values, syntax is

[ITEMNAME] and is case sensitive • Attributes are HTML-escaped by default, […_raw]

and […_esc] versions are available• Add substitutions for query result parameters (e.g.

number of results, number of layers)• Access to shape parameters (e.g. bounding box or

centroid)

Page 16: GIS and the Internet MapServer Application Development

Escaping

Let’s say the column NAME contains ‘Lakes & Rivers’:

[NAME] outputs ‘Lakes & Rivers’ [NAME_esc] outputs ‘Lakes%20%26%20Rivers’ [NAME_raw] outputs ‘Lakes & Rivers’

Page 17: GIS and the Internet MapServer Application Development

Other Query Modes

• ItemQuery - identify features based on attribute values (datasource specific)

• Feature{n}Query - identify polygon features to use to select against other layers

• ItemFeature{n}Query - identify polygons using attributes to use against other layers

• IndexQuery - pull features based on a unique id value (not an attribute)

Page 18: GIS and the Internet MapServer Application Development

Query Maps

• Allow visualization of query results

QUERYMAPCOLOR r g bSTATUS ON|OFFSIZE x ySTYLE HILITE|SELECTED|NORMAL

END

Page 19: GIS and the Internet MapServer Application Development

Cached Queries

• Performing query operations can be *very* expensive. It’s possible to cache (i.e. save) a query for future use.

• Set CGI variable “savequery”, creates a .qy file in the temporary directory.

• Retrieve query using CGI variable “queryfile” and process as if the query was done from scratch.