UMN MapServer - PowerPoint PPT Presentation

1 / 56
About This Presentation
Title:

UMN MapServer

Description:

??????????????? ????????????????????????????????? ... onClick='loadLayers()' ??????? br /form Layer name. ???? Layer. ?????????????? ... – PowerPoint PPT presentation

Number of Views:448
Avg rating:3.0/5.0
Slides: 57
Provided by: Fuji217
Category:
Tags: mapserver | umn | onclick

less

Transcript and Presenter's Notes

Title: UMN MapServer


1
UMN MapServer
  • ??????? ????????
  • ???????????????????????????????????
  • ????????????????????????????

2
UMN MapServer
  • ?????????? ??????????????
  • ??????????????????? ?????????? ??????????????????
  • ??????????????? ?????????????????????????????????
  • ???????? CGI Script ( PHP, Python, Perl, Ruby,
    Java, and C )
  • ?????????????????????
  • ????????????????????????????????????????????
  • ???????????????????????????? ??????? ??????? ???
    ???????
  • ????????????????????? 4.10.2
  • ??????????????? http//mapserver.gis.umn.edu/

3
MapServer Basic Functionality
  • Map Creation
  • Map Component(eg. Legend, Scalbar and reference
    map)
  • Simple feature Query
  • On-the-fly projection
  • Annotation including scaling, rotation, outline
    and drop shadows

4
MapServer Features
  • Advanced cartographic output
  • Scale dependent feature drawing and application
    execution
  • Feature labeling
  • TrueType fonts
  • Map element automation (scalebar, reference map,
    and legend)
  • Thematic mapping using logical- or regular
    expression-based classes
  • Support for popular scripting and development
    environments
  • PHP, Python, Perl, Ruby, Java, and C
  • Cross-platform support
  • Linux, Windows, Mac OS X, Solaris, and more
  • A multitude of raster and vector data formats
  • Map projection support
  • On-the-fly map projection

5
MapServer Input Data Format
  • Raster
  • TIFF, GeoTIFF, PNG, JPEG, GIF
  • GDAL
  • Verctor
  • ShapeFile
  • OGR(MIF, TAB, DGN, ArcInfo, GML)
  • PostGIS, SDE, Oracle Spatial
  • Other
  • OGC

6
MapServer Output Data Format
  • Raster
  • PNG, JPEG, GIF, WBMP
  • Verctor
  • Flash, PDF, GML(WFL)
  • Other
  • OGC WMS

7
System Requirement
  • Operation System
  • Web Server
  • CGI
  • Database

8
MapServer Installation
  • Web Server
  • MapServer 4.10.2
  • Mapscript 4.10 with PHP 5.2.1 and up
  • PostgreSQL 8.1
  • PostGIS

9
MS4W
  • ???????????????????? ms4w_2.2.4.zip
  • unzip ms4w_2.2.4.zip ????? root directory ???
    drive ??????????
  • doubleclick ???apache-install.bat ?????????
    Apache ????????
  • ????????????????????? Apache ??????????????
    D\ms4w\Apache\conf\httpd.conf
  • line 53 Listen 80 ? Listen 8010

10
MapServer Installation
  • For Windows
  • ms4w_2.2.4.zip
  • Web Server Apache 2.2.4
  • PHP 5.2.3 with Mapscript 4.10
  • MapServer 4.10.2
  • PostgreSQL 8.1
  • PostGIS

11
http//localhost8010
12
http//localhost/cgi-bin/mapserv.exe
???????????????? MapServer
13
UMN MapServer
  • ???????? Map File

14
MapServer
15
Map File
MAP
Size, Extent
16
????????????????????? Map File
  • MapFiles ?????????????????(not case-sensitive) 
  • ????????????????????????????????(non-alphanumeric
    characters) ???? MapServer keyword
    ????????????????????????? ( quoted) 
  • ????? Layers ?? Map File ???????????? 50 Layers
    ????????? layers ????????????????? map.h
    ???????????? layer ????????????? MS_MAXLAYERS
    ???? compile
  • File paths ???????????????? absolute paths ????
    paths relative ???????????????????????? Map File
    ???? data files ???????????? relative ???
    SHAPEPATH
  • ???????????? Map File ??????? hierarchical
    structure ????? Map object ???? "root" ???
    objects ????????????????? Map object

17
Map file D\ms4w\Apache\htdocs\day1\ex-01.map
  • MAP
  • NAME HELLO
  • STATUS ON
  • EXTENT 0 0 1 1
  • SIZE 500 300
  • IMAGECOLOR 200 150 255
  • IMAGETYPE png
  • LAYER
  • NAME "credits"
  • TYPE POINT
  • FEATURE
  • POINTS 0 0 END
  • TEXT 'Hello world.'
  • END
  • CLASS
  • END
  • END
  • END

