Embed
Email

php

Document Sample
php
Description

php

Shared by: anusorn kuanha
Stats
views:
24
posted:
11/7/2011
language:
Thai
pages:
18
PHP MapScript





Day 5

PHP Configuration



ใหตรวจสอบวา PHP เรียกใช Extension File ที่ไหน ดูที่



php.ini ในบรรทัดทีมี ขอความ “extension_dir”

extension_dir = /ms4w/Apache/php/ext/

ไปตรวจสอบที่/ms4w/Apache/php/ext/ วามีไฟล



php_mapscript.dll อยูหรือไม

่ 

แกไข php.ini ทีอยูใน D:\ms4w\Apache\cgi-bin ดังนี้

extension= php_mapscript.dll

PHP MapScript Configuration



restart Apache ตรวจสอบการเรียกใช

phpMapScript ด วย phpinfo()

MapScript Architecture

PHP MapScript

phpms-1.php



draw();

$img_url=$img-> saveWebImage();

?>







Example 1: Displaying a map



>





phpms-2.php

….

Navigation

> Full Extent

> Pan

> Zoom In

> Zoom Out

” SIZE=2> Size



Layers

>

อําเภอ

>

ตําบล

>

โรงพยาบาล



>สถานีอนามัย

Map Object



Create Map Object

$map = ms_newMapObj("ex-03.map")

จํานวน Layers

$map->numlayers

Extent

$map->extent->minx

$map->extent->miny

$map->extent->maxx

$map->extent->maxy

setextent(minx, miny, maxx, maxy)

Layer Object



กําหนด Layer ที่ตองการ

$lyr0 = $map->getLayer(0);

จํานวน Class ใน Layer ที่ระบุ

$lyr0 ->numclasses;

ชื่อ Class ใน Layer ที่ระบุ

$class0 = $lyr0->getClass(0);

กําหนด Labelitem

$class0->labelitem

Scale

$class0->maxscale

Class Object



กําหนด Class ใน Layer ที่ระบุ

$class0 = $lyr0->getClass(0);

ชื่อ Class ที่ระบุ

$class0->name;

Style

$cstyle =$class0-> getStyle(0)

Expression ของ Class

$class0-> setexpression(string expression)

$class0-> getexpression(string expression)

Style Object

สรางฐานขอมูลตัวอยาง



http://172.20.26.100/mapdemo.zip

Start Programs PostgreSQL 8.2 Command

Prompt

>createdb –E win874 mapdemo

>psql –U postgres mapsemo psql –U postgres mapsemo

mapdemo=#\d

mapdemo=#\dt c_cancer

mapdemo=#select * from c_cancer limit 10;

mapdemo=#\q

สรางฐานขอมูล PostGIS



Start Programs PostgreSQL 8.2 Command

Prompt

>shp2pgsql province.shp province >province.sql

>psql -U postgres -l

>createdb –E win874 mapserver –T template_postgis

>psql –U postgres mapserver psql –U postgres mapserver

mapserver=#\d

mapserver =#\dt province

mapserver =#\q

PostGIS

CREATE TABLE

Data type “geometry”



ImportData From Vector

shp2pgsql

shp2pgsql province.shp province > province.sql

gr2ogr

ogr2ogr -f "MapInfo File" provinve.tab PG:dbname=gisdb province



-f "ESRI Shapefile"

-f "TIGER"

-f "MapInfo File"

-f "GML"

-f "PostgreSQL"

PHP connect to PostgreSQL

";

echo "";

while ($row = pg_fetch_row($result)) {

echo "";

echo "$row[0]$row[1]";

echo "";

}

echo "";

// Free resultset

pg_free_result($result);

// Closing connection

pg_close($dbconn);

?>

PostGIS

วัดระยะทาง

SELECT distance(the_geom,the_geom)

ี่

พื้นที่ทมีขอบเขตติดตอกัน

SELECT provincename FROM thailand

WHERE touches(thailand.the_geom, (SELECT the_geom

FROM thailand WHERE province =67));

 ี่

ตําแหนงที่อยูในรัศมีทกําหนด

SELECT provincename FROM thailand

WHERE province =67 AND distance(the_geom, SELECT

the_geom

FROM thailand WHERE province =67)<100;

เชื่อมโยงกับ non-spatial data


Related docs
Other docs by anusorn kuanha
Mysql
Views: 31  |  Downloads: 0
keyword
Views: 18  |  Downloads: 0
Apache for Windows Installation
Views: 27  |  Downloads: 0
GoogleAdsense
Views: 10  |  Downloads: 0
link
Views: 62  |  Downloads: 0
InternetMarketing
Views: 0  |  Downloads: 0
seo
Views: 17  |  Downloads: 0
php
Views: 24  |  Downloads: 0
Link Exchange
Views: 13  |  Downloads: 0
Webmaster Tools
Views: 16  |  Downloads: 0
By registering with docstoc.com you agree to our
privacy policy

You are almost ready to download!

You are almost ready to download!