Preface

This book provides information about using the GLG Map Server along with its utilities and using the Application Programming Interface (API).

The first four chapters of the book document the Map Server itself, while the last chapter contains a reference and RFC specification of the open vector data format used by the Map Server.

The book contains the following chapters:

GLG Map Server Reference Manual

Introduction
A general overview of the GLG Map Server

Structure of Data and File Layout
A description of how data is organized in the Map Server and how to set it up.

Using the Map Server and Utilities
A description of how to use the Map Server executable and its options

Map Server API
How to use the Map Server from a program

GVF Filters and Data Converters
How to program custom filters and an RFC specification of the GVF format

Index

GLG Map Server Reference Manual

Chapter 1 Introduction 19

1.1 Overview 19

Map Server Executable 20

Tools and Utilities 21

Library Programming Interface 21

1.2 Using the Map Server: Logical Steps 22

Map Server Input: Managing Data 22

Requesting Maps 22

Map Server Output: Displaying a Map 23

GLG GIS Object 23

File Output 23

CGI Output 23

Map Server API 24

Chapter 2 Structure of Data and File Layout 25

2.1 Types of Data 25

Layers 25

Image Data 26

Vector Data 26

Attributes 26

2.2 Datasets, Layers, Tiles and Data 27
2.3 Configuration File Format 28

Datasets 28

GLM ROOT DIR=<dir> 29

LAYER DIR=<dir> 29

FONT DIR=<dir> 29

LAYER=<name> <lif> 29

ALIAS=<name> <value> 29

VECTOR FONT=<font_name> <font_file> 30

FONT=<font_name> <font_file> (Deprecated, use VECTOR FONT) 30

IMAGE FONT=<font_name> <font_file> 30

DEFAULT FONT=<font_name> 30

ERROR FONT=<font_name> 30

REL ZOOM=<0 or 1> 30

ENCODING=<UTF8 or LATIN> 30

ALLOW OVERRIDE=<0, 1 or 2> 30

MAX IMAGE TILES 31

MAX VECTOR TILES 31

A Simple Example of an SDF file 31

Layers and Tiles 31

The Zoom Factor 32

Tiling 32

Configuration Variables 33

TYPE=<type> 33

DEFAULT ON=<0 or 1> 33

TRANS TYPE=<type> 33

TRANS COLOR=<r,g,b> 34

TRANS COLOR PRECISION=<value> 34

ELEVATION MODE=<mode> 34

ALPHA=<value> 35

FILENAME=<file> 35

VECTOR FORMAT=<type> 35

FILTER=<file> 36

IMAGE FORMAT=<format>
IMAGE TYPE=<format> (Deprecated, use IMAGE FORMAT)
36

IMAGE ANTIALISING=<0 or 1> 36

FALLBACK LAYER=<layer name> 36

FALLBACK=<file>
Deprecated: use FALLBACK LAYER above
37

MAX TILES=<number> 37

MAX CACHE SIZE=<number> 37

NUM TILES X=<number> 37

NUM TILES Y=<number> 37

MIN PIXEL SIZE=<number> 37

CLIP=<0 or 1> 38

VOLATILE=<0 or 1> 38

LOCK FILE=<file> 38

LOCK TIMEOUT=<number> 38

REDIRECT FILE=<file> 38

REDIRECT PREFIX=<directory or prefix> 38

VOLATILE ERRORS=<0 or 1> 39

ALLOW MISSING TILES=<0 or 1> 39

WIDTH=<number> 39

HEIGHT=<number> 39

MIN LON=<number> 39

MIN LAT=<number> 39

MAX LON=<number> 39

MAX LAT=<number> 39

MIN ZOOM=<number> 40

MAX ZOOM=<number> 40

GRID LAT INTERVAL=<number> 40

GRID LON INTERVAL=<number> 40

GRID MIN LON=<number> 40

GRID MIN LAT=<number> 40

GRID MAX LON=<number> 40

GRID MAX LAT=<number> 40

ADAPTIVE GRID=<number>
ADAPTIVE=<number> (Deprecated, use ADAPTIVE GRID)
40