CLASS LABEL TYPE BITMAP COLOR 255
0 0 END end of label END end of class
18
Map file Output
http//localhost/cgi-bin/mapserv.exe ?map./../ht
docs/day1/ex-01.mapmodemap
19
MAP Object
  • General Map Settings
  • NAME  
  • UNITS feetincheskilometersmetersmilesdd 
  • EXTENT minx miny maxx maxy
  • How to get extent
  • - ogrinfo province.shp al -summary
  • - SELECT extent(the_geom) from province
  • STATUS onoff

20
???????? Extent
Quantum GIS Layer - - gtProperties
21
???????? Extent (Vector)
  • ogrinfo
  • ogrinfo filename.shp layername so enter

22
???????? Extent (Vector)
  • PostGIS
  • SELECT extent(the_geom) FROM province

23
???????? Extent (Raster)
  • gdalinfo
  • gdalinfo filename.tifenter

24
???????? Extent
  • ??????? Quantum GIS
  • CD/software/Qgis/qgis-0.8.0_setup.exe
  • FW Tools
  • CD/software/ms4/FWTools105.exe

25
???????? Extent (Vector)
  • ogrinfo
  • ogrinfo d\ms4\shp\province.shp province -
    so enter

26
???????? Extent (Vector)
  • PostGIS
  • SELECT extent(the_geom) FROM province

27
Map file D\ms4w\Apache\htdocs\day1\ex-02.map
  • MAP
  • NAME THAI
  • STATUS ON
  • EXTENT 0 0 4000 3000
  • SIZE 400 300
  • IMAGECOLOR 200 255 255
  • WEB
  • IMAGEPATH /ms4w/apache/htdoc/tmp/
  • IMAGEURL ./../tmp/
  • END
  • LAYER
  • NAME PROVINCE
  • TYPE POLYGON
  • STATUS DEFAULT
  • DATA /ms4/shp/province.shp
  • LABELITEM CHANGWAT
  • CLASS
  • NAME ???????

28
Map file Output
http//localhost/cgi-bin/mapserv.exe ?map./../
htdocs/day1/ex-02.map modemaplayersall
29
Browse Mode
http//localhost/cgi-bin/mapserv.exe ?map./../
htdocs/day1/ex-01.map modebrowselayersal
l
mapserv() Web application error. No template
provided.
30
Browse Mode
MAP NAME HELLO STATUS ON EXTENT -1 -1 1
1 SIZE 400 400 IMAGECOLOR 200 150
255 IMAGETYPE png WEB TEMPLATE
ex-01.html IMAGEPATH
"/ms4w/apache/htdocs/tmp/" IMAGEURL
"./../tmp/" END LAYER ...
... END
31
Browse Mode
http//localhost/cgi-bin/mapserv.exe ?map./../
htdocs/day1/ex-01.map modebrowselayersal
l
Content-type text/html msReturnPage() Unable to
access file. ex-01.html
32
Browse Mode
  • ????? ex-01.html
  • lthtmlgt
  • ltbodygt
  • ltIMG SRCimg BORDER"0"gt
  • lt/bodygt
  • lt/htmlgt

33
Browse Mode
  • msSaveImageGD() Unable to access file.
  • Unable to open file /ms4w/apache/htdocs/tmp/HE
    LLO1189416292664.png for writing
  • ????????????
  • ????? Folder /ms4w/apache/htdocs/tmp/

34
Browse mode
  • ??????????????? Page
  • Rt. Click ?????? -gt Properties
  • ??????? Path ??????
  • IMAGEURL "./../tmp/"

35
MapSurfer
  • MapSurfer http//172.20.26.100/mapsurfer.zip
  • Unzip to /ms4w/Apache/htdocs/

36
http//172.20.26.100/mapsurfer.zip
37
http//localhost8010/mapsurfer/
mapper.html
layers.html
refmap.html
info.html
38
MapSurfer
  • ????? Map File
  • TEMPLATEPATTERN printable.htmlloader.html
  • Web Interface
  • WEB
  • TEMPLATE "printable.html"
  • EMPTY "/mapsurfer/info.html"
  • IMAGEPATH "/ms4w/Apache/htdocs/tmp/"
  • IMAGEURL "./../tmp/"
  • END

