Advertisement
Guest User

PHP Mapscript example

a guest
Oct 15th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.70 KB | None | 0 0
  1. <?php
  2. ini_set('display_startup_errors', 1);
  3. ini_set('display_errors', 1);
  4. error_reporting(E_ALL);
  5.  
  6. include("../lib/mapscript.php");
  7.  
  8. $image_url = "";
  9.  
  10. $map = new mapObj("./test_points.map");
  11.  
  12. if (isset($_REQUEST['type'])) {
  13.                 if ($_REQUEST['type'] == "kml") {
  14.                                $map->selectOutputFormat('kml');
  15.                                $img = $map->draw();
  16.                                $map->drawLabelCache($img);
  17.                                $img->save("test_points.kml", $map);
  18.                 }
  19. }
  20. else {
  21.                 $image_url = "./test_points.png";
  22.                
  23.                 $img=$map->draw();
  24.                 $img->save($image_url);
  25. }
  26.  
  27. ?>
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement