Changes between Version 2 and Version 3 of SWIGMapScriptNewLayer
- Timestamp:
- 2020-06-24T15:04:19-03:00 (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
SWIGMapScriptNewLayer
v2 v3 25 25 $oMap->selectoutputformat("png"); 26 26 27 //****** 28 // create new polygon layerObj 29 //****** 30 $oPolyLayer = new layerObj($oMap); 31 $oPolyLayer->__set("name", "prov_bound"); 32 $oPolyLayer->__set("type", MS_LAYER_POLYGON); 33 $oPolyLayer->__set("status", MS_ON); 34 $oPolyLayer->__set("data", "province.shp"); 35 // create new class for poly layer 36 $oClass = new classObj($oPolyLayer); 37 $oClass->__set("name", "Province"); 38 // create new style 39 $oStyle = new styleObj(); 40 // create new colors 41 $oColor = new colorObj(120,120,120); 42 $oOutlineColor = new colorObj(0,0,0); 43 $oStyle->__set("color", $oColor); 44 $oStyle->__set("outlinecolor", $oOutlineColor); 45 $oClass->insertStyle($oStyle); 46 $oPolyLayer->SetProjection("init=EPSG:3978"); 47 // set opacity (actually creates a new COMPOSITE object) 48 $oPolyLayer->setOpacity(40); 49 50 //****** 27 51 // create new WMS layer 52 //****** 28 53 $oWMSLayer = new layerObj($oMap); 29 54 $oWMSLayer->__set("name", "cities"); … … 38 63 $oWMSLayer->SetProjection("init=EPSG:3978"); 39 64 40 // create new polygon layer 41 $oPolyLayer = new layerObj($oMap); 42 $oPolyLayer->__set("name", "prov_bound"); 43 $oPolyLayer->__set("type", MS_LAYER_POLYGON); 44 $oPolyLayer->__set("status", MS_ON); 45 $oPolyLayer->__set("data", "province"); 65 //****** 66 // create new point layerObj 67 //****** 68 $oPointLayer = new layerObj($oMap); 69 $oPointLayer->__set("name", "gg-location"); 70 $oPointLayer->__set("type", MS_LAYER_POINT); 71 $oPointLayer->__set("status", MS_ON); 72 $oPointLayer->__set("units", "DD"); 73 $oPoint = new pointObj(-64.2576966,44.3596731); 74 // create new lineObj (lineObj is composed of one or more pointObj instances) 75 $oline = new lineObj(); 76 $oline->add($oPoint); 77 // create shapeObj for point 78 $oShape = new shapeObj(); 79 $oShape->add($oline); 80 $oPointLayer->addFeature($oShape); 46 81 // create new class for poly layer 47 $oClass = new classObj($oPo lyLayer);48 $oClass->__set("name", " Province");82 $oClass = new classObj($oPointLayer); 83 $oClass->__set("name", "GatewayGeo"); 49 84 // create new style 50 $oStyle = new styleObj(); 51 // create new color 52 $oColor = new colorObj(120,120,120); 85 $oStyle = new styleObj(); 86 // set symbol 87 $oStyle->setSymbolByName($oMap, "star"); 88 $oStyle->__set("size", 10); 89 // create new colors 90 $oColor = new colorObj(255,255,0); 53 91 $oStyle->__set("color", $oColor); 54 92 $oClass->insertStyle($oStyle); 55 $oPolyLayer->SetProjection("init=EPSG:3978"); 56 // set opacity (actually creates a new COMPOSITE object) 57 $oPolyLayer->setOpacity(40); 93 $oPointLayer->SetProjection("init=EPSG:4326"); 58 94 59 95 // draw map … … 61 97 62 98 // save image file 63 $file = $oImage->save("C:/ms4w/apps/phpmapscriptng-swig/ttt.png",$oMap);99 //$file = $oImage->save("C:/ms4w/apps/phpmapscriptng-swig/ttt.png",$oMap); 64 100 65 101 // save mapfile to new file 66 $oMap->save("C:/ms4w/apps/phpmapscriptng-swig/output.map");102 //$oMap->save("C:/ms4w/apps/phpmapscriptng-swig/output.map"); 67 103 68 104 // set header 69 header("Content-type: image/ gif");105 header("Content-type: image/png"); 70 106 71 // read image to output buffer72 readfile("C:/ms4w/apps/phpmapscriptng-swig/ttt.png");107 //send image to stdout, without saving file locally 108 echo $oImage ->getBytes(); 73 109 74 110 ?>