本文整理汇总了PHP中ms_newLayerObj函数的典型用法代码示例。如果您正苦于以下问题:PHP ms_newLayerObj函数的具体用法?PHP ms_newLayerObj怎么用?PHP ms_newLayerObj使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ms_newLayerObj函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createDynLayer
/**
* creates dynamic layer based on text definition (map file syntax)
* layer is then added to map object
*/
protected function createDynLayer($layerName, $layerString)
{
//error_log($layerString);
$dynLayer = ms_newLayerObj($this->map);
$dynLayer->updateFromString($layerString);
$this->setLayerParameters($dynLayer);
}
示例2: url_createLayer
private function url_createLayer()
{
if (!is_file($_SESSION['PM_TPL_MAP_FILE'])) {
error_log("P.MAPPER ERROR: cannot find template map. Check INI settings for 'tplMapFile'");
return false;
}
$tplMap = ms_newMapObj($_SESSION['PM_TPL_MAP_FILE']);
$poiLayer = $tplMap->getLayerByName("poi");
$txtLayer = ms_newLayerObj($this->map, $poiLayer);
$txtLayer->set("name", "url_txtlayer");
$txtLayer->set("type", 0);
$txtLayer->set("status", MS_ON);
$url_points = $_SESSION['url_points'];
foreach ($url_points as $upnt) {
// Create line, add xp point, create shape and add line and text, add shape to layer
//$pointList = explode(",", $f);
$px = $upnt[0];
$py = $upnt[1];
$txt = $upnt[2];
$newLine = ms_newLineObj();
$newLine->addXY($px, $py);
$newShape = ms_newShapeObj(0);
$newShape->add($newLine);
$newShape->set("text", $txt);
$txtLayer->addFeature($newShape);
}
}
示例3: gml2wkt
function gml2wkt($gml)
{
// Parse GML file
include "funcoes_gerais.php";
$k = array_keys($_GET);
session_name("i3GeoPHP");
session_id($_GET[$k[0]]);
session_start();
//var_dump($_SESSION);exit;
$nome = $_SESSION["dir_tmp"] . "/gml_" . nomeRandomico();
$nomegml = $nome . ".gml";
$nomemap = $_SESSION["map_file"];
$gml = str_replace("xsi:schemaLocation", "erro", $gml);
gravaDados(array($gml), $nomegml);
$map = new mapObj($nomemap);
$layer = ms_newLayerObj($map);
$layer->setConnectionType(MS_OGR);
$layer->set("connection", $nomegml);
$layer->set("template", "none.html");
$layer->set("type", MS_LAYER_POLYGON);
$layer->set("name", $nome);
$layer->set("status", MS_DEFAULT);
$layer->setmetadata("tema", $nome);
$classe = ms_newClassObj($layer);
$novoestilo = ms_newStyleObj($classe);
$ncor = $novoestilo->color;
$ncor->setrgb(255, 255, 255);
//$map->save($nomemap);
//exit;
$layer->queryByrect($map->extent);
$sopen = $layer->open();
$shape = $layer->getShape($layer->getResult(0));
$wkt = $shape->towkt();
return json_encode(array($wkt));
}
示例4: markerclusterMapfile
function markerclusterMapfile()
{
global $dir, $map_file, $layer, $base, $locaplic, $dir_tmp, $postgis_mapa;
if (empty($map_file) && file_exists($dir . "/../../temas/{$layer}.map")) {
$versao = versao();
$versao = $versao["principal"];
if (!isset($base) || $base == "") {
if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) {
$base = $locaplic . "/aplicmap/geral1windowsv" . $versao . ".map";
} else {
if ($base == "" && file_exists('/var/www/i3geo/aplicmap/geral1debianv' . $versao . '.map')) {
$base = "/var/www/i3geo/aplicmap/geral1debianv" . $versao . ".map";
}
if ($base == "" && file_exists('/var/www/html/i3geo/aplicmap/geral1fedorav' . $versao . '.map')) {
$base = "/var/www/html/i3geo/aplicmap/geral1fedorav" . $versao . ".map";
}
if ($base == "" && file_exists('/opt/www/html/i3geo/aplicmap/geral1fedorav' . $versao . '.map')) {
$base = "/opt/www/html/i3geo/aplicmap/geral1v" . $versao . ".map";
}
if ($base == "") {
$base = $locaplic . "/aplicmap/geral1v" . $versao . ".map";
}
}
}
$map_file = $dir_tmp . "/" . nomeRandomico() . ".map";
$mapa = ms_newMapObj($base);
$tempMapa = ms_newMapObj($dir . "/../../temas/{$layer}.map");
$layern = $tempMapa->getlayer(0);
restauraConObj($mapa, $postgis_mapa);
ms_newLayerObj($mapa, $layern);
$mapa->save($map_file);
}
return $map_file;
}
示例5: draw_header
function draw_header($map, $img, $width, $height)
{
/*
* Draw the black bar at the top of the screen
*/
$layer = ms_newLayerObj($map);
$layer->set("status", MS_ON);
$layer->set("type", MS_LAYER_POLYGON);
$layer->set("transform", MS_OFF);
$wkt = "POLYGON((0 0, 0 {$height}, {$width} {$height}, {$width} 0, 0 0))";
$layer->addFeature(ms_shapeObjFromWkt($wkt));
$layerc0 = ms_newClassObj($layer);
$layerc0s0 = ms_newStyleObj($layerc0);
$layerc0s0->color->setRGB(0, 0, 0);
$layer->draw($img);
}
示例6: mktitle
function mktitle($map, $imgObj, $titlet, $subtitle = "", $width = 640)
{
$height = $subtitle == "" ? 36 : 53;
$layer = ms_newLayerObj($map);
$layer->set("status", MS_ON);
$layer->set("type", MS_LAYER_POLYGON);
$layer->set("transform", MS_OFF);
$wkt = "POLYGON((0 0, 0 {$height}, {$width} {$height}, {$width} 0, 0 0))";
$layer->addFeature(ms_shapeObjFromWkt($wkt));
$layerc0 = ms_newClassObj($layer);
$layerc0s0 = ms_newStyleObj($layerc0);
$layerc0s0->color->setRGB(0, 0, 0);
$layer->draw($imgObj);
$tlayer = $map->getLayerByName("iem_headerbar_title");
$point = ms_newpointobj();
$point->setXY(82, 22);
$point->draw($map, $tlayer, $imgObj, 0, $titlet);
if ($subtitle != "") {
$point = ms_newpointobj();
$point->setXY(82, 39);
$point->draw($map, $tlayer, $imgObj, 1, $subtitle);
}
}
示例7: autoClasses
if ($lcon == " " || $lcon == "" || in_array($lcon, array_keys($postgis_mapa))) {
//
//o metadata CONEXAOORIGINAL guarda o valor original para posterior substituição
//
if ($lcon == " " || $lcon == "") {
$l->set("connection", $postgis_mapa);
$l->setmetadata("CONEXAOORIGINAL", $lcon);
} else {
$l->set("connection", $postgis_mapa[$lcon]);
$l->setmetadata("CONEXAOORIGINAL", $lcon);
}
}
}
}
autoClasses($l, $oMap);
ms_newLayerObj($oMap, $l);
$oMap->save($nomeMapfileTmp);
validaAcessoTemas($nomeMapfileTmp, true);
$oMap = ms_newMapobj($nomeMapfileTmp);
restauraCon($nomeMapfileTmp, $postgis_mapa);
$layer = $oMap->getlayerbyname($tema);
if ($layer == "") {
echo "Layer nao encontrado";
exit;
}
$data = pegaDadosJ();
$format = $_GET["format"];
$jsonp = $_GET["jsonp"];
if ($format == "storymap") {
//parametros via URL
$storymap = $layer->getmetadata("storymap");
示例8: __construct
function __construct()
{
if (\app\inc\Input::getPath()->part(3) == "tilecache") {
$postgisschema = \app\inc\Input::getPath()->part(4);
} else {
$postgisschema = \app\inc\Input::getPath()->part(3);
}
$db = \app\inc\Input::getPath()->part(2);
$dbSplit = explode("@", $db);
if (sizeof($dbSplit) == 2) {
$db = $dbSplit[1];
}
$path = App::$param['path'] . "/app/wms/mapfiles/";
$name = $db . "_" . $postgisschema . ".map";
$oMap = new \mapObj($path . $name);
$request = new \OWSRequestObj();
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
foreach ($_GET as $k => $v) {
if (strtolower($k) == "layers" || strtolower($k) == "layer" || strtolower($k) == "typename" || strtolower($k) == "typenames") {
$layers = $v;
}
$request->setParameter($k, $v);
}
} else {
$request->loadParams();
}
if ($_SESSION['http_auth'] != $db) {
\app\models\Database::setDb($db);
$postgisObject = new \app\inc\Model();
foreach (explode(",", $layers) as $layer) {
$auth = $postgisObject->getGeometryColumns($layer, "authentication");
$layerSplit = explode(".", $layer);
$HTTP_FORM_VARS["TYPENAME"] = $layerSplit[1];
if ($auth == "Read/write") {
include 'inc/http_basic_authen.php';
} else {
include 'inc/http_basic_authen_subuser.php';
}
}
}
if ($_GET['sql_layer']) {
include '../libs/functions.php';
include '../conf/main.php';
$postgisdb = "mydb";
$request->setParameter("SLD_BODY", "<StyledLayerDescriptor version='1.1.0'><NamedLayer><Name>sql</Name><UserStyle><Title>xxx</Title><FeatureTypeStyle><Rule><LineSymbolizer><Stroke><CssParameter name='stroke'>#FFFF00</CssParameter><CssParameter name='stroke-width'>15</CssParameter></Stroke></LineSymbolizer></Rule></FeatureTypeStyle></UserStyle></NamedLayer></StyledLayerDescriptor>\n ");
$postgisObj = new postgis();
$postgisObj2 = new postgis();
$view = "public.hello";
$sqlView = "CREATE VIEW {$view} as " . urldecode($_GET['sql_layer']);
$postgisObj->connect();
$postgisObj->execQuery($sqlView);
$postgisObj->execQuery("CREATE SEQUENCE _serial START 1");
$arrayWithFields = $postgisObj2->getMetaData($view);
foreach ($arrayWithFields as $key => $arr) {
if ($arr['type'] == "geometry") {
$fieldsArr[] = "transform(" . $key . ",900913) as the_geom";
} else {
$fieldsArr[] = $key;
}
}
$fieldsArr[] = "nextval('_serial') as _serial";
$sql = implode(",", $fieldsArr);
$sql = "SELECT {$sql} FROM {$view}";
$request->setParameter("LAYERS", $_GET['LAYERS'] . ",sql");
$layer = ms_newLayerObj($oMap);
$layer->updateFromString("\n\tLAYER\n\t\tNAME 'sql'\n\t\tSTATUS off\n\t\tPROCESSING 'CLOSE_CONNECTION=DEFER'\n\t\tDATA \"the_geom from ({$sql}) as foo using unique _serial using srid=900913\"\n\t\tTYPE POLYGON\n\t\tCONNECTIONTYPE POSTGIS\n\t\tCONNECTION 'user=postgres dbname=mydb host=127.0.0.1'\n\t\tMETADATA\n\t\t 'wms_title' 'sql'\n\t\t 'wms_srs' 'EPSG:4326'\n\t\t 'wms_name' 'sql'\n\t\tEND\n\t\tPROJECTION\n\t\t 'init=epsg:900913'\n\t\tEND\n\t\tCLASS\n\t\t NAME 'New style'\n\t\t STYLE\n\t\t\tOUTLINECOLOR 255 0 0\n\t\t END\n \t\tEND\n \tEND\n\t");
}
ms_ioinstallstdouttobuffer();
$oMap->owsdispatch($request);
if ($_GET['sql_layer']) {
$sql = "DROP VIEW {$view}";
$result = $postgisObj->execQuery($sql);
}
$contenttype = ms_iostripstdoutbuffercontenttype();
if ($contenttype == 'image/png') {
header('Content-type: image/png');
} else {
header('Content-type: text/xml');
}
ms_iogetStdoutBufferBytes();
ms_ioresethandlers();
}
示例9: ms_newLayerObj
$e_track = ms_newLayerObj($e_map);
$e_track->set('name', 'temptrack');
$e_track->set('status', MS_ON);
$e_track->set('type', MS_LAYER_LINE);
$e_track->addFeature($e_shape);
$e_class = ms_newClassObj($e_track);
$e_style = ms_newStyleObj($e_class);
$e_style->color->setRGB(255, 255, 20);
$e_style->set("size", 3);
$e_style->set("symbolname", 'circle');
$e_shapestart = ms_newShapeObj(MS_SHAPE_POINT);
$e_line = ms_newLineObj();
list($px, $py) = split(' ', $_SESSION['track'][0]);
$e_line->addXY($px, $py);
$e_shapestart->add($e_line);
$e_track3 = ms_newLayerObj($e_map);
$e_track3->set('name', 'temptrackstart');
$e_track3->set('status', MS_ON);
$e_track3->set('type', MS_LAYER_POINT);
$e_track3->addFeature($e_shapestart);
$e_class3 = ms_newClassObj($e_track3);
$e_style3 = ms_newStyleObj($e_class3);
$e_style3->set("symbolname", 'flag2');
}
$e_image = $e_map->draw();
$image = $e_image->saveWebImage();
$e_ref = $e_map->drawreferencemap();
$refsrc = $e_ref->saveWebImage('MS_PNG', 0, 0, -1);
// affichage l?gende
if ($e_map->scale < $minscaledispscan100legend) {
$smarty->assign('booldisplegscan100', true);
示例10: ms_newPointObj
$ia511 = $map->getlayerbyname("ia511");
$c0 = $ia511->getClass(0);
$s0 = $c0->getStyle(0);
$s0->set("symbolname", "ia511-8bit");
if (!$metroview) {
//$ia511->draw($img);
$pt = ms_newPointObj();
$pt->setXY(555, 160);
//$pt->draw($map, $ia511, $img, 0, "");
}
$logokey2 = $map->getlayerbyname("colorkey");
$c1 = $logokey2->getClass(0);
$s1 = $c1->getStyle(0);
$s1->set("symbolname", "logokey-8bit");
$s1->set("size", 60);
$logokey = ms_newLayerObj($map);
$logokey->set("type", MS_SHP_POINT);
$logokey->set("transform", MS_FALSE);
$logokey->set("status", MS_ON);
$logokey->set("labelcache", MS_ON);
$logokey_c3 = ms_newClassObj($logokey);
$logokey_c3s0 = ms_newStyleObj($logokey_c3);
//$logokey_c3s0->set("symbolname", "iem");
//$logokey_c3s0->set("size", 45);
$l = $logokey_c3->addLabel(new labelObj());
$logokey_c3->getLabel(0)->set("buffer", 10);
$logokey_c3->getLabel(0)->set("type", MS_BITMAP);
$logokey_c3->getLabel(0)->set("size", MS_MEDIUM);
$logokey_c3->getLabel(0)->color->setRGB(0, 0, 0);
$bpt = ms_newpointobj();
$bpt->setXY(300, 300);
示例11: updateMapfile
function updateMapfile($layer_tablename,$hex_colors,$expressions,$classitem) {
if (PHP_OS == "WINNT" || PHP_OS == "WIN32") {
define( "MODULE", "php_mapscript.dll" );
// load the mapscript module
if (!extension_loaded("MapScript")) dl(MODULE);
} else {
dl("php_mapscript.so");
}
$FILEPATH = $_SERVER['SCRIPT_FILENAME'];
// remove the file name and append the new directory name
if (PHP_OS == "WINNT" || PHP_OS == "WIN32") {
$pos1 = strrpos($FILEPATH,'\\');
$FILEPATH= substr($FILEPATH,0,$pos1)."\\choropleth\\";
}else{
$pos1 = strrpos($FILEPATH,'/');
$FILEPATH= substr($FILEPATH,0,$pos1)."/choropleth/";
}
$base_path = base_path();
global $user;
$ret_file= array();
//global $db_url;
$layer_type ='';
$query = "select layer_type from \"Meta_Layer\" where layer_tablename='".$layer_tablename."'";
$result = db_query($query);
if($obj = db_fetch_object($result)){
switch($obj->layer_type){
case 'POLYGON':
case 'MULTIPOLYGON':
$layer_type = 'polygon';
break;
case 'LINESTRING':
case 'MULTILINESTRING':
$layer_type = 'line';
break;
case 'POINT':
case 'MULTIPOINT':
$layer_type = 'point';
break;
}
}
$mapfilename = $layer_tablename;
// $dbpasswd = substr($db_url,$index2,$index2-$index1);
// $dbuser = preg_replace('/pgsql:\/\/(.*)@[^@]*/','$1',$db_url);
// $dbname = substr(strrchr($db_url,'/'),1);
// if(strpos($dbuser,':') >= 0) {
// list($dbuser,$dbpasswd) = split(":",$dbuser);
// } else {
// $dbpasswd = "";
// }
$name = $FILEPATH.$mapfilename.".map";
/* create a file */
$fh = fopen($name,"w");
fwrite($fh,"map\n");
fwrite($fh,"end");
fclose($fh);
/* create new map object and set the parameters */
$map = ms_newMapObj($name);
$map->setExtent(60,0,100,40);
$map->setSize(725,800);
$map->set("units",MS_DD);
$map->setProjection("init=epsg:4326");
$map->set("maxsize",4096);
$map->selectOutputFormat('PNG');
$map->outputformat->set("transparent", MS_ON);
$map->outputformat->set("imagemode", "rgba");
$map->outputformat->setOption("formatoption","INTERLACE=OFF");
//web object
$map->setMetaData("wms_srs","epsg:4326 epsg:2805 epsg:24600 epsg:54004 EPSG:900913");
/* set layer specific parameters */
$layer = ms_newLayerObj($map);
$layer->set("name",$layer_tablename);
switch($layer_type){
case 'polygon':
$layer->set("type", MS_LAYER_POLYGON);
break;
case 'line':
$layer->set("type", MS_LAYER_LINE);
break;
case 'point':
$layer->set("type", MS_LAYER_POINT);
}
$layer->set("status", MS_ON);
$layer->set("connectiontype",MS_POSTGIS);
$layer->set("connection", getDBConnectionString());
/*
if("" == $dbpasswd) {
$layer->set("connection","user=".$dbuser." dbname=".$dbname." host=localhost");
} else {
$layer->set("connection","user=".$dbuser." password=".$dbpasswd." dbname=".$dbname." host=localhost");
//.........这里部分代码省略.........
示例12: unlink
unlink($dirmap . "/" . $nomePrefixo . ".shx");
unlink($dirmap . "/" . $nomePrefixo . ".dbf");
unlink($dirmap . "/" . $nomePrefixo . ".shp");
exit;
}
$arqshp = $dir_tmp . "/" . $nomePrefixo . ".shp";
//pega os parametros de conexao
include "classe_metaestat.php";
$m = new Metaestat();
$conexao = $m->listaConexao($_POST["i3GEOuploadcodigoconexao"], true);
//array(5) { ["codigo_estat_conexao"]=> string(1) "1" ["bancodedados"]=> string(8) "geosaude" ["host"]=> string(9) "localhost" ["porta"]=> string(4) "5432" ["usuario"]=> string(8) "postgres" }
//pega as colunas do shapefile
$shapefileObj = ms_newShapefileObj($arqshp, -1);
$numshapes = $shapefileObj->numshapes;
$mapObj = ms_newMapObjFromString("MAP END");
$layer = ms_newLayerObj($mapObj);
$layer->set("data", $arqshp);
if (file_exists($dir_tmp . "/" . $nomePrefixo . ".prj")) {
$layer->setprojection("AUTO");
}
$layer->open();
$colunasTemp = $layer->getItems();
$colunas = array();
foreach ($colunasTemp as $c) {
//abaixo gid e forcado a entrar
if (!is_numeric($c) && strtolower($c) != "gid") {
$colunas[] = $c;
}
}
echo "<br>Numshapes existentes no SHP: " . $numshapes;
$tipo = $shapefileObj->type;
示例13: sobeAnno
function sobeAnno($map_file)
{
$mapa = ms_newMapObj($map_file);
$numlayers = $mapa->numlayers;
for ($i = 0; $i < $numlayers; ++$i) {
$layer = $mapa->getlayer($i);
if ($layer->type == 4) {
$temp = ms_newLayerObj($mapa, $layer);
$layer->set("status", MS_DELETE);
}
}
$mapa->save($map_file);
}
示例14: criaToponimia
function criaToponimia($item, $position, $partials, $offsetx, $offsety, $minfeaturesize, $mindistance, $force, $shadowcolor, $shadowsizex, $shadowsizey, $outlinecolor, $cor, $sombray, $sombrax, $sombra, $fundo, $angulo, $tamanho, $fonte, $tipo, $wrap, $novotema = "sim")
{
error_reporting(0);
if (!$this->layer) {
return "erro";
}
$this->removeToponimia();
if (!isset($tipo)) {
$tipo = "";
}
if ($item != "") {
if ($novotema == "sim") {
$nome = pegaNome($this->layer);
$novolayer = ms_newLayerObj($this->mapa, $this->layer);
$nomer = nomeRandomico();
$novolayer->set("name", $nomer);
$novolayer->set("group", "");
$novolayer->set("type", $this->layer->type);
$nclasses = $novolayer->numclasses;
for ($i = 0; $i < $nclasses; ++$i) {
$c = $novolayer->getclass($i);
$c->set("status", MS_DELETE);
}
$novac = ms_newClassObj($novolayer);
$novolayer->set("status", MS_DEFAULT);
$novolayer->setmetadata("tema", "texto de " . $nome);
$novolayer->setmetadata("tip", "");
$novolayer->setmetadata("tiles", "nao");
$novolayer->setmetadata("identifica", "nao");
$novolayer->set("labelitem", $item);
} else {
$nomer = $this->layer->name;
$novolayer = $this->mapa->getlayerbyname($nomer);
}
$novolayer->setmetadata("cache", "");
$this->layer = $novolayer;
} else {
//$novac = $this->layer->getclass(0);
$nomer = $this->layer->name;
}
if (!($this->vi >= 60200)) {
$this->layer->set("labelitem", $item);
}
$nclasses = $this->layer->numclasses;
for ($i = 0; $i < $nclasses; ++$i) {
$novac = $this->layer->getclass($i);
if ($this->vi >= 60200) {
//$indiceLabel = $novac->addLabel(new labelObj());
$s = "CLASS LABEL TEXT '[" . $item . "]' END END";
$novac->updateFromString($s);
$label = $novac->getLabel($indiceLabel);
} else {
$label = $novac->label;
}
if ($wrap != "") {
$label->set("maxlength", 1);
$s = $novac->getTextString;
$s = "CLASS LABEL WRAP '{$wrap}' END END";
$novac->updateFromString($s);
}
if ($this->vi >= 60200) {
$label = $novac->getLabel($indiceLabel);
} else {
$label = $novac->label;
}
if ($fonte != "bitmap") {
//$label->set("type",MS_TRUETYPE);
$label->updatefromstring("LABEL TYPE TRUETYPE END");
$label->set("font", $fonte);
$label->set("size", $tamanho);
} else {
//$label->set("type",MS_BITMAP);
$label->updatefromstring("LABEL TYPE BITMAP END");
//$label->set("font",$fonte);
$t = MS_TINY;
if ($tamanho > 5) {
$t = MS_TINY;
}
if ($tamanho >= 7) {
$t = MS_SMALL;
}
if ($tamanho >= 10) {
$t = MS_MEDIUM;
}
if ($tamanho >= 12) {
$t = MS_LARGE;
}
if ($tamanho >= 14) {
$t = MS_GIANT;
}
$label->set("size", $t);
}
if ($angulo > 0) {
$label->set("angle", $angulo);
}
if ($angulo == "AUTO") {
$label->updatefromstring("LABEL ANGLE AUTO END");
}
if (strtoupper($angulo) == "CURVO" || strtoupper($angulo) == "FOLLOW") {
$label->updatefromstring("LABEL ANGLE FOLLOW END");
//.........这里部分代码省略.........
示例15: pontoEmPoligono
//.........这里部分代码省略.........
foreach ($items as $ni) {
$def[] = array("I" . $conta, "C", "254");
$nomesitens[] = "Tema: " . $layer->name . ", Item: " . $ni . " Novo: I" . $conta . "<br>";
$conta = $conta + 1;
}
}
if ($this->dbaseExiste == false) {
$db = xbase_create($nomeshp . ".dbf", $def);
xbase_close($db);
} else {
$db = dbase_create($nomeshp . ".dbf", $def);
dbase_close($db);
}
// acrescenta os pontos no novo shapefile
$dbname = $nomeshp . ".dbf";
if ($this->dbaseExiste == false) {
$db = xbase_open($dbname, 2);
} else {
$db = dbase_open($dbname, 2);
}
// cria o shapefile
$novoshpf = ms_newShapefileObj($nomeshp, MS_SHP_POINT);
foreach ($spts as $spt) {
foreach ($itemspt as $ni) {
$reg[] = $this->truncaS($spt->values[$ni]);
}
$novoshpf->addShape($spt);
$lineo = $spt->line(0);
$pt = $lineo->point(0);
// faz a pesquisa
// error_reporting(0);
foreach ($layers as $layer) {
$layer->set("template", "none.htm");
$layer->set("toleranceunits", MS_PIXELS);
$layer->set("tolerance", 1);
$ident = @$layer->queryByPoint($pt, 0, 0);
if ($ident == "MS_SUCCESS") {
$itens = $listaItens[$layer->name];
$sopen = $layer->open();
if ($sopen == MS_FAILURE) {
return "erro";
}
if ($layer->getResult(0) !== FALSE) {
if ($this->v >= 6) {
$shape = $layer->getShape($layer->getResult(0));
} else {
$result = $layer->getResult(0);
$shp_index = $result->shapeindex;
$shape = $layer->getfeature($shp_index, -1);
}
foreach ($itens as $item) {
$p = $this->truncaS($shape->values[$item]);
if (empty($p)) {
$p = "-";
}
$reg[] = $p;
}
} else {
foreach ($itens as $item) {
$reg[] = "???";
}
}
} else {
foreach ($itens as $item) {
$reg[] = "???";
}
}
$layer->close();
}
if ($this->dbaseExiste == false) {
xbase_add_record($db, $reg);
} else {
dbase_add_record($db, $reg);
}
$reg = array();
}
if ($this->dbaseExiste == false) {
xbase_close($db);
} else {
dbase_close($db);
}
$novolayer = ms_newLayerObj($this->mapa, $layerPt);
$novolayer->set("data", $nomeshp . ".shp");
$novolayer->set("name", $nomefinal);
$novolayer->setmetadata("TEMA", "Cruzamento (" . $nomefinal . ")");
$novolayer->setmetadata("TEMALOCAL", "SIM");
$novolayer->setmetadata("DOWNLOAD", "SIM");
$novolayer->setmetadata("ITENS", "");
$novolayer->setmetadata("ITENSDESC", "");
$novolayer->setmetadata("CACHE", "");
if (ms_GetVersionInt() > 50201) {
$novolayer->setconnectiontype(MS_SHAPEFILE);
} else {
$novolayer->set("connectiontype", MS_SHAPEFILE);
}
if (file_exists($this->qyfile)) {
unlink($this->qyfile);
}
return implode(" ", $nomesitens);
}