You are on page 1of 113

()

-

( )

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);

, ;

Open Geospatial Consortium.

7
1

1.1


.
, , - ,
, , .

.
.

,
( ) .
, , ,

.
( ), ,
. ,
, .
web- ,

.

web-
. Web-
,
. web ,
, . , web-
.
web-
web mapping service ( web-). ,
, , ,

8
, .
web- :

web, ,
, .

1.2 web-

web-
. ,
,
, . ,
, web-:

Web- (Google Maps, Google Earth, Virtual Earth, ArcGIS Explorer .)


.
,
. web-,
. ,
() ,
,
. , ,
, ,
(, ).

(ArcGIS, Mapinfo, QGIS, gvSIG .)


, web-. , ,
, , ,
web-, -
web.

web- (MapServer, GeoServer, OpenLayers .)


,
web.
9
, ,
(PostgreSQL, SQL Server, MySQL, ArcSDE).
, Google Maps,
.
,
.

1.3 web-

,
.
, ,
, RFC .
web-:

. OGC (Open Geospatial Consortium)


,
, (, WxS).
,
.
USGS, NASA, NGA, ESRI, Google, Microsoft .

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
,
.

OGC web- [1]:

Web Map Service (WMS)

11
o
()
;

o
(, );

o
.

Web Feature Service (WFS)

o
Geography Markup
Language (GML);

o
HTTP-.

Web Coverage Service (WCS)

o WMS
;

o WMS coverage service


,
,
, .

1.5


:
. ,
, , -
web-. , ,
,

12
, , web-. ,
,
web-.

1.6

, ,
:
- ( GRIB CDF),
;
- (, , );
- , -.

1.6.1

GRIB (Gridded Binary) ,


.

(), GRIB FM 92-IX 306
[2]. GRIB. 0
, TOGA, . (
2)
. GRIB,
.

,
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

,
:

(ESRI Shapefile, OGR,


GML, KML, ArcSDE .),
(Oracle Spatial, PostGIS/PostgreSQL, MySQL, MSSQL .).

JPEG, PNG, TIFF, GeoTIFF .


.
:

,
.

14
, , .

,
.


.
.
(Google Maps, Yandex Maps .).


. , , , .
( -
ESRI Shapefile, , ,
),
.

, OpenGIS
: Well-Known Text (WKT) Well-
Known Binary (WKB) [1]. WKT WKB
, . (WKT)
:

POINT(0 0)

LINESTRING(0 0,1 1,1 2)

POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2, 1 2,1 1))

MULTIPOINT(0 0,1 2)

MULTILINESTRING((0 0,1 1,1 2),(2 3,3 2,5 4))

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

.


, .

G2CLIB Perl Python.


, ,
Python [14]. NumPy,
, Perl.
PostgreSQL, ,
.

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;

, ESRI Shapefile PostGIS;

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-.
,
, .
:

, OpenGIS Consortium, web


mapping services ( WMS, WFS, WCS);

Perl, PHP,
Java, C, Python .;

Oracle, Sybase, MySQL, PostgreSQL ;

( TrueType
, , , PNG, TIFF, GIF, JPEG
);

C
.

, MapServer
. ,

22

. , ,
.

GeoServer

, MapServer, GeoServer [5]


, , ,
OGC: WMS, WFS, WCS. , MapServer, GeoServer
WFS-T (WFS-Transaction). , , GeoServer,
,

. : JPEG, PNG, SVG, KML/KMZ, GML, PDF,
ESRI Shapefile ..

, GeoServer MapServer, ,
GeoServer, .
web-
, . GeoServer
Geotools , Java.
Java Development Kit (JDK). ,
GeoServer MapServer
. GeoServer
Java
( MapServer)

MapGuide Open Source

MapGuide Open Source web-,


web- .
Autodesk MapGuide Enterprise. MapGuide:
, , ,
, , ;
XML, ,
.
Windows Linux, Apache IIS HTTP-,
(PHP, .NET, Java, JavaScript)

23
, . MapGuide
Open Source LGPL.

MapGuide OpenSource web-


.
,
web- . ,
, .
,
.
FDO (Feature Data Object). -
SDF.
.
, (
), .
, .

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

shp2pgsql d I s 4326 $f $name > ./sql/$name.sql

