Guest User

Untitled

a guest
Jan 30th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. <?php
  2. if(!isset($_REQUEST['layerId']))
  3. die('Layer Is Not Valid');
  4.  
  5. $layerId=(int)$_REQUEST['layerId'];
  6.  
  7. $map=new mapObj(null);
  8. $map->setFontSet(realpath("lib\server-side\fonts.list"));
  9. $map->setConfigOption("MS_ERRORFILE",__DIR__.("\ms_error.log"));
  10.  
  11. $map->metadata->set('wms_enable_request','GetCapabilities GetMap GetFeatureInfo');
  12. $map->metadata->set('wms_getmap_formatlist','image/png,png,png8,png24');
  13. $map->setProjection("init=epsg:4326");
  14.  
  15. $layer = new LayerObj($map);
  16.  
  17. $layer->set('labelcache', MS_ON);
  18. $layer->setProcessing('LABEL_NO_CLIP=FALSE');
  19. $layer->setProcessing('FORCE2D=YES');
  20.  
  21. $layer->set('name', "MasterLayer");
  22. $layer->set('status', MS_DEFAULT );
  23.  
  24. $layer->setConnectionType(MS_POSTGIS);
  25. $layer->set('connection', "user=postgres password=psgpass dbname=map host=127.0.0.1 port=5432");
  26. $layer->set('data', "geodata from geo_data as subquery using SRID=-1 using unique id ");
  27.  
  28. $layer->set('type', MS_LAYER_POLYGON);
  29.  
  30. $class = new ClassObj( $layer );
  31.  
  32. $style = new StyleObj( $class );
  33. $style->color->setRGB(255,0,0);
  34. $style->set('opacity',100);
  35.  
  36. $request = new Owsrequestobj();
  37. $request->loadparams();
  38. $request->setparameter('REQUEST', 'GetMap');
  39. $request->setparameter('LAYERS', 'MasterLayer');
  40. $request->setparameter('FORMAT', 'png8');
  41.  
  42. ms_ioinstallstdouttobuffer();
  43. $map->owsdispatch($request);
  44.  
  45. $contenttype = ms_iostripstdoutbuffercontenttype();
  46.  
  47. if (!empty($contenttype))
  48. {
  49. header('Content-type: $contenttype');
  50. ms_iogetStdoutBufferBytes();
  51. }
  52. else
  53. echo "Fail to render!";
  54. ms_ioresethandlers();
  55. ?>
Add Comment
Please, Sign In to add comment