39
MapSurfer
  • Mapsurfer/mapper.html
  • Line 21 var mapfile '../htdocs/mapsurfer/test.
    map'
  • Line 22 var extent new Array(325216 ,620850,
    1213687, 2263257)
  • Line 23 var layers new Array('province,
    district')
  • // fullview action
  • Line 41 actions4 'myMap.redraw(new
    Array(325216 ,620850,
  • 1213687, 2263257)) swap(\'fullview\',
    \'fullview_off\')'
  • // socal action
  • Line 43 actions5 'myMap.redraw(new
    Array(412507 ,1517078,594970,1731143))
    swap(\'socal\', \'socal_off\')'

40
MapSurfer
  • Mapsurfer/layers.html
  • ???????????????(Layers)
  • ltform name"layerselect"gt
  • ltinput name"province"
  • typecheckbox checked
  • onClickloadLayers() gt
  • ???????ltbrgt
  • lt/formgt

41
MapSurfer - query map
42
MapSurfer - query map
quake_footer.html
lt/tablegt
43
p.Mapper
  • P.Mapper cd/software/ms4w/pmapper_ms4w-3.1-b4.
    zip
  • Unzip to ms4w
  • Edit /ms4w/apache/httpd/httpd.conf
  • Alias /pmapper "/ms4w/apps/pmapper"
  • ltDirectory "/ms4w/apps/pmapper"gt
  • AllowOverride None
  • Options Indexes FollowSymLinks Multiviews
  • Order allow,deny
  • Allow from all
  • lt/Directorygt
  • Restart service Apache

44
D\ms4w\apps\pmapper\config\default\php_config.php
45
Data Access and Performance
  • Native
  • Shapefile
  • Geo Tiff image
  • PostGIS
  • GDAL/OGR
  • Map
  • etc.

46
MAP Object
  • General Output Settings
  • IMAGETYPE gifpngjpegwbmpgtiffswfuserdefined
  • SIZE x y in pixels  
  • WEB see WEB object

47
WEB Object
  • WEB IMAGEPATH /ms4w/Apache/htdocs/
  •  IMAGEURL "/tmp/" ERROR /ms4w/Apache/htdocs/ms_
    error.htm
  •  EMPTY /ms4w/Apache/htdocs/ms_empty.htm LOG
    /ms4w/Apache/htdocs/logs/mapserver.log
  • END

48
LAYER Object
  • General Layer Settings
  • NAME
  • limited to 20 characters.
  • This name is the link between the MapFile and web
    interfaces that refer to this name.
  • They must be identical.
  • The name should be unique.
  • STATUS onoffdefault
  • TYPE pointlinepolygoncircleannotationraster
    query
  • MINSCALE Minimum scale at which this layer is
    drawn.
  • MAXSCALE Maximum scale at which this layer is
    drawn.
  • CLASSITEM Item name in attribute table to use
  • for CLASS lookups.

49
CLASS Object
  • NAME
  • EXPRESSION
  • String comparisons
  • EXPRESSION water
  • regular expressions
  • EXPRESSION /water/
  • simple logical expressions
  • ,gt,lt,lt,gt,,or,and,lt,gt,ge,le,eq
  • (POPULATION gt 50000 AND 'LANGUAGE' eq
    'FRENCH')
  • string functions
  • EXPRESSION (length('NAME_E') lt 8)

50
CLASS Object
  • COLOR r g b
  • OUTLINECOLOR r g b
  • BACKGROUNDCOLOR r g b

51
Symbols
52
Sample MapFiles
Shape Files LAYER   NAME "Parcels"   STATUS ON  
DATA "surveying/parcels.shp"   TYPE POLYGON  
CLASS       COLOR 255 255 204       OUTLINECOLOR
0 0 0   END END
53
Sample MapFiles
MapInfo Files LAYER NAME "POI TYPE POINT
MINSCALE 0 MAXSCALE 2000 STATUS ON
CONNECTIONTYPE OGR CONNECTION
"..\data\poi.TAB   CLASS   COLOR 255 0
0 END END
54
Sample MapFiles
PostGIS DB LAYER NAME "POI TYPE
POINT MINSCALE 0 MAXSCALE 2000
STATUS ON CONNECTIONTYPE postgis
CONNECTION "userwood dbnameforestry
hostcanada DATA "the_geom from stands"  
    CLASS         COLOR 255 0 0    END
END
55
Sample MapFiles
Raster Files LAYER NAME "POI
TYPE RASTER MINSCALE 0 MAXSCALE
2000 STATUS ON DATA
./../map/school.tif    CLASS        
COLOR 255 0 0    END END
56
??????? PostgreSQLPostGIS
  • CD/software/postgreSQL
  • ??????? PostgreSQL
  • Postgresql-8.2.3-1.zip
  • ??????? PostGIS
  • postgis-pg82-setup-1.2.1-1.exe
  • ?????????????
  • Psql U postgres postgis
  • \i D/ms4/postGIS/province.sql
Write a Comment
User Comments (0)
About PowerShow.com