done

2.1.3


. ,
, , ,
. .
, .

, ,
PROJ.4. ,
, ,
,
.

,
(, /) , EPSG:4326.
, EPSG:3576,
, PROJ.4
:

PROJ.4:

+proj=laea +lat_0=90 +lon_0=90 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84


+units=m +no_defs

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:

INSERT into spatial_ref_sys (srid, auth_name, auth_srid, proj4text,


srtext) values ( 93576, 'epsg', 3576, '+proj=laea +lat_0=90 +lon_0=90
+x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs ',
'PROJCS["WGS 84 / North Pole LAEA Russia",GEOGCS["WGS
84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6
326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0
1745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],UN
IT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Lambert_Azimuthal_Eq
ual_Area"],PARAMETER["latitude_of_center",90],PARAMETER["longitude_of_c
enter",90],PARAMETER["false_easting",0],PARAMETER["false_northing",0],A
UTHORITY["EPSG","3576"],AXIS["X",UNKNOWN],AXIS["Y",UNKNOWN]]');

GeoServer:

3576=PROJCS["WGS 84 / North Pole LAEA


Russia",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",63
78137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.01745329251
9943295]],PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["latitud
e_of_center",90],PARAMETER["longitude_of_center",90],PARAMETER["false_e
asting",0],PARAMETER["false_northing",0],UNIT["Meter",1]]

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'

using driver `ESRI Shapefile' successful.

Layer name: crdlin

Geometry: Line String

Feature Count: 701

Extent: (-180.000000, 40.000000) - (180.000000, 84.000000)

Layer SRS WKT:

GEOGCS["GCS_WGS_1984",

DATUM["WGS_1984",

SPHEROID["WGS_1984",6378137,298.257223563]],

PRIMEM["Greenwich",0],

UNIT["Degree",0.017453292519943295]]

SHAPE_Leng: Real (19.11)

class_id: Integer (9.0)


30
lon: Real (19.11)

lat: Real (19.11)

, crdlin
EPSG:3576, , . ,
ogr2ogr GDAL/OGR:

ogr2ogr -t_srs "+proj=laea +lat_0=90 +lon_0=90 +x_0=0 +y_0=0 +ellps=WGS84


+datum=WGS84 +units=m +no_defs" crdlin2.shp crdlin.shp

, , :
ogrinfo -al -so crdlin2.shp

:
INFO: Open of `crdlin2.shp'

using driver `ESRI Shapefile' successful.

Layer name: crdlin2

Geometry: Line String

Feature Count: 701

Extent: (-5133549.567108, -5397733.446068) - (5397733.446068, 1667991.365941)

Layer SRS WKT:

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]]

SHAPE_Leng: Real (19.11)

class_id: Integer (9.0)


31
lon: Real (19.11)

lat: Real (19.11)

, :
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 (Portable Network Graphics) ,


Deflate

JPEG (Joint Photographic Experts Group) ,


, JPEG
,

GIF (Grpahics Interchange Format) ,


256 ,
LZW

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.

2.2 GDI 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 , .. .

, VirtualBox, VMware Workstation.

VMware Workstation,
. , VMware Player
( ) ,
( .. VMware
Workstation).

VMware Workstation ,
. 2.5 VMware Workstation
.

39
2.5 VMware Workstation
- , - ,
, . ,
. ,
.
:

Configuration: Custom (advanced)

Hardware compatibility: Workstation 6.5-7.0

I will install the operating system later

Linux: Red Hat Linux

Virtual machine name: wmsystem

Number of processors: 1; Number of cores per processor: 1

Memory: 2048 MB

40
Use network address translation (NAT)
,

SCSI Adapter: BusLogic

Disk: Create a new virtual disk

Virtual disk type: SCSI

Maximum disk size (GB): 37; Store virtual disk as a single file; Allocate all disk space now
,
,

Disk file: wmsystem.vmdk

Finish

2.6 ,
.

2.6

41
2.2.2

,
. ,
, :

, .

(),

.

, ,
Linux: Fedora Ubuntu.
, ,
. - Fedora ,
, , , .
,
, .
, .
,
RPM (Red Hat Package Manager), Fedora,
.

Fedora Red Hat,


, .
. ,
, , ,
. ,
, .
, CentOS ( Red Hat Linux),

42
,
, .

,
. , ,
, :
(swap) 2047 MB, (/) .
, , ,
. , ,
.

, , ,
.
(root). ,
#, :

# vim /etc/sysconfig/selinux - selinux=disabled. SELinux


(Security-Enhanced Linux Linux )
,
. Linux,
, .
SELinux ,
. .

# vim /etc/sysconfig/network-scripts/ifcfg-eth0, - ,
NAT (Network Address Translation
), , DHCP- ,
, :

DEVICE=eth0

BOOTPROTO=dhcp

ONBOOT=yes

# chkconfig network on, -

# service network start, -

, (,
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, -
, ,
,

# chkconfig --list | grep , - ,


,
:

# chkconfig ip6tables off

# chkconfig iptables off

# chkconfig netfs off

# chkconfig sendmail off

# chkconfig udev-post off

# 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,
.

# /etc/init.d/postgresql initdb, - postgres

# /etc/init.d/postgresql start, - postgresql

# chkconfig postgresql on, -

# su postgres, - postgres

$ createdb U postgres wmsystem, - wmsystem

$ createlang plpgsql wmsystem

$ psql -d wmsystem -f /usr/share/pgsql/contrib/postgis-1.5/postgis.sql, -


$ psql -d wmsystem -f /usr/share/pgsql/contrib/postgis-


1.5/spatial_ref_sys.sql

$ exit, - - postgres

# vim /var/lib/pgsql/data/pg_hba.conf, -
trust, Unix- IPv4

# vim /var/lib/pgsql/data/postgresql.conf, - listen_addresses


port, , PostgreSQL

# /etc/init.d/postgresql restart, - PostgreSQL

# psql -d wmsystem -U postgres -w -f poppnt/sql/poppnt.sql, - poppnt


wmsystem

45
, PostGIS ,
. ,
, , ,
.

2.3
,
, ,
.
,
: CPU.
, , 2.8.

2.8

46
:

CPU

o (Shapefile, crdlin); EPSG:4326; (-180.000000, 40.000000)


- (180.000000, 84.000000); PNG; 900x100

o (Shapefile, hdrlin); EPSG:4326; (-180.000000, 40.000000)


- (180.000000, 84.000000); PNG; 900x100

o (PostGIS, poppnt); EPSG:4326; (-180.000000,


40.000000) - (180.000000, 84.000000); PNG;
900x100

o (Shapefile, crdlin); EPSG:3576; (-5133549.567108, -


5397733.446068) - (5397733.446068, 1667991.365941); PNG;
800x600

o (Shapefile, hdrlin); EPSG:3576; (-5133549.567108, -


5397733.446068) - (5397733.446068, 1667991.365941); PNG;
800x600

o (PostGIS, poppnt); EPSG:3576; (-5133549.567108, -


5397733.446068) - (5397733.446068, 1667991.365941); PNG;
800x600

CPU

o (Shapefile, crdlin); EPSG:4326; (-180.000000, 40.000000)


- (180.000000, 84.000000); PNG; 900x100

o (Shapefile, hdrlin); EPSG:4326; (-180.000000, 40.000000)


- (180.000000, 84.000000); PNG; 900x100

o (PostGIS, poppnt); EPSG:4326; (-180.000000,
40.000000) - (180.000000, 84.000000); PNG;
900x100
47
o (Shapefile, crdlin); EPSG:3576; (-5133549.567108, -
5397733.446068) - (5397733.446068, 1667991.365941); PNG;
800x600
o (Shapefile, hdrlin); EPSG:3576; (-5133549.567108, -
5397733.446068) - (5397733.446068, 1667991.365941); PNG;
800x600
o (PostGIS, poppnt); EPSG:3576; (-5133549.567108, -
5397733.446068) - (5397733.446068, 1667991.365941); PNG;
800x600

,
. , ,
, . ,
.

2.9

wms-, wms- QGIS. QGIS
(Quantum GIS) , ,
.

AB (Apache
Bench). Apache HTTP Server,
web-. ,
http-, .
.
, AB:

48
. ,
.

( ).
,
, .

. , 5 (6
) web-.
, web-
, , ,
.

, , ,
:

ab c1 n5 http://wms, - http://wms WMS-

,
:

ab c2 n6 http://wms, - http://wms WMS-

, , ,
. ,
, ( 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:

Shapefile. : Stores/Add new Store/Shapefile.


Data Source Name (crdlin hdrlin),
, . UTF-8,
DBF charset. Save.

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:

2.12 MapServer WMS


, ,
MapServer. SUPPORTS=WMS_SERVER 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-,
.

FastCGI Lighttpd. Lighttpd web-,


, .
, BSD,
Linux Unix- , Microsoft Windows.
Lighttpd web-,
10 . Lighttpd , ,
. , ( Apache)
. Lighttpd

. ,
, CPU
. Lighttpd ( nginx,
) ,
. ,
MapServer.

Lighttpd FastCGI MapServer,


:

server.modules,
mod_fastcgi
54
server.port = 8080

, mod_fastcgi:

fastcgi.server = ( "/maps" =>

( "localhost" =>

"socket" => "/var/run/lighttpd/mapserver-


fastcgi.socket",

"check-local" => "disable",

"bin-path" => "/usr/sbin/mapserv",

"min-procs" => 1,

"max-procs" => 6,

"max-load-per-proc" => 4,

"idle-timeout" => 20

Lighttpd,
, . web-
:

# /etc/init.d/lighttpd start

# chkconfig lighttpd on

# ps aux | grep mapserv, - fastcgi-

,
http://192.168.220.168:8080/maps, :

No query information to decode. QUERY_STRING is set, but empty.

, MapServer ,
.

, :

# mkdir /srv/wmsystem, -

55
# mkdir /srv/wmsystem/maps, - ,

# mkdir /srv/wmsystem/maps/data, -
Shapefile

# toucn /srv/wmsystem/maps/wms.map, - map-,

# vim /usr/share/proj/epsg, -
EPSG:3576:

<3576> +proj=laea +lat_0=90 +lon_0=90 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84


+units=m +no_defs

# chmod 0777 /var/www/lighttpd/wmsystem/tmp/, - ,


, , ,
MapServer map-. , .
( ), WMS ,
:

MAP # , "map"

NAME "WMSYSTEM_WMS"

STATUS ON

IMAGETYPE PNG

EXTENT -180.00 40.00 180.00 84.00 #

SIZE 900 100 #

SHAPEPATH "data/" # shp-

UNITS DD # , lat/lon

IMAGECOLOR 255 255 255 # RGB

CONFIG "PROJ_LIB" "/usr/share/proj" # EPSG


PROJ.4

CONFIG "MS_ERRORFILE" "/tmp/ms_debugs.log" # -

DEBUG 5 # ,

WEB

TEMPLATE "templates/template.html"

IMAGEPATH "/var/www/lighttpd/wmsystem/tmp/"
56
IMAGEURL "/tmp/"

METADATA

mapfile_encoding "UTF-8"

wms_title "WMSystem WMS"

wms_abstract "This is the WMS server from WMSystem"

wms_onlineresource
"http://localhost:8080/maps?map=/srv/maps/wms.map&"

wms_srs "EPSG:4326 EPSG:3576"

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 #

DATA crdlin # shp-

STATUS ON #

TYPE LINE #

TEMPLATE "void" # ,

PROJECTION

57
"init=epsg:4326" #

END

METADATA

wms_title ""

wms_abstract " "

wms_srs "EPSG:4326 EPSG:3576" #

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_abstract " "

wms_srs "EPSG:4326 EPSG:3576"

wms_include_items "all"

END

58
CLASS

NAME "crdlin"

STYLE

COLOR 0 255 0

END

END

END

LAYER

NAME poppnt

CONNECTIONTYPE postgis #

CONNECTION "user=postgres dbname=wmsystem host=127.0.0.1" #


,

DATA "the_geom from poppnt" #

STATUS ON

TYPE POINT

TEMPLATE "void"

PROJECTION

"init=epsg:4326"

END

METADATA

wms_title ""

wms_abstract " "

wms_srs "EPSG:4326 EPSG:3576"

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

EPSG:4326: 293,61 43,73

EPSG:4326: 5470,45 10895,60

EPSG:4326: 12177,74 1187,14

EPSG:4326: 17217,58 13630,27

EPSG:3576: 563,11 166,46

EPSG:3576: 30000,00 19192,78

EPSG:3576: 19362,04 1704,30

EPSG:3576: 30000,00 20898,65

2.2 ,
CPU

GeoServer MapServer

EPSG:4326: 257,16 14,09

EPSG:4326: 3456,49 3698,28

EPSG:4326: 7957,58 701,91

EPSG:4326: 10050,69 3544,65

EPSG:3576: 477,46 30,40

EPSG:3576: 30000,00 6925,82

EPSG:3576: 7425,10 620,28

EPSG:3576: 30000,00 7971,53

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.
:

SET CLIENT_ENCODING TO UTF8;

SET STANDARD_CONFORMING_STRINGS TO ON;

SELECT DropGeometryColumn('','grib','the_geom');

DROP TABLE "grib";

BEGIN;

CREATE TABLE "grib" (gid serial PRIMARY KEY,

"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,
:

INSERT INTO "grib"


("center","val","level","level_indicator","forecast_time","initial_time","par
ameter_number","the_geom","grid_type") VALUES ('European Center for Medium-
Range Weather Forecasts (RSMC)',5851.215,500,100,168,'2011-01-27
(00:00)',7,ST_GeomFromText('POINT(0.0 0.0)', 4326),'Cylindrical Equidistant
Projection Grid');

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

SIZE 800 600

EXTENT -5133549.567108 -5397733.446068 5397733.446068 1667991.365941

UNITS METERS

SHAPEPATH "data/"

IMAGECOLOR 255 255 255

CONFIG "PROJ_LIB" "/usr/share/proj"

CONFIG "MS_ERRORFILE" "/tmp/mapserv/debugs.log"

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_srs" "EPSG:3576 EPSG:4326"

"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_abstract" "Grid 1 test"

"wms_srs" "EPSG:3576 EPSG:4326"

"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_abstract" "Grid 1 test"

"wms_srs" "EPSG:3576 EPSG:4326"

"wms_include_items" "all"

END

CONNECTIONTYPE postgis

CONNECTION "user=postgres dbname=wmsystem host=127.0.0.1"

DATA "the_geom from grib"

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>

<div style="width:100%; height:100%" id="map"></div>

<script defer="defer" type="text/javascript">

var map = new OpenLayers.Map('map');

var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",

"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );

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()

],

scales: [50000000, 35000000, 25000000, 10000000, 3000000, 1000000,


500000, 300000, 200000, 100000, 50000, 25000, 10000, 5000, 2000],

maxExtent: new OpenLayers.Bounds(-5133549.56760757, -5397733.44656832,


5397733.44656832, 1667991.36644116),

maxResolution: "auto",

projection: "EPSG:3576",

units: "m"

};

var map = new OpenLayers.Map("map", options);

var wms = new OpenLayers.Layer.WMS("", server, {layers: "crdlin",


format: "aggpng24"}, {singleTile: true} );

map.addLayer(wms);

info = new OpenLayers.Control.WMSGetFeatureInfo({

url: server,

title: 'Identify features by clicking',

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()

],

scales: [100000000, 50000000, 35000000, 25000000, 10000000, 3000000,


1000000, 500000, 300000, 200000, 100000, 50000, 25000, 10000, 5000, 2000],

maxExtent: new OpenLayers.Bounds(-180.00, 40.00, 180.00, 84.00),

maxResolution: "auto",

projection: "EPSG:4326",

units: "dd"

};

var map = new OpenLayers.Map("map", options);

var wms = new OpenLayers.Layer.WMS("", server, {layers: "crdlin",


format: "aggpng24"}, {singleTile: true} );

map.addLayer(wms);

91
info = new OpenLayers.Control.WMSGetFeatureInfo({

url: server,

title: 'Identify features by clicking',

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

# -*- coding: utf-8 -*-

import os

import sys

import web

93
render = web.template.render('templates/', base='layout')

urls = (

"/", "IndexHandler",

"/map/(.*)", "MapHandler",

app = web.application(urls, globals())

class IndexHandler:

def GET(self):

raise web.seeother('/map/')

class MapHandler:

def GET(self, proj):

i = web.input(proj="epsg:3576")

return render.map(i.proj)

if __name__ == '__main__':

web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func, addr)

app.run()

web- /map/,
, , OpenLayers
. .

web- spawn-cgi. Spawn-CGI


Lighttpd, FastCGI,
HTTP-. web-
start.sh:

#!/bin/sh

spawn-fcgi -d /srv/wmsystem/www/ -f /srv/wmsystem/www/app.py -a 127.0.0.1 -p


9002

Spawn-CGI , 9002,
stop.sh:

94
#!/bin/sh

kill `pgrep -f "python /srv/wmsystem/www/app.py"`

, web- ,
.

3.2.4 web-

HTTP-,
.
web-, ,
. ,
, ,
. ,
, .

, : Lighttpd
Nginx. Lighttpd MapServer.
, ,
web-, ,
.

Nginx web- -,
[12]. . Nginx
,
select, epoll (Linux) kqueue (FreeBSD).
.
. ,
. , ,
. ,
, .
-, writev sendfile, nginx
.

Netcraft 2011 , , Nginx,


21,57 , web- . Lighttpd,

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_param REQUEST_METHOD $request_method;

fastcgi_param QUERY_STRING $query_string;

fastcgi_param CONTENT_TYPE $content_type;

fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;

fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;

fastcgi_param REMOTE_PORT $remote_port;

fastcgi_param SERVER_ADDR $server_addr;

fastcgi_param SERVER_PORT $server_port;

fastcgi_param SERVER_NAME $server_name;

fastcgi_param SERVER_PROTOCOL $server_protocol;

fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;

fastcgi_param PATH_INFO $fastcgi_script_name;

fastcgi_pass 127.0.0.1:9002;

:
location /static/ {

root /srv/wmsystem/www;

if (-f $request_filename) {

rewrite ^/static/(.*) /static/$1 break;

96
}

/static/,
/srv/wmsystem/www/static/.

web- wms-,
Nginx. OpenLayers GetFeatureInfo
wms-, ip-
. XSS (Cross Site Scripting
). , ,
wms-.
ip- , :

location /maps {

proxy_set_header X-Forwarded-Host $host;

proxy_set_header X-Forwarded-Server $host;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

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

sortshp layer.shp layer-sort.shp class1 ascending,


class1

,
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;

gzip_types application/x-javascript text/css image/png;

nginx ,
css js-, wms- .
nginx,
:

worker_processes 2;

,
40-60%, web-.

3.4

3.6, 3.7, 3.8, 3.9


.
, MS Internet Explorer, Mozilla Firefox, Google Chrome, Opera.
GRIB, .

103
3.6 Web- EPSG:3576

3.7 Web- EPSG:3576, GRIB


104
3.8 Web- EPSG:4326

3.9 Web- EPSG:4326, GRIB

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

2. A GUIDE TO THE CODE FORM FM 92-IX Ext. GRIB [ ]:


GRIB. : http://www.wmo.int/pages/prog/www/WDM/Guides/Guide-
binary-2.html

3. PROJ.4 - Cartographic Projections Library [ ]:


PROJ.4. : http://trac.osgeo.org/proj/

4. Welcome to MapServer [ ]: MapServer.


: http://mapserver.org/

5. GeoServer is an open source software server [ ]:


GeoServer. : http://geoserver.org/display/GEOS/Welcome

6. Tyler Mitchell: Web Mapping Illustrated / Tyler Mitchell. California: O'Reilly Media, 2005.
368 .

7. FOSS4G WMS Benchmark [ ]: WMS-


. : http://wiki.osgeo.org/wiki/FOSS4G_Benchmark

8. PostGIS Documentation [ ]: PostGIS.


: http://postgis.refractions.net/documentation/

9. Beazley D. Python Essential Reference. New York: Addison-Wesley, 2010. 745 .

10. Hazzard E. OpenLayers 2.10. Birmingham: Packt Publishing Limited, 2011. 372 .

11. Web.py is a web framework for Python that is as simple as it is powerful [ ]:


Web.py. : http://webpy.org/cookbook/

12. HTTP- Nginx [ ]: . :


http://sysoev.ru/nginx/docs/

13. Clement Nedelcu: Nginx HTTP Server / Clement Nedelcu. Birmingham: Packt Publishing
Limited, 2011. 348 .

112
14. . Python 3 / . . -:
-, 2009. 608.

15. .. /
, 2011- 112.

113

You might also like