forked from MapServer/MapServer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_draw_map.phtml
More file actions
69 lines (55 loc) · 1.18 KB
/
test_draw_map.phtml
File metadata and controls
69 lines (55 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<HTML>
<BODY BGCOLOR="#CCCCCC">
<CENTER>
<H1>PHP/MapScript module test</H1>
<P>
<?php
//
// This example opens a regular MapServer .MAP file, renders the main
// Map image (with the default layers enabled), the legend and the
// scale bar, and displays them in the HTML output.
//
//
// Load MapScript module.
//
if (PHP_OS == "WINNT" || PHP_OS == "WIN32")
{
dl("php_mapscript.dll");
}
else
{
dl("php_mapscript.so");
}
//
// Load MapServer .map file
//
// You can download the MapServer demo data from http://mapserver.gis.umn.edu/
//
$map = ms_newMapObj("demo.map");
// print $map->numlayers;
// phpinfo();
//
// RENDER MAIN MAP
//
// Note: If you get errors with the saveWebImage() call below, then make sure
// that the directory specified by IMAGEPATH in the .MAP file exists and is
// writable by the httpd user.
//
$img = $map->draw();
$url = $img->saveWebImage();
printf("<IMG SRC=%s WIDTH=%d HEIGHT=%d>\n", $url, $map->width, $map->height);
//
// LEGEND
//
$img = $map->drawLegend();
$url = $img->saveWebImage();
printf("<P><IMG SRC=%s>\n", $url);
//
// SCALE BAR
//
$img = $map->drawScaleBar();
$url = $img->saveWebImage();
printf("<P><IMG SRC=%s>\n", $url);
?>
</BODY>
</HTML>