GRID LABELS=<0, 1 or 2>
LABELS=<0, 1 or 2> (Deprecated, use GRID LABELS)
40

DECIMAL GRID LABELS=<0 or 1> 40

FONT=<name> 40

FONT SCALE=<number> 41

TEXT TYPE=<type> 41

TEXT ANGLE=<number> 41

TEXT ANCHOR=<type, type> 41

LABEL FORMAT=<format> 42

LABEL STYLE 42

LABEL OUTLINE COLOR 42

TBOX MARGIN=<number> 42

TBOX LINE WIDTH=<number> 43

LABEL MIN ZOOM=<value> 43

LABEL MAX ZOOM=<value> 43
LAYOUT TYPE=<value> 43
LABEL PRIORITY=<number> 43
LAYOUT MARGIN=<number> 43

MARKER ICON FILE=<file> 43

MARKER ICON TYPE=<type, type, ...> 44

MARKER ICON SIZE=<number> 44

MARKER MARGIN=<number> 44

FILL COLOR=<r,g,b> 44

EDGE COLOR=<r,g,b> 44

MARKER EDGE COLOR=<r,g,b> 44

MARKER FILL COLOR=<r,g,b> 44

LABEL COLOR=<r,g,b> 45

BOX EDGE COLOR=<r,g,b> 45

BOX FILL COLOR=<r,g,b> 45

FILL TYPE=<type> 45

LINE WIDTH=<number> 45

POS RANGE=<0 or 1> 45

POLY LABEL FORMAT=<format> 45

POLY LABEL TYPE=<type> 45

POLY LABEL CENTER=<number> 46

ALLOW OVERRIDE=<0 or 1> 46

ATTR MAP=<number resource threshold_table REL/ABS> 46

PIXEL MAP=<number resource threshold_table REL/ABS> 48

CUSTOM ATTR=<number resource data_type> 48

INCLUDE=<file> 48

TILES SUBLIF=<top-level sublif file>
SUBLIF DIR=<directory>
SUBLIF FILE=<sublif file>
49

Chapter 3 Using the Map Server and Utilities 51

3.1 Map Server Executable 51

Error handling 51

Synopsis 52

Description 52

Command Line Options 52

-arg-file <file> 52

-verbosity <number> 52

Map Generation and Queries 52

Synopsis 52

Description 52

Options 53

-dataset <file> 53

-cgi 53

-fcgi 53

-oGISreq <string> 54

-output <file> 54

Map Query String 54

VERSION=<version> 54

REQUEST=<request type> 54

SRS=<value> 55

WIDTH=<number> 55

HEIGHT=<number> 55

BBOX=<min,min,max,max> 55

ANGLE=<number> 56

BGCOLOR=<color> 56

STYLES=<value> 56

FORMAT=<image format> 56

LAYERS=<list> 56

CENTER=<lon,lat> 57

EXTENT=<x,y> 57

STRETCH=<0 or 1> 57

IERRORS=<0 or 1> 57

IMAGE_ANTIALIASING=<0 or 1> 58

QUERY_LAYERS=<layer name> 58

INFO_TYPE=<info type> 58

INFO_FORMAT=<info format> 58

I=<number> 58

J=<number> 58

LON_LAT=<lon,lat> 58

Attribute Condition Syntax 58

Examples of Attribute Conditions 59

Examples of OpenGIS map query strings 59

Examples of coordinate conversion and elevation queries 61

Coordinate Conversion Query 61

Elevation Query for a Lat/Lon location 62

Elevation Query for an X/Y image point 63

3.2 Tools and Utilities 63

Converting GVF ASCII and BINARY Files 64

Synopsis 64

Description 64

Options 64

-convert 64

-a 64

-b 64

-path <directory> 64

-pattern <file_name_pattern> 64

Examples 65

Merging Vector Data Files 65

Synopsis 65

Description 65

Options 65

-merge 65

-output <file> 65

-filter <file> 65

-a 65

-b 65

Examples 66

