Changes between Version 2 and Version 3 of SWIGMapScriptNewLayer


Ignore:
Timestamp:
Jun 24, 2020, 3:04:19 PM (6 weeks ago)
Author:
Jeff McKenna
Comment:

add point example

Legend:

Unmodified
Added
Removed
Modified
  • SWIGMapScriptNewLayer

    v2 v3  
    2525$oMap->selectoutputformat("png");
    2626
     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//******
    2751// create new WMS layer
     52//******
    2853$oWMSLayer = new layerObj($oMap);
    2954$oWMSLayer->__set("name", "cities");
     
    3863$oWMSLayer->SetProjection("init=EPSG:3978");
    3964
    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);
    4681// create new class for poly layer
    47 $oClass = new classObj($oPolyLayer);
    48 $oClass->__set("name", "Province");
     82$oClass = new classObj($oPointLayer);
     83$oClass->__set("name", "GatewayGeo");
    4984// 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);
    5391$oStyle->__set("color", $oColor);
    5492$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");
    5894
    5995// draw map
     
    6197
    6298// 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);
    64100
    65101// 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");
    67103
    68104// set header
    69 header("Content-type: image/gif");
     105header("Content-type: image/png");
    70106
    71 // read image to output buffer
    72 readfile("C:/ms4w/apps/phpmapscriptng-swig/ttt.png");
     107//send image to stdout, without saving file locally
     108echo $oImage ->getBytes();
    73109
    74110?>