UMN MapServer Day 3 - PowerPoint PPT Presentation

1 / 48
About This Presentation
Title:

UMN MapServer Day 3

Description:

Main TYPES of map. VECTOR : Shape Files. RASTER : .tiff (geotiff) .jpg (geojpeg) ... Display Thailand map (76 provinces from province shape files with a size of 600 ... – PowerPoint PPT presentation

Number of Views:59
Avg rating:3.0/5.0
Slides: 49
Provided by: Fuji217
Category:
Tags: mapserver | umn | day | map | of | thailand

less

Transcript and Presenter's Notes

Title: UMN MapServer Day 3


1
UMN MapServerDay 3
  • ??.????????? ??????
  • ??????????????

2
Map File
  • Main TYPES of map
  • VECTOR Shape Files
  • RASTER .tiff (geotiff) .jpg (geojpeg)
  • Main UNITS of map
  • Meters
  • Degree

3
Projection
  • Main PROJECTIONS of map
  • UTM (Meters)
  • LAT/LONG (Degree)

4
VECTOR
  • Main FORMAT of VECTOR files
  • Shape Files (.shp .shx .dbf)
  • PostGIS (shp2pgsql pgsql2shp)
  • Main PROJECTIONS of map
  • UTM (Meters)
  • LAT/LONG (Degree)

5
UTM PROJECTIONS in MAP file
PROJECTION "initepsg32647" END EPSG European
Petroleum Survey Group
6
LAT/LONG PROJECTIONS in MAP file
PROJECTION "projlatlong" "ellpsWGS84" "datum
WGS84" END WGS World Geodetic System
7
Exercise 1
  • Display Thailand map (76 provinces from province
    shape files with a size of 600 x 400) on web
    browser using mapserv program installed on Linux
  • Hint
  • Write p01.map
  • URL http//host.ip.address/cgi-bin/mapserv?
    mapp01.map modemap

8
Solution
mkdir /ms4 cd /ms4 mkdir map shp font cp
province. /ms4/shp cp mainroad. /ms4/shp
cd /ms4/shp ogrinfo summary province.shp
province
9
INFO Open of province.shp' using driver ESRI
Shapefile' successful. Layer name
province Geometry Polygon Feature Count
76 Extent (325216.986118, 620850.237735) -
(1213687.174604, 2263257.070589) Layer SRS
WKT (unknown) PROV_CODE String (2.0) CHANGWAT
String (30.0) PROVINCE String (30.0) TOTAL_MALE
Real (11.0) FEMALE Real (11.0) TOTAL_POP Real
(11.0) HOUSE Real (11.0) VERSION String (10.0)
10
Test for /cgi-bin/mapserv Open Browser ?
Address http//host.ip.address/cgi-bin/mapserv N
o query information to decode. QUERY_STRING is
set, but empty. ? mapserv executable OK
11
(No Transcript)
12
Global
MAP NAME "p01_" SIZE 600 400 IMAGECOLOR 200
200 200 IMAGETYPE png EXTENT ? ltfrom ogrinfogt
13
(No Transcript)
14
CLASS STYLE COLOR 200 200 0
OUTLINECOLOR 0 0 200 END STYLE END CLASS
Test with Browser http//host.ip.address/cgi-bin/
mapserv? map/ms4/map/p01.mapmodemap
layersprovince
15
Exercise 2 Understand STATUS
LAYER STATUS default STATUS on ? STATUS off
?
16
Exercise 3 Display ENGLISH LABEL
  • HINT
  • Write p02.map
  • ogrinfo for ITEMLABEL (English?)
  • LABEL Keyword for LAYER

17
(No Transcript)
18
Exercise 4 Understand LABEL
SIZE 20 ? lterrorgt COLOR ltchangegt OUTLINECOLOR
ltchangegt ANTIALIAS true / false
19
Exercise 5 Display THAI LABEL
  • HINT
  • Write p03.map
  • ogrinfo for ITEMLABEL (Thai?)
  • FONTSET
  • TYPE truetype
  • ENCODING tis-620

20
FONTSET "/ms4/font/font.txt" LAYER ITEMLABEL
ltfrom ogrinfogt CLASS LABEL TYPE
truetype FONT tahoma SIZE 14
COLOR 0 0 200 OUTLINECOLOR 255 255
255 END
21
Exercise 6 Understand FONT
  • FONT arial ?
  • HINT
  • arial.ttf from windows XP
  • /ms4/font/font.txt

22
Exercise 7 ADD a SCALEBAR
p04.map SCALEBAR LABEL COLOR 0 0 0 SIZE
small END ..
23
POSITION ll INTERVALS 3 STATUS embed
SIZE 144 5 TRANSPARENT on UNITS kilometers
BACKGROUNDCOLOR 255 255 0 COLOR 200 0 0
OUTLINECOLOR 0 200 0
24
Exercise 8 Understand SCALEBAR
POSITION ul uc ur cl cc cr ll lc
lr INTERVALS STATUS STYLE TRANSPARENT COLOR OUTLI
NECOLOR
25
Exercise 9 Add mainroad LAYER
  • HINT
  • Write p05.map
  • mainroad.shp .shx .dbf
  • ogrinfo
  • GEOMETRY
  • LABELITEM

26
INFO Open of mainroad.shp' using driver
ESRI Shapefile' successful. Layer name
mainroad Geometry Line String Feature Count
1678 Extent (367142.016677, 634730.632421) -
(1205442.781576, 2260880.004434) Layer SRS
WKT (unknown) ID Real (11.0) TNAME String
(120.0) ENAME String (120.0) ROUTE_NO String
(8.0) CLASS Integer (6.0) LENGTH Real
(31.15) VERSION Real (6.2)
27
(No Transcript)
28
  • Problems
  • Mainroad Labels overcrowded
  • Province Labels disappeared
  • Solution
  • Use MAXSCALE to control LABEL
  • To know SCALE ? use TEMPLATE to show scale in
    modebrowse

29
Add TEMPLATE in MAP file (p06.map) .. WEB
IMAGEPATH "/ms4/tmp/" IMAGEURL "/tmp/"
TEMPLATE "p06-templ.html" END ..
30
P06-templ.html (Version 1) lthtmlgt ltbodygt lttable
border'1' width'600'gt lttrgt ltthgtltimg
src'img' width'600' height'400'/gtlt/thgt lt/tr
gt lt/tablegt lt/bodygt lt/htmlgt
31
P06-templ.html (Version 2) lthtmlgt ltbodygt lttable
border'1' width'600'gt lttrgt ltthgtltimg
src'img' width'600' height'400'/gtlt/thgt lt/tr
gt lttrgt ltthgtSCALE scalelt/thgt lt/trgt ..
32
  • Other MAP CGI VARIABLES
  • cellsize
  • center
  • dx dy
  • host
  • mapext_esc
  • mapsize
  • etc

33
(No Transcript)
34
SCALE 11639111.009526
  • HINT
  • Write p07.map
  • ..
  • LABELITEM tname
  • LABELMAXSCALE 5000000
  • ..

35
(No Transcript)
36
advanced-templ.html
37
lthtmlgt ltbodygt ltform method'GET'
action'/cgi-bin/mapserv'gt lttable
width'100'gt lttrgt lttd width'60'gt ltinput
name'img' type'image' src'img'
width'600' height'400' border'2'gt lt/tdgt
lttd width'40' align'left'gt lttable
border'1' width'300'gt lttrgt ltth
colspan'3'gt ltimg src'ref' width'300'
height'200' /gt lt/thgt lt/trgt lttrgt
lttd align'center' colspan'3'gt
ltinput type'submit' value'Refresh'gt
lt/tdgt
38
lt/trgt lttrgt lttd align'center'
colspan'3'gtZOOMlt/tdgt lt/trgt lttrgt
lttd align'right' width'100'gtZoomIn
ltinput type'radio' name'zoomdir'
value'1' zoomdir_1_checkgt
lt/tdgt lttd align'right'
width'100'gtZoomOut ltinput
type'radio' name'zoomdir' value'-1'
zoomdir_-1_checkgt lt/tdgt
lttd align'right' width'100'gtSize
ltinput type'text' name'zoomsize' size'2'
value'zoomsize'gt lt/tdgt
lt/trgt lttrgt
39
lttrgt lttd align'center'
colspan'3'gtPAN ltinput type'radio'
name'zoomdir' value'0'
zoomdir_0_checkgt lt/tdgt lt/trgt
lt/tablegt lthr size'1'gt lttablegt lttrgt
lttd rowspan'2'gt ltimg src'legend' /gt
lt/tdgt lttd colspan'2'gt ltinput
type'checkbox' name'layer' value'mainroad'
mainroad_checkgtMainroad lt/tdgt lt/trgt
40
lttrgt lttd colspan'2'gt ltinput
type'checkbox' name'layer' value'province'
province_checkgtProvince lt/tdgt
lt/trgt lt/tablegt lt/tdgt lt/trgt lt/tablegt ltinput
type'hidden' name'imgxy' value'300
200'gt ltinput type'hidden' name'imgext'
value'mapext'gt ltinput type'hidden' name'map'
value'map'gt lt/formgt lt/bodygt lt/htmlgt
41
Test with http//host.ip.address/cgi-bin/mapser
v? map/ms4/map/ref.mapmodemapzoomsize2
42
  • Make change in p07.map
  • LAYER province
  • STATUS on
  • LAYER mainroad
  • STATUS on

43
Add LEGEND
.. LEGEND STATUS on IMAGECOLOR 200 200
200 LABEL TYPE truetype FONT
tahoma COLOR 0 0 0 SIZE 10
ENCODING tis-620 END END ..
44
  • LEGEND NOT DISPLAYED
  • Solution
  • Add NAME to each CLASS in LAYER

45
  • Add REFERENCE MAP
  • Hint
  • Write p08.map
  • Create a Reference map half size 300x200 using
    shp2img
  • Must be .GIF
  • Must have SAME Extent
  • STATUS on

46
Add REFERENCE MAP Solution cd /ms4/map cp
p01.map ref.map nano ref.map ? Change SIZE
600 400 to 300 200 Test with http//host.ip.addre
ss/cgi-bin/mapserv? map/ms4/map/ref.mapmodemap
47
Add REFERENCE MAP
shp2img ? No such file or directory
updatedb locate shp2img ? /usr/local/src/mapser
ver-4.10.0/shp2img COPY to /usr/local/bin cd
/ms4/map shp2img -m ref.map -i gif -o
ref.gif cp ref.gif /ms4/shp
48
Add Reference
.. REFERENCE IMAGE "/ms4/map/refmap.gif"
SIZE 320 160 EXTENT -180.0 -85.0 180.0
85.0 STATUS ON COLOR -1 -1 -1
OUTLINECOLOR 255 0 0 END ..
Write a Comment
User Comments (0)
About PowerShow.com