Bounding Box Extraction Utility 66

Synopsis 66

Description 66

Examples 66

Tiling Utility for Image and Vector Data 66

Synopsis 66

Description 66

Options 66

-tile 67

-image 67

-vector 67

-filename <file> 67

-template <string> 67

-num-x-tiles <number> 67

-num-y-tiles <number> 67

Image Tiling Options 67

-elevation 67

Vector Data Tiling Options 67

-filter <file> 67

-neg-range 68

-pos-range 68

-no-range 68

-custom-range 68

-min-wlon <number> 68

-max-wlon <number> 68

-gvf-extent 68

-world-extent 68

-min-lat <number> 69

-max-lat <number> 69

-min-lon <number> 69

-max-lon <number> 69

-a 69

-b 69

Examples 69

Splitting Vector Data 70

Synopsis 70

Description 70

Options 71

-split 71

-filename <file> 71

-output <file> 71

-filter <file> 71

-attr <conditions> 71

-invert-attr <index> 72

-bbox 72

-min-lat <number> 72

-max-lat <number> 72

-min-lon <number> 72

-max-lon <number> 72

-num-x-tiles <number> 72

-num-y-tiles <number> 72

-num-points <number> 72

-neg-range 72

-pos-range 72

-no-range 73

-custom-range 73

-min-wlon <number> 73

-max-wlon <number> 73

Examples: 73

Slimming Utility for Vector Data 74

Synopsis 74

Description 74

Options 74

-slim 74

-filename <file> 74

-output <file> 74

-resolution <dir> 74

-a 74

-b 74

Examples 74

Shapefile Conversion Utility 75

Synopsis 75

Description 75

Options 75

-shp2gfv 75

-show-attrs 75

-output <file> 75

-pattern <pattern> 75

-r 76

-a 76

-b 76

-all-attrs 76

-no-attrs 76

-attr <index> 76

-marker-label-attr <index> 76

Examples 76

Hierarchical Tile Parsing (Advanced) 77

Synopsis 77

Description 77

Options 78

-lif 78

-vector 78

-image 78

-path <dir> 78

-pattern <pattern> 78

-out-lif-name <filename> 79

Examples 79

Image and Elevation Data Import (Advanced) 80

Synopsis 80

Description 80

Options 81

-verbosity <level> 81

-info-only 81

-write-image 81

-elevation 81

-shadow 81

-slf 82

-out-format <format> 82

-out-ext <extension> 82

-postfix <extension> 82

-pattern <pattern> 82

-r 82

-u 82

-k 82

-f 82

-dont-emboss 82

Examples 83

Chapter 4 Map Server API 85

4.1 Overview 85

Resources 85

4.2 Basic Structure of a Mapping Application 86

DatasetName D 86

Projection D 86

CenterLon D 86

CenterLat D 86

VExtent D 87

HExtent D 87

AngleD 87

Width D 87

Height D 87

Stretch D 87

Background G 87

ImageAntiAliasing D 87

ImageErrors D 87

Verbosity D 87

Code Example 88

4.3 Linking with the Map Server Library 89

X Windows 90

Microsoft Windows 90

Using Static Libraries 90

Using DLLs 90

Include Files 91

4.4 Advanced features of the GLG Map Server API 91

Overview 91

Hierarchy of GlmObjects 91

Modifying Layers 91

Creating Datasets 92

Dataset Resources 92

GlmRoot S 92

LayerPath S 92

FontPath S 92

RelativeZoom D 93

Encoding D 93

AllowOverride D 93

MaxImageTiles D 93

MaxVectorTiles D 93

DefaultFont S 93

ErrorFont S 93

Layer Resources 93

LayerType D 93

IsDefault D 93

TransType D 93

TransColor G 94

TransColorPrecision D 94

ElevationMode D 94

Alpha D 94

ImageAntiAliasing D 94

MaxTiles D 94

MaxCacheSize D 94

MinPixelSize D 94

Clip D 95

LockTimeout D 95

Width D 95

Height D 95

MinLon D 95

MinLat D 95

MaxLon D 95

MaxLat D 95

MinZoom D 95

MaxZoom D 95

GridLatInterval D 95

GridLonInterval D 95

GridMinLon D 95

GridMinLat D 95

GridMaxLon D 96

GridMaxLat D 96

AdaptiveGrid D 96

GridLabels D 96

DecimalGridLabels D 96

TextFont S 96

TextType D 96

FontScale D 96

TextAngle D 96

TextAnchor D 96

LabelFormat S 97

LabelStyle D 97

LabelOutlineColor G 97

TextBoxMargin D 97

TextBoxLineWidth=<number> 97

LabelMinZoom D 97

LabelMaxZoom D 97

LayoutType D 97

LabelPriority D 97

LayoutMargin D 98

MarkerIconFile S 98

MarkerType D 98

MarkerSize D 98

MarkerMargin D 98

FillType D 98

LineWidth D 98

FillColor G 98

EdgeColor G 98

MarkerFillColor G 98

MarkerEdgeColor G 99

LabelColor G 99

BoxEdgeColor G 99

BoxFillColor G 99

PolyLabelFormat S 99

PolyLabelType D 99

PolyLabelCenter D 99

Volatile D 99

VolatileErrors D 99

LockFile S 99

LockTimeout D 99

RedirectFile S 99

RedirectPrefix S 100

FallbackLayer S 100

AllowMissingTiles D 100

AllowOverride D 100

4.5 Function Descriptions 100

GlmInit 100

Parameters 100

GlmCreateDataset 100

Parameters 100

GlmAddLayer 101

Parameters 101

GlmCreateMap 101

GlmSetupMap 101

Parameters 101

GlmSetLayers 102

Parameters 102

GlmResetLayers 102

Parameters 102

GlmEnableLayer 102

Parameters 103

GlmDisableLayer 103

Parameters 103

GlmGetDResource 103

Parameters 103

GlmGetGResource 104

Parameters 104

GlmGetSResource 104

Parameters 104

GlmSetDResource 105

Parameters 105

GlmSetGResource 105

Parameters 105

GlmSetSResource 106

Parameters 106

GlmGetProjection 106

Parameters 106

GlmWriteImage 107

Parameters 107

GlmGetElevation 107

Parameters 107

GlmGetLatLon 108

Parameters 108

GlmGetXYZ 108

Parameters 108

GlmConvert 109

Parameters 109

GlmUpdateMap 110

Parameters 110

GlmResetImageErrors 110

GlmRemoveLayer 110

Parameters 111

GlmDestroyMap 111

Parameters 111

GlmDestroyDataset 111

Parameters 111

GlmTerminate 111

Chapter 5 GVF Filters and Data Converters 113

5.1 GVF API Reference 113

Overview 113

GVF Functions 113

Headers 113

Writing a Filter or Data Convertor 114

Polygons 114

Markers 114

Attributes 115

Points 115

Examples 116

Function Descriptions 116

GvfWriteHeader 116

Parameters 116

GvfWritePolygon 117

Parameters 117

GvfWriteMarker 117

Parameters 118

GvfWriteAttribute 118

Parameters 119

GvfWritePoint 119

Parameters 119

5.2 GVF Format RFC 120

File Extension 120

Definitions 120

ASCII Format 121

Header 121

Body 121

Objects 122

Polygons 122

Ring 122

Number of Points 122

Number of Attributes 122

Markers 122

Marker Type 122

Scale 123

Angle 123

Anchoring 123

Text String 123

Number of Attributes 123

Attributes 123

Data Points 124

Appendix A: Web Server Installation Notes 125

Introduction 125

Unix Notes 125

Windows Notes 125

Perl Notes 126

Map Server Setup on a Web Server 127

Map Server Run-Time Components 127

GlmScript setup 128

FastCGI setup 128

Testing Map Server Setup on a Web Server 129

Introduction

Structure of Data and File Layout

Using the Map Server and Utilities

Map Server API

GVF Filters and Data Converters

Appendix A: Web Server Installation Notes

Index