Открыть Электронные книги
Категории
Открыть Аудиокниги
Категории
Открыть Журналы
Категории
Открыть Документы
Категории
-
( )
551.5:001.891.57
01201180382
.
_________________
..
_31______2013 .
-
()
: 1.1.1.4
... ..
2013
... _______________________..
______________________..
_______________________..
_____________________..
___________________ ..
____________________..
2
113 c., 32 ., 3 ., 16 ,
- , ,
web-
.
, ,
,
. ,
.
3
.................................................................................................................................................................... 3
................................................................................................................................................................. 6
.................................................................................................................................................. 7
1 ............................................................................................................................. 8
1.1 ...................................................................................................................................................... 8
1.2 web- ................................................................................... 9
1.3 web-........................................................................................ 10
1.4 web- .............................................................................. 11
1.5 ............................................................................................... 12
1.6 ............................................................................................................................. 13
1.6.1 ................................................................................................................. 13
1.6.2 ................................................................................................................................. 14
1.6.3 ................................................................................................................................... 17
1.7 ................................................................................................................... 19
1.7.1 ............................................................................................... 19
1.7.2 ...................................................................................................................................... 20
1.7.3 ........................................................................................................ 21
1.8 ............................................................................................................................................................ 24
2 ...................................................................................................... 26
2.1 ......................................................................................................................... 26
2.1.1 WMS ........................................................................................................ 26
2.1.2 ................................................................................................................ 27
2.1.3 .................................................................................................................. 28
2.1.4 .............................................................................................................................................. 30
2.1.5 ......................................................................................................................................... 32
2.2 ................................................................................................................................. 35
2.2.1 ..................................................................................................................... 36
2.2.2 ................................................................................................... 42
2.3 ....................................................................................................... 46
2.4 GeoServer .................................................. 49
2.4.1 .................................................................................................................................. 49
2.4.2 .......................................................................................................... 51
2.5 MapServer.................................................. 53
2.5.1 .................................................................................................................................. 53
2.5.2 .......................................................................................................... 53
2.6 ............................................................................................................................................ 60
4
2.7 ......................................................................................................................... 64
2.8 .............................................................................................................................. 65
2.9 ...................................................................................................................................... 72
3 .............................................................................................................................. 76
3.1 .............................................................................................................................. 76
3.1.1 PostGIS ...................................................................................................................... 77
3.1.2 .......................................................................................................................... 78
3.1.3 ............................................................................................................................. 79
3.1.4 ......................................................................................................................... 80
3.2 ................................................................................................................... 82
3.2.1 WMS- ................................................................................................................. 83
3.2.2 WMS- ................................................................................................................. 88
3.2.3 web- .................................................................................................................. 92
3.2.4 web- ........................................................................................................................... 95
3.2.5 ............................................................................................... 100
3.3 web- ................................................................................................................... 101
3.4 ............................................................................................................................... 103
4 http://sibnigmi.ru........................................................................................ 107
...................................................................................................................................................... 111
............................................................................................. 112
,
- ( ).
,
, (
)
,
, .
.
, Google Maps.
,
, , ,
web- , .
,
Google,
. , Google Maps ,
.
web-
.
, ,
. ,
.
..,
.
6
. :
c web-,
;
(EPSG:4326, EPSG:3576);
, ;
7
1
1.1
.
, , - ,
, , .
.
.
,
( ) .
, , ,
.
( ), ,
. ,
, .
web- ,
.
web-
. Web-
,
. web ,
, . , web-
.
web-
web mapping service ( web-). ,
, , ,
8
, .
web- :
web, ,
, .
1.2 web-
web-
. ,
,
, . ,
, web-:
1.3 web-
,
.
, ,
, RFC .
web-:
Opensource . OSGeo ,
. ,
. , OSGeo,
. Frank
Warmerdam, GDAL/OGR.
. ESRI ,
. ESRI
web-, ArcGIS Server.
(Mapinfo, Autodesk),
-.
10
-. Google ( Microsoft,
Yahoo Yandex), web-
online .
.
. , , .
, (Navteq/Teleatlas),
(GeoEye, DigitalGlobe).
(OpenStreetMap).
1.4 web-
, web-,
OGC. OGC 25
1994 8 . 1992 2004
8 250, OGS ,
,
(
Boeing, Oracle, ESRI, MapInfo, Intergraph, Google
).
OGC
W3C . ,
OGC GML Geography Markup Language
XML, . GML
,
.
11
o
()
;
o
(, );
o
.
o
Geography Markup
Language (GML);
o
HTTP-.
o WMS
;
1.5
:
. ,
, , -
web-. , ,
,
12
, , web-. ,
,
web-.
1.6
, ,
:
- ( GRIB CDF),
;
- (, , );
- , -.
1.6.1
,
GRIB . WGRIB, NCAR Command Language, .
GRIB ,
, ,
. , , ,
.
13
,
, :
GRIB_API - GRIB,
European Centre for Medium-Range Weather Forecasts (ECMWF).
GRIB,
, C, Python, Fortran
90.
G2CLIB GRIB,
National Centers for Environmental Prediction (NCEP).
C, Fortran, Perl Python. GRIB_API,
, ,
, , .
,
G2CLIB .
1.6.2
,
:
.
:
,
.
14
, , .
,
.
.
.
(Google Maps, Yandex Maps .).
. , , , .
( -
ESRI Shapefile, , ,
),
.
, OpenGIS
: Well-Known Text (WKT) Well-
Known Binary (WKB) [1]. WKT WKB
, . (WKT)
:
POINT(0 0)
MULTIPOINT(0 0,1 2)
MULTIPOLYGON(((0 0,4 0,4 4,0 4,0 0),(1 1,2 1,2 2,1 2,1 1)), ((-1 -1,-1 -2,-2 -2,-2 -1,-1 -1)))
15
GEOMETRYCOLLECTION(POINT(2 3),LINESTRING((2 3,3 4)))
, OpenGIS ,
(Spatial Referencing
System Identifier - SRID). SRID .
,
, , .
, , .
Oracle Spatial , , -
. Oracle Spatial
Oracle 11g Enterprise Edition 3D web-
,
, .
, Oracle.
MySQL ,
,
. OpenGIS.
PostGIS - PostgreSQL,
. PostGIS
R-Tree/GiST, .
Refractions Research Inc,
,
OpenGIS.
.
MSSQL , Microsoft. ,
Microsoft SQL Server 2008, .
SQLite Spatial , ,
SQLite. SQLite
-, ,
, . -
16
, , .
,
.
OGR. OGR
, . ,
, .
, OGR
.
, , . OpenGIS
SQL- . , SQLite
OGR, .
, ,
CSV (Comma Separated Values , ).
OGR, .
, . ,
, ,
. , PostGIS.
PostGIS ,
, , -
.
,
, .
1.6.3
,
,
. ,
:
G2CLIB.
PostgreSQL.
17
.
, .
Python , NumPy,
. ,
:
Python
.
.
, , -, ,
-.
, -
.
PyNIO Python,
netCDF, GRIB, HDF, HDFEOS2, CCM, ,
.
NumPy Python,
,
. Python ,
,
, C Java. NumPy
,
. , ,
18
, ,
C.
Psycopg2 , PostgreSQL.
Python DB API 2.0,
Python, .
,
.
1.7
1.7.1
, ,
, .
, ,
. , ,
OGC, . ,
,
. , MapServer MapScript,
MapServer
(PHP, Python, Perl, .NET .).
web-
, ,
. (, MapServer Chameleon, P.mapper, Fusion,
ka-map .), ,
:
.
,
, ,
. , ,
19
, - , ,
.
. -
,
. , ,
,
web- ,
,
.
- ,
.
()
web-,
.
, OGC.
: , , HTTP-
, .
, OGC ,
,
OGC . ,
,
. WMS. ,
.
, ,
(WMS- Google
Maps, Yandex Maps, OpenStreetMap .).
1.7.2
web-,
, :
20
;
WMS;
PROJ.4 [3],
.
.
, ,
, , :
.
: PNG, JPEG, GIF. ,
,
.
.
.
,
.
.
.
.
1.7.3
,
,
, .
21
MapServer
MapServer [4]
web- . , MapServer
NASA, ,
OSGeo. MapServer ( ..
Windows, Linux, Mac OS, Solaris), ,
,
. , MapServer
, (development environment/platform). ,
Windows, MapServer ,
: Apache HTTP Server, PHP, MapScript, GDAL/OGR, PROJ . MapServer
web-.
,
, .
:
Perl, PHP,
Java, C, Python .;
( TrueType
, , , PNG, TIFF, GIF, JPEG
);
C
.
, MapServer
. ,
22
. , ,
.
GeoServer
, GeoServer MapServer, ,
GeoServer, .
web-
, . GeoServer
Geotools , Java.
Java Development Kit (JDK). ,
GeoServer MapServer
. GeoServer
Java
( MapServer)
23
, . MapGuide
Open Source LGPL.
Mapnik
Mapnik .
OpenStreetMap,
. Mapnik .
, Python,
. Mapnik MapServer
. ,
AGG FreeType anti-aliasing. , Mapnik
Google Maps, MapServer.
,
.
.
1.8
.
,
24
, .
,
, :
MapServer GeoServer -
.
25
2
,
: MapServer GeoServer.
.
2.1
,
, ,
. ,
, :
,
,
. , ,
, ,
. ,
, WMS.
2.1.1 WMS
WMS - ,
. , GetFeatureInfo
. ,
.
26
GetFeatureInfo ,
.
,
, , ,
. , Shapefile,
DBF, ,
. , GetFeatureInfo
,
.
2.1.2
Shapefile.
.
, , .
, :
() .
( 160) hdrlin, ;
( 500) crdlin,
.
, poppnt.
, POINT,
GRIB .
, poppnt.
shp2pgsql, GDAL.
convert.sh, SQL-
PostGIS:
for f in *shp
do
name=$(basename $f .shp| tr - _)
27
# $f shp sql
done
2.1.3
. ,
, , ,
. .
, .
, ,
PROJ.4. ,
, ,
,
.
,
(, /) , EPSG:4326.
, EPSG:3576,
, PROJ.4
:
PROJ.4:
MapServer:
PROJECTION
"proj=laea"
"lat_0=90"
"lon_0=90"
"x_0=0"
"y_0=0"
28
"ellps=WGS84"
"datum=WGS84"
"units=m"
"no_defs"
END
PostGIS:
GeoServer:
EPSG:3576
. , ,
EPSG, ,
, .
.
,
,
.
.
, .
, ,
WMS. :
, .
29
, ,
,
.
2.1.4
.
: X; Y;
X; Y.
, .
. ,
(crdlin), .
crdlin.shp, ogrinfo,
GDAL/OGR.
EPSG:4326:
ogrinfo al so crdlin.shp
:
INFO: Open of `crdlin.shp'
GEOGCS["GCS_WGS_1984",
DATUM["WGS_1984",
SPHEROID["WGS_1984",6378137,298.257223563]],
PRIMEM["Greenwich",0],
UNIT["Degree",0.017453292519943295]]
, crdlin
EPSG:3576, , . ,
ogr2ogr GDAL/OGR:
, , :
ogrinfo -al -so crdlin2.shp
:
INFO: Open of `crdlin2.shp'
PROJCS["Lambert_Azimuthal_Equal_Area",
GEOGCS["GCS_WGS_1984",
DATUM["WGS_1984",
SPHEROID["WGS_1984",6378137,298.257223563]],
PRIMEM["Greenwich",0],
UNIT["Degree",0.017453292519943295]],
PROJECTION["Lambert_Azimuthal_Equal_Area"],
PARAMETER["latitude_of_center",90],
PARAMETER["longitude_of_center",90],
PARAMETER["false_easting",0],
PARAMETER["false_northing",0],
UNIT["Meter",1]]
, :
EPSG:4326 - Extent: (-180.000000, 40.000000) - (180.000000, 84.000000)
EPSG:3576 - Extent: (-5133549.567108, -5397733.446068) - (5397733.446068,
1667991.365941)
2.1.5
PNG , web.
GIF , , TIFF.
/ ,
. , PNG
,
:
alpha-transparency .
.
, LZW,
.
32
, ( GIF) ,
.
-.
,
, .
(),
. , GD
(Graphics Library) , .
GIF, JPEG, PNG WBMP,
, , ( ) ,
. 32-
(truecolor) . 2.1
, GD.
2.1 , GD
, .
GD, . ,
, (,
).
AGG (Anti-Grain Geometry).
33
2D. AGG
, ,
, . AGG ,
,
. 2.2
GDI+ (Graphics Device Interface) AGG.
GD, 2.3
AGG.
2.3 , AGG
34
, , GD,
. ,
.
, AGG,
PNG, .
.
2.2
,
. ,
,
. ,
.
, ,
, . ,
, -
, , .
, , .
,
, ,
.
. Windows, ,
Acronis True Image. Linux, LVM
(Logical Volume Manager, - ),
.
, ,
:
, -
, - .
35
.
, ,
.
. ,
.
, .
2.2.1
,
, -
. ,
.
,
:
.
,
. ,
, ,
,
.
. , IT-
, .
, ,
36
, ,
, , .
, ,
.
, :
a. .
( ,
,
-
). ,
.
b. . ,
,
.
, .
2. .
() ( )
.
,
.
.
,
.
, ,
,
- .
CPU (Central Processing Unit, -
), CPU Intel
VT, CPU AMD AMD-V.
37
1:
: Mobile DualCore Intel Core 2 Duo P8400, 2266 MHz (8.5 x 267)
Intel Virtualization Technology (VT-x)
: 3066 (DDR2-800 DDR2 SDRAM)
: Intel Cantiga PM45
: Microsoft Windows 7 Ultimate 32 bit (MSDN License)
: Seagate FreeAgent GoFlex USB Device (465 , USB)
, .
, .
,
, .
, CrystalDiskMark,
. 2.4.
2.4
- ,
. ,
, ,
Windows 7:
1
sibnigmi.ru - Rstyle Marshall Xeon
CENTOS KVM.
38
VMware Workstation
(x86-),
. 32-, 64- .
30 .
VirtualBox , ,
Microsoft Windows, Linux, FreeBSD, Mac OS X .
GNU GPL, , .
, VirtualBox -
,
VMware Workstation. , ,
,
:
VMware Workstation , .. .
VMware Workstation,
. , VMware Player
( ) ,
( .. VMware
Workstation).
VMware Workstation ,
. 2.5 VMware Workstation
.
39
2.5 VMware Workstation
- , - ,
, . ,
. ,
.
:
Memory: 2048 MB
40
Use network address translation (NAT)
,
Maximum disk size (GB): 37; Store virtual disk as a single file; Allocate all disk space now
,
,
Finish
2.6 ,
.
2.6
41
2.2.2
,
. ,
, :
, .
(),
.
, ,
Linux: Fedora Ubuntu.
, ,
. - Fedora ,
, , , .
,
, .
, .
,
RPM (Red Hat Package Manager), Fedora,
.
42
,
, .
,
. , ,
, :
(swap) 2047 MB, (/) .
, , ,
. , ,
.
, , ,
.
(root). ,
#, :
# vim /etc/sysconfig/network-scripts/ifcfg-eth0, - ,
NAT (Network Address Translation
), , DHCP- ,
, :
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
, (,
192.168.220.168), .
43
# yum localinstall --nogpgcheck
http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-
stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-
nonfree-release-stable.noarch.rpm, -
# yum update y, -
# reboot, - ,
# yum install vim mc elinks mlocate unzip perl cpan gcc gcc-c++ gfortran
python-devel python-setuptools man httpd lighttpd lighttpd-fastcgi libpqxx
libpqxx-devel postgresql postgresql-server postgresql-devel proj proj-epsg
proj-devel postgis java-1.6.0-openjdk java-1.6.0-openjdk-devel httperf, -
, ,
,
,
:
# reboot
2.7 free,
.
2.7 free
,
60, 4.
44
, PostGIS/PostgreSQL.
Shapefile , SQL-
PostGIS. Linux,
:
# chmod +x convert.sh
# cd poppnt/
# ./convert.sh
, poppnt.sql,
.
# su postgres, - postgres
$ exit, - - postgres
# vim /var/lib/pgsql/data/pg_hba.conf, -
trust, Unix- IPv4
45
, PostGIS ,
. ,
, , ,
.
2.3
,
, ,
.
,
: CPU.
, , 2.8.
2.8
46
:
CPU
CPU
,
. , ,
, . ,
.
2.9
wms-, wms- QGIS. QGIS
(Quantum GIS) , ,
.
AB (Apache
Bench). Apache HTTP Server,
web-. ,
http-, .
.
, AB:
48
. ,
.
( ).
,
, .
. , 5 (6
) web-.
, web-
, , ,
.
, , ,
:
,
:
, , ,
. ,
, ( Time per
request).
2.4 GeoServer
2.4.1
GeoServer (geoserver-
2.1-RC1-bin.zip), .
: (
), web-, Windows, Mac OS X,
. Java
49
Runtime Environment,
.
,
:
# export JAVA_HOME=/usr/lib/jvm/jre/
# cd /srv, - GeoServer
# unzip geoserver-2.1-RC1-bin.zip
# cd geoserver-2.1-RC1
# ./startup.sh
,
Java - Jetty, GeoServer .
HTTP- HTTP- ( ,
Apache HTTP Server).
, Jetty HTTP-,
8080.
GeoServer web-,
,
. XML-.
web- GeoServer ,
.
, web- GeoServer
http://192.168.220.168:8080/geoserver/web/.
50
2.10 Web- GeoServer
2.4.2
, ,
, :
# mkdir /srv/geoserver-2.1-RC1/data_dir/data/wmsystem
. , , web-
, : Workspaces/Add new workspace. Name Namespace
URI wmsystem. ,
, Default Workspace.
Save.
, , Shapefile
PostGIS:
51
Postgis. : Stores/Add new Store/PostGIS.
Data Source Name - poppnt. Connection
Parameters, : host localhost; database wmsystem; user postres.
Save.
GeoServer, , Layers/Add a
new resource. Add
layer from, Publish. ,
, ,
. Save. .
, , . ,
wms-. wms-,
, :
http://192.168.220.168:8080/geoserver/ows?SERVICE=WMS&. GeoServer
2.11.
2.11 GeoServer
,
.
52
2.5 MapServer
2.5.1
MapServer
. mapserver-5.6.3-3.fc14.i686,
. MapServer CGI- mapserv (
: /usr/sbin/mapserv), (
, , ..),
. , : , MapServer
, , html-,
. ,
, ,
.map, mapserv
, .
2.5.2
, ,
WMS:
mapserv CGI-,
HTTP-. MapServer :
CGI (Common Gateway Interface) FastCGI. ,
FastCGI,
53
. , ,
HTTP- GeoServer, CGI.
FastCGI - web- ,
CGI. CGI
. FastCGI CGI-. CGI-
, web- ,
. FastCGI ,
.
. CGI
STDIN STDOUT CGI-, FastCGI- Unix
Domain Sockets ( ) TCP/IP .
CGI-: FastCGI-
. , FastCGI-,
.
server.modules,
mod_fastcgi
54
server.port = 8080
, mod_fastcgi:
( "localhost" =>
"min-procs" => 1,
"max-procs" => 6,
"max-load-per-proc" => 4,
"idle-timeout" => 20
Lighttpd,
, . web-
:
# /etc/init.d/lighttpd start
# chkconfig lighttpd on
,
http://192.168.220.168:8080/maps, :
, MapServer ,
.
, :
# mkdir /srv/wmsystem, -
55
# mkdir /srv/wmsystem/maps, - ,
# mkdir /srv/wmsystem/maps/data, -
Shapefile
# vim /usr/share/proj/epsg, -
EPSG:3576:
, , ,
MapServer map-. , .
( ), WMS ,
:
MAP # , "map"
NAME "WMSYSTEM_WMS"
STATUS ON
IMAGETYPE PNG
UNITS DD # , lat/lon
DEBUG 5 # ,
WEB
TEMPLATE "templates/template.html"
IMAGEPATH "/var/www/lighttpd/wmsystem/tmp/"
56
IMAGEURL "/tmp/"
METADATA
mapfile_encoding "UTF-8"
wms_onlineresource
"http://localhost:8080/maps?map=/srv/maps/wms.map&"
wms_getfeatureinfo
"http://localhost:8080/maps?map=/srv/maps/wms.map&"
wms_featureinfoformat "text/plain"
wms_feature_info_mime_type "text/html"
END
END
PROJECTION
"init=epsg:4326" #
END
OUTPUTFORMAT
NAME aggpng24 #
DRIVER AGG/PNG
MIMETYPE "image/png"
IMAGEMODE RGB
EXTENSION "png"
END
LAYER
NAME crdlin #
STATUS ON #
TYPE LINE #
TEMPLATE "void" # ,
PROJECTION
57
"init=epsg:4326" #
END
METADATA
wms_title ""
wms_include_items "all" #
END
CLASS
NAME "crdlin"
STYLE
COLOR 255 0 0 #
END
END
END
LAYER
NAME hdrlin
DATA hdrlin
STATUS ON
TYPE LINE
TEMPLATE "void"
PROJECTION
"init=epsg:4326"
END
METADATA
wms_title ""
wms_include_items "all"
END
58
CLASS
NAME "crdlin"
STYLE
COLOR 0 255 0
END
END
END
LAYER
NAME poppnt
CONNECTIONTYPE postgis #
STATUS ON
TYPE POINT
TEMPLATE "void"
PROJECTION
"init=epsg:4326"
END
METADATA
wms_title ""
wms_include_items "all"
END
CLASS
NAME "poppnt"
STYLE
COLOR 0 0 255
END
END
END
59
END
, :
http://192.168.88.153:8080/maps?map=/srv/wmsystem/maps/wms.map&SERVICE=WMS&VERSION=1.
1.1&REQUEST=GetMap&LAYERS=crdlin,hdrlin,poppnt&SRS=EPSG:4326&BBOX=-
180,40,180,84&WIDTH=900&HEIGHT=100&FORMAT=image/png
2.13 MapServer
MapServer ,
.
2.6
ab, ,
2.1 2.2.
60
2.1 ,
CPU
GeoServer MapServer
2.2 ,
CPU
GeoServer MapServer
61
, *,
, ,
. ,
, ,
. 30000 .
2.14 2.15
.
35000,00
30000,00
25000,00
20000,00
15000,00
10000,00
GeoServer
5000,00
MapServer
0,00
2.14
, CPU
62
35000,00
30000,00
25000,00
20000,00
15000,00
10000,00
GeoServer
5000,00
MapServer
0,00
2.15 -
, CPU
,
, MapServer .
. -,
GeoServer, , -
. GeoServer
, , PostGIS.
, ,
30-40%.
,
CPU. ,
, ,
CPU.
MapServer - ,
.
63
,
CPU.
2.7
[7],
. FOSS4G 2009 (Free and Open Source
Software for Geospatial), WMS.
, , ESRI
ERDAS, , , .
: GeoServer
MapServer.
, FOSS4G,
:
, FOSS4G,
.
.
, .
.
JMeter
.
640x480 1024x768 .
.
MapServer.
, MapServer GeoServer 1.5-2.5 . ,
MapServer cgi fastcgi, 50-60%
. , .
64
2.8
web- ( web- ) ,
[6]. ,
( ),
. (,
, ), (
).
, , ,
. , web-,
, ,
, .
,
, .
, ,
.
web- :
.
.
- .
()
, . ,
. :
, ,
. ,
, , .
,
. ,
, - ,
.
65
,
.
web- .
.
, ,
web-,
, , ,
. , ,
, web-,
.
MapServer ( ),
,
. , , ,
.
: .
(
) .
. : , ..
.
, ,
. web-
( ), .
.
web-
North Pole LAEA Russia (EPSG:3576),
EPSG:4326. ,
.
66
, .
. (, ..)
. , ,
. .
, .
10-15 .
, ,
.
, , .
.
, .
, ,
.
, ,
. web-
, ,
( ),
1:100000000. ,
:
1. 2000,000000
2. 5000,000000
3. 10000,000000
4. 25000,000000
5. 50000,000000
6. 100000,000000
7. 200000,000000
8. 300000,000000
9. 500000,000000
10. 1000000,000000
11. 3000000,000000
12. 10000000,000000
67
13. 25000000,000000
14. 35000000,000000
15. 50000000,000000
16. 100000000,000000
web-
, .
, .
, , ,
, ,
. . ,
(~100 dpi)
(300 dpi ),
2-3 .
- .
( ). ,
, 0,5, .
.
(, ).
,
. .
, . ,
, , , ,
. ,
- :
. .
.
.
: , ,
68
, ..
. -, ,
.
: , , (
).
, .
- , ,
,
. .
, .
.
.
.
, . ,
. .
( ),
2 .
, . , ()
.
MapServer, ,
() .
,
. ,
.
. , ,
, .
, .
. .
(, JPEG)
69
.
.
.
. .
, . ,
(, ,
), 6 .
, , , 3
.
MapServer .
,
.
.
. , ,
. ,
( ) , . ,
,
.
. ,
0.5, 0.75 1 . 1
, 0.5 MapServer. 1 ,
2-3 , ,
. 3 .
,
. , , .
, ,
1.5 . ,
.
70
.
( Arial Verdana).
, ( Times New Roman Georgia).
,
, , ..
8 . .
( 5-10%)
, .
, , .
() ,
. , , Google Maps
..
, . 8-14
, .
, , , ,
.
. .
( ).
.
,
. ,
( , ).
.
, ,
.
, , ,
(. 4).
.
, .
71
, 15 ,
15 . ,
.
.
(, ),
( ,
). ,
.
, web-
, .
, ,
, . ,
, , , ,
. , ,
, .
2.9
.
. , ,
, .
,
. ,
, ,
, .
,
. ,
, ,
. - :
72
WMS-
2.16 web-
, WMS- .
wms-:
WMS- WMS-
2.17 web-
-
. , , wms-, WMS-,
, , .
,
, .
, ,
:
73
2.18 web-
2.18, ,
, () .
: (
), (WMS-) (
). , - -
, :
(
)
;
74
, , ,
, . ,
, .
75
3
, ,
. ,
,
: .
,
. ,
:
/srv/wmsystem/ - wmsystem,
,
/srv/wmsystem/maps/ - ,
MapServer
/srv/wmsystem/web/ , web-
/srv/wmsystem/stream/ - ,
, ,
, , . ,
,
.
3.1
, /srv/wmsystem/stream/in/.
Cron.
FTP (File Transfer Protocol), ,
FTP-. FTP-:
/etc/init.d/vsftpd start
76
chkconfig vsftpd on
, FTP- ,
, . VsFTPd
,
. .
, , : in.py
; grib.py .
3.1.1 PostGIS
, GRIB PostGIS:
,
;
, , SQL-
, .
, SQL-
. ,
, :
. ,
. ,
BEGIN
COMMIT.
,
,
.
, .
ST_GeomFromText()
PostGIS [8]. : WKT
77
POINT(x, y), 4326.
:
SELECT DropGeometryColumn('','grib','the_geom');
BEGIN;
"initial_time" timestamp,
"center" varchar(254),
"parameter_number" int2,
"level_indicator" int2,
"level" int2,
"forecast_time" int2,
"grid_type" varchar(254),
"val" real);
SELECT AddGeometryColumn('','grib','the_geom','4326','POINT',2);
COMMIT;
SQL-, , :
CREATE INDEX "poppnt_the_geom_gist" ON "grib" using gist ("the_geom"
gist_geometry_ops);
, - GRIB,
:
3.1.2
(
), , ,
78
. [9] ,
Python, :
, NumPy,
.
,
,
.
.
Python
. ,
,
.
__slots__,
, ,
,
.
,
( try,
, if 10%),
.
,
-, -,
,
, ,
for.
,
Python.
3.1.3
grib.py
GRIB:
79
Splitter GRIB
;
SplitterError - ;
Message
GRIB;
MessageError - ,
GRIB;
MessageOpenError - GRIB;
MessageAttributeError - ,
GRIB;
MessageIncorrect - ,
GRIB;
FilterMessage GRIB
;
FilterMessageFail
GRIB ;
DumpToPostGIS GRIB
SQL- PostGIS.
unittest.
3.1.4
in.py
, .
try,
, .
.
80
3.1 in.py
, . ,
12 GRIB, , , SQL-
, UNIX time, 3.2.
81
3.2
. , 500 ,
.
3.2
,
, .
:
.
().
,
.
,
web- .
82
, ,
.
, ,
,
,
, .
3.2.1 WMS-
wms-, MapServer,
. ,
wms-:
/srv/wmsystem/maps
/srv/wmsystem/maps/data Shapefile
/srv/wmsystem/maps/templates
GetFeatureInfo,
/srv/wmsystem/maps/fonts
/srv/wmsystem/maps/wms.map map-,
/tmp/mapserv/tmp
/tmp/mapserv/debugs.log - MapServer, ,
,
WMS
GetFeatureInfo. MapServer
:
text/plain - ( )
text/html - html
application/vnd.ogc.gml - GML
83
,
. MapServer.
, , text/html.
(HEADER, FOOTER, TEMPLATE),
. HEADER FOOTER
, TEMPLATE
.
map-,
, -:
MAP
NAME "WMSYSTEM_WMS"
STATUS ON
UNITS METERS
SHAPEPATH "data/"
DEBUG 5
# Web-
WEB
HEADER "templates/header.html"
TEMPLATE "templates/template.html"
FOOTER "templates/footer.html"
IMAGEPATH "/tmp/mapserv/tmp/"
84
IMAGEURL "/tmp/"
METADATA
"mapfile_encoding" "UTF-8"
"wms_title" "WMSYSTEM_WMS"
"wms_onlineresource"
"http://localhost:8088/maps?map=/srv/wmsystem/maps/wms.map&"
"wms_getfeatureinfo"
"http://localhost:8088/maps?map=/srv/wmsystem/maps/wms.map&"
"wms_featureinfoformat" "text/html"
"wms_feature_info_mime_type" "text/html"
END
END
PROJECTION
"init=epsg:3576"
END
# PNG
OUTPUTFORMAT
NAME aggpng24
DRIVER AGG/PNG
MIMETYPE "image/aggpng24"
IMAGEMODE RGB
EXTENSION "png"
END
85
#
LAYER
NAME "crdlin"
METADATA
"wms_title" ""
"wms_include_items" "all"
END
TYPE LINE
HEADER "templates/header.html"
TEMPLATE "templates/template.html"
FOOTER "templates/footer.html"
STATUS ON
DATA crdlin
PROJECTION
"init=epsg:3576"
END
CLASS
NAME ""
STYLE
COLOR 255 0 0
END
END
END
LAYER
NAME "grib"
86
METADATA
"wms_title" ""
"wms_include_items" "all"
END
CONNECTIONTYPE postgis
TYPE POINT
HEADER "templates/header.html"
TEMPLATE "templates/template.html"
FOOTER "templates/footer.html"
STATUS ON
PROJECTION
"init=epsg:4326"
END
CLASS
NAME ""
STYLE
COLOR 0 0 0
END
END
END
END
, ,
, , .
87
3.2.2 WMS-
, ,
, web- - OpenLayers.
OpenLayers [10], JavaScript,
(API),
GoogleMap API MSN Virtual Earth API. web-
,
. OpenLayers
, , , , WMS
( WFS) , MapServer, ArcIMS GeoServer,
Google. , ,
, .
OpenLayers , JavaScript.
. OpenLayers,
.
: ,
, , ..
, , build/OpenLayers.js theme img,
.
OpenLayers API ,
Mapserver: Map Layer. Map ,
, .
(Map) Layer. Layer
, , ,
.
,
OpenLayers, (OpenLayers
html-). , web-
OpenLayers:
<html>
<head>
<title>OpenLayers Example</title>
88
<script
src="http://openlayers.org/api/OpenLayers.js"></script>
</head>
<body>
map.addLayer(wms);
map.zoomToMaxExtent();
</script>
</body>
</html>
,
MetaCarta.
, .
,
OpenLayers:
EPSG:3576:
var options = {
controls: [
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.LayerSwitcher({'ascending':false}),
new OpenLayers.Control.Permalink(),
new OpenLayers.Control.ScaleLine(),
new OpenLayers.Control.Permalink('permalink'),
new OpenLayers.Control.MousePosition(),
new OpenLayers.Control.OverviewMap(),
new OpenLayers.Control.KeyboardDefaults(),
89
new OpenLayers.Control.NavToolbar()
],
maxResolution: "auto",
projection: "EPSG:3576",
units: "m"
};
map.addLayer(wms);
url: server,
queryVisible: true,
eventListeners: {
getfeatureinfo: function(event) {
map.addPopup(new OpenLayers.Popup.FramedCloud(
"chicken",
map.getLonLatFromPixel(event.xy),
null,
event.text,
null,
true
));
});
90
map.addControl(info);
info.activate();
if (!map.getCenter()) map.zoomToMaxExtent();
EPSG:4326:
var options = {
controls: [
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.LayerSwitcher({'ascending':false}),
new OpenLayers.Control.Permalink(),
new OpenLayers.Control.ScaleLine(),
new OpenLayers.Control.Permalink('permalink'),
new OpenLayers.Control.MousePosition(),
new OpenLayers.Control.OverviewMap(),
new OpenLayers.Control.KeyboardDefaults(),
new OpenLayers.Control.NavToolbar()
],
maxResolution: "auto",
projection: "EPSG:4326",
units: "dd"
};
map.addLayer(wms);
91
info = new OpenLayers.Control.WMSGetFeatureInfo({
url: server,
queryVisible: true,
eventListeners: {
getfeatureinfo: function(event) {
map.addPopup(new OpenLayers.Popup.FramedCloud(
"chicken",
map.getLonLatFromPixel(event.xy),
null,
event.text,
null,
true
));
});
map.addControl(info);
info.activate();
if (!map.getCenter()) map.zoomToMaxExtent();
wms-,
server. layers,
format.
, .
OpenLayers.Control.WMSGetFeatureInfo,
text/html, wms-.
.
3.2.3 web-
92
web-
Python Web.py [11].
, ,
wms- . Web.py
web-, .
, ,
, , .
web.py, easy_install,
:
easy_install web.py
web- :
/srv/wmsystem/www web-
/srv/wmsystem/www/static , CSS-
JavaScript-
/srv/wmsystem/www/templates web-
/srv/wmsystem/www/app.py
/srv/wmsystem/www/start.sh web-
/srv/wmsystem/www/stop.sh web-
web.py
. ,
:
#!/usr/bin/python
import os
import sys
import web
93
render = web.template.render('templates/', base='layout')
urls = (
"/", "IndexHandler",
"/map/(.*)", "MapHandler",
class IndexHandler:
def GET(self):
raise web.seeother('/map/')
class MapHandler:
i = web.input(proj="epsg:3576")
return render.map(i.proj)
if __name__ == '__main__':
app.run()
web- /map/,
, , OpenLayers
. .
#!/bin/sh
Spawn-CGI , 9002,
stop.sh:
94
#!/bin/sh
, web- ,
.
3.2.4 web-
HTTP-,
.
web-, ,
. ,
, ,
. ,
, .
, : Lighttpd
Nginx. Lighttpd MapServer.
, ,
web-, ,
.
Nginx web- -,
[12]. . Nginx
,
select, epoll (Linux) kqueue (FreeBSD).
.
. ,
. , ,
. ,
, .
-, writev sendfile, nginx
.
95
Nginx , web-
, web-. ,
Nginx: Rambler, Yandex, Begun, Wordpress.com, SourceForge.net, vkontakte.ru,
.
Nginx , .
.
Nginx : web-
, wms-, .
/etc/nginx/nginx.conf,
web-:
location / {
fastcgi_pass 127.0.0.1:9002;
:
location /static/ {
root /srv/wmsystem/www;
if (-f $request_filename) {
96
}
/static/,
/srv/wmsystem/www/static/.
web- wms-,
Nginx. OpenLayers GetFeatureInfo
wms-, ip-
. XSS (Cross Site Scripting
). , ,
wms-.
ip- , :
location /maps {
proxy_pass http://localhost:8088/maps;
, /maps wms-
, , web-,
. Nginx ,
, .
, .
97
3.3 web- EPSG:3576
3.3 web-
, . EPSG:4326,
.
3.4.
98
3.4 web- EPSG:4326
PostGIS,
OpenLayers, grib. ,
3.5.
99
3.5 web- EPSG:3576,
GRIB
,
, , .
,
. ,
.
3.2.5
,
.
Shapefile, .
:
( );
( );
( );
( );
( );
100
( ).
:
, ;
;
.
, Quantum GIS,
. ,
,
, 100000, 10000, ..
. ,
, .
.
GDAL/OGR:
shptree layer.shp, -
layer.shp
,
web,
.
3.3 web-
web-
, , OpenLayers 1.
,
web-:
101
OpenLayers;
OpenLayers build.py,
, js-
. build.py, wmsystem.cfg:
[first]
OpenLayers/SingleFile.js
OpenLayers.js
OpenLayers/BaseTypes.js
OpenLayers/BaseTypes/Class.js
OpenLayers/Util.js
[last]
[include]
OpenLayers/Map.js
OpenLayers/Layer/WMS.js
OpenLayers/Control/Navigation.js
OpenLayers/Control/PanZoomBar.js
OpenLayers/Control/Permalink.js
OpenLayers/Control/ScaleLine.js
OpenLayers/Control/MousePosition.js
OpenLayers/Control/OverviewMap.js
OpenLayers/Control/KeyboardDefaults.js
OpenLayers/Control/WMSGetFeatureInfo.js
OpenLayers/Format/WMSGetFeatureInfo.js
OpenLayers/Request/XMLHttpRequest.js
OpenLayers/Format/GML.js
OpenLayers/Popup/FramedCloud.js
102
[exclude]
./build.py wmsystem.cfg,
OpenLayers, jsmin. ,
OpenLayers 1 290,
.
, ,
. ,
CPU ,
.
gzip nginx [13]:
gzip_static on;
gzip on;
gzip_comp_level 9;
nginx ,
css js-, wms- .
nginx,
:
worker_processes 2;
,
40-60%, web-.
3.4
103
3.6 Web- EPSG:3576
105
,
3.10.
3.10
, ,
, ,
wms-.
106
4 http://sibnigmi.ru
http://sibnigmi.ru
-
COSMO.
. 4.1 , sibnigmi.ru
. 4 ,
:
COSMO ( 48 3.:,
, ( ),
)
o ( , )
107
o 500 ( , )
o 800 ( , )
o 500 (, )
o 850 (, )
o (, )
o (, )
- :
WSIBMZ (. . ..)
o ;
o ;
o .
( MODIS,
NASA)
o 24
o 48
o 7
o .
108
. 4.2 , sibnigmi.ru
( 1.7.46 2011-
. , , 1.1.1.4)
109
.4.3. .
110
,
web- .
,
,
.
,
,
,
.
- 2
- : 2.
111
1. OGC Standards and Specifications [ ]:
OGC. : http://www.opengeospatial.org/standards
6. Tyler Mitchell: Web Mapping Illustrated / Tyler Mitchell. California: O'Reilly Media, 2005.
368 .
10. Hazzard E. OpenLayers 2.10. Birmingham: Packt Publishing Limited, 2011. 372 .
13. Clement Nedelcu: Nginx HTTP Server / Clement Nedelcu. Birmingham: Packt Publishing
Limited, 2011. 348 .
112
14. . Python 3 / . . -:
-, 2009. 608.
15. .. /
, 2011- 112.
113