require_once '../../incphp/pmsession.php'; $categories['cat_admin'] = array("countries", "cities10000eu", "settlements"); $categories['cat_nature'] = array("rivers", "corine"); $categories['cat_raster'] = array("dem", "jpl_wms_global_mosaic"); $_SESSION['categories'] = $categories; /** * INITIALIZE MAP */ $PM_MAP_FILE = "D:/webdoc/eclipse/pmapper_trunk/config/default/pmapper_demo.map"; $map = ms_newMapObj($PM_MAP_FILE); //print_r($map); $timer->start(); $jsonFile = "dynlayer_def.txt"; $dynLayers = preg_replace(array("/\\s{2,}/", "/\n/"), array(" ", ""), file_get_contents($jsonFile)); $_SESSION['dynLayers'] = json_decode($dynLayers, true); $dyn = new DynLayer($map, json_encode($_SESSION['dynLayers'])); $dyn->createDynLayers(); //$map->getLayerByName("cities_1")->set("status", MS_ON); $map->getLayerByName("cities_2")->set("status", MS_ON); $map->getLayerByName("countries")->set("status", MS_ON); //print_r($map->getAllLayerNames()); $map->selectOutputFormat("png"); $map_img = $map->draw(); $map_url = $map_img->saveWebImage(); require_once '../../incphp/common.php'; PMCommon::freeMsObj($map_img); #$timer->stop(); #$timer->display(); $map->save("D:/webdoc/tmp/dynlayer.map"); $dynJson = json_decode($dynLayers); $lay1 = $dynJson->newlayers->layerlist->cities_1;
public function __construct($map) { parent::__construct($map); $this->layerSrcType = "TXT"; }
* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with p.mapper; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * ******************************************************************************/ // prevent XSS if (isset($_REQUEST['_SESSION'])) { exit; } //require_once("../../incphp/group.php"); require_once "../../incphp/pmsession.php"; require_once "../../incphp/globals.php"; require_once "../../incphp/common.php"; require_once "../../incphp/map/dynlayer.php"; // get dynlayer definition from text file $jsonFile = "dynlayer_def.txt"; $dynLayers = preg_replace(array("/\\s{2,}/", "/\n/"), array(" ", ""), file_get_contents($jsonFile)); $_SESSION['dynLayers'] = json_decode($dynLayers, true); // create and initialize dynlayers ##error_log("ajax"); $dyn = new DynLayer($map, $dynLayers); //$dyn = new DynLayer($map, json_encode($_SESSION['dynLayers'])); $dyn->initDynLayers(true); $activeLayers = json_encode($dyn->getActiveLayers()); //$map->save("D:/webdoc/tmp/dynlayer.map"); header("Content-type: text/plain; charset={$defCharset}"); echo "{\"activeLayers\":{$activeLayers}}";