Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(!isset($_REQUEST['layerId']))
- die('Layer Is Not Valid');
- $layerId=(int)$_REQUEST['layerId'];
- $map=new mapObj(null);
- $map->setFontSet(realpath("lib\server-side\fonts.list"));
- $map->setConfigOption("MS_ERRORFILE",__DIR__.("\ms_error.log"));
- $map->metadata->set('wms_enable_request','GetCapabilities GetMap GetFeatureInfo');
- $map->metadata->set('wms_getmap_formatlist','image/png,png,png8,png24');
- $map->setProjection("init=epsg:4326");
- $layer = new LayerObj($map);
- $layer->set('labelcache', MS_ON);
- $layer->setProcessing('LABEL_NO_CLIP=FALSE');
- $layer->setProcessing('FORCE2D=YES');
- $layer->set('name', "MasterLayer");
- $layer->set('status', MS_DEFAULT );
- $layer->setConnectionType(MS_POSTGIS);
- $layer->set('connection', "user=postgres password=psgpass dbname=map host=127.0.0.1 port=5432");
- $layer->set('data', "geodata from geo_data as subquery using SRID=-1 using unique id ");
- $layer->set('type', MS_LAYER_POLYGON);
- $class = new ClassObj( $layer );
- $style = new StyleObj( $class );
- $style->color->setRGB(255,0,0);
- $style->set('opacity',100);
- $request = new Owsrequestobj();
- $request->loadparams();
- $request->setparameter('REQUEST', 'GetMap');
- $request->setparameter('LAYERS', 'MasterLayer');
- $request->setparameter('FORMAT', 'png8');
- ms_ioinstallstdouttobuffer();
- $map->owsdispatch($request);
- $contenttype = ms_iostripstdoutbuffercontenttype();
- if (!empty($contenttype))
- {
- header('Content-type: $contenttype');
- ms_iogetStdoutBufferBytes();
- }
- else
- echo "Fail to render!";
- ms_ioresethandlers();
- ?>
Add Comment
Please, Sign In to add comment