function ClearFeatureSource($featureService, $dataSourceId, $featureName) { $deleteCmd = new MgDeleteFeatures($featureName, "KEY > 0"); $commands = new MgFeatureCommandCollection(); $commands->Add($deleteCmd); $featureService->UpdateFeatures($dataSourceId, $commands, false); }
function ShowSpatialFilter() { $result = true; $sdfResId = new MgResourceIdentifier('Session:' . $this->args['SESSION'] . '//Filter.FeatureSource'); $resourceService = $this->site->CreateService(MgServiceType::ResourceService); $featureService = $this->site->CreateService(MgServiceType::FeatureService); $updateCommands = new MgFeatureCommandCollection(); $map = new MgMap(); $map->Open($resourceService, $this->args['MAPNAME']); $layer = null; $layers = $map->GetLayers(); if ($layers->Contains('_QuerySpatialFilter')) { $layer = $layers->GetItem('_QuerySpatialFilter'); $updateCommands->Add(new MgDeleteFeatures('Filter', "ID like '%'")); } else { // Create the Feature Source (SDF) $sdfSchema = $this->CreateFilterSchema(); $sdfParams = new MgCreateSdfParams('MAPCS', $map->GetMapSRS(), $sdfSchema); $featureService->CreateFeatureSource($sdfResId, $sdfParams); // Create the Layer $layerResId = new MgResourceIdentifier('Session:' . $this->args['SESSION'] . '//Filter.LayerDefinition'); $layerDefinition = file_get_contents("templates/filterlayerdefinition.xml"); $layerDefinition = sprintf($layerDefinition, $sdfResId->ToString()); $byteSource = new MgByteSource($layerDefinition, strlen($layerDefinition)); $resourceService->SetResource($layerResId, $byteSource->GetReader(), null); $layer = new MgLayer($layerResId, $resourceService); $layer->SetName('_QuerySpatialFilter'); $layer->SetLegendLabel('_QuerySpatialFilter'); $layer->SetDisplayInLegend(false); $layer->SetSelectable(false); $layers->Insert(0, $layer); } // Make the layer visible $layer->SetVisible(true); $map->Save($resourceService); // Add the geometry to the filter feature source $polygon = $this->CreatePolygonFromGeomText($this->args['GEOMTEXT']); $agfWriter = new MgAgfReaderWriter(); $byteReader = $agfWriter->Write($polygon); $propertyValues = new MgPropertyCollection(); $propertyValues->Add(new MgGeometryProperty('Geometry', $byteReader)); $updateCommands->Add(new MgInsertFeatures('Filter', $propertyValues)); $featureService->UpdateFeatures($sdfResId, $updateCommands, false); return $result; }
public function DeleteFeatures($resId, $schemaName, $className, $format) { //Check for unsupported representations $fmt = $this->ValidateRepresentation($format, array("xml", "json")); $mimeType = $this->GetMimeTypeForFormat($fmt); $trans = null; try { $sessionId = ""; if ($resId->GetRepositoryType() == MgRepositoryType::Session) { $sessionId = $resId->GetRepositoryName(); } $this->EnsureAuthenticationForSite($sessionId, false, $mimeType); $siteConn = new MgSiteConnection(); $siteConn->Open($this->userInfo); $site = $siteConn->GetSite(); $this->VerifyWhitelist($resId->ToString(), $mimeType, "DELETEFEATURES", $fmt, $site, $this->userName); $resSvc = $siteConn->CreateService(MgServiceType::ResourceService); $perms = self::CheckPermissions($resSvc, $resId); //Not a session-based resource, must check for appropriate flag in header before we continue if ($sessionId === "") { if ($perms->AllowDelete === false) { $e = new Exception(); $this->OutputException("Forbidden", $this->app->localizer->getText("E_OPERATION_NOT_ALLOWED"), $this->app->localizer->getText("E_FEATURE_SOURCE_NOT_CONFIGURED_TO_ALLOW_UPDATES", $resId->ToString()), $e->getTraceAsString(), 403, $mimeType); } } $featSvc = $siteConn->CreateService(MgServiceType::FeatureService); $classDef = $featSvc->GetClassDefinition($resId, $schemaName, $className); $commands = new MgFeatureCommandCollection(); $filter = $this->app->request->params("filter"); if ($filter == null) { $filter = ""; } $deleteCmd = new MgDeleteFeatures("{$schemaName}:{$className}", $filter); $commands->Add($deleteCmd); if ($perms->UseTransaction === true) { $trans = $featSvc->BeginTransaction($resId); } //HACK: Due to #2252, we can't call UpdateFeatures() with NULL MgTransaction, so to workaround //that we call the original UpdateFeatures() overload with useTransaction = false if we find a //NULL MgTransaction if ($trans == null) { $result = $featSvc->UpdateFeatures($resId, $commands, false); } else { $result = $featSvc->UpdateFeatures($resId, $commands, $trans); } if ($trans != null) { $trans->Commit(); } $this->OutputUpdateFeaturesResult($commands, $result, $classDef, $fmt == "json"); } catch (MgException $ex) { if ($trans != null) { $trans->Rollback(); } $this->OnException($ex, $mimeType); } }
$featureSchema = new MgFeatureSchema("SHP_Schema", "Line schema"); // Add the feature schema to the class definition $featureSchema->GetClasses()->Add($classDefinition); // Create the feature source $wkt = $map->GetMapSRS(); $sdfParams = new MgCreateSdfParams("spatial context", $wkt, $featureSchema); $featureService->CreateFeatureSource($resourceIdentifier, $sdfParams); } // Add the line to the feature source $batchPropertyCollection = new MgBatchPropertyCollection(); $propertyCollection = MakeLine("Line A", $x0, $y0, $x1, $y1); $batchPropertyCollection->Add($propertyCollection); // Add the batch property collection to the feature source $cmd = new MgInsertFeatures($layerName, $batchPropertyCollection); $featureCommandCollection = new MgFeatureCommandCollection(); $featureCommandCollection->Add($cmd); // Execute the "add" commands $featureService->UpdateFeatures($resourceIdentifier, $featureCommandCollection, false); //---------------------------------------------------// $layerExists = DoesLayerExist($layerName, $map); if (!$layerExists) { // Create a new layer which uses that feature source // Create a line rule to stylize the lines $ruleLegendLabel = 'Lines Rule'; $filter = ''; $color = 'FF0000FF'; $factory = new LayerDefinitionFactory(); $lineRule = $factory->CreateLineRule($ruleLegendLabel, $filter, $color); // Create a line type style $lineTypeStyle = $factory->CreateLineTypeStyle($lineRule); // Create a scale range
$bufferProps->Add($nameProp); $x = 120 + $i / $count; $y = 100 + $i / $count; //$wktText = "POLYGON ((20 20, 20 100, {$x} {$y}, 140 20, 20 20))"; //$geom = $wkt->Read($wktText); $coord = $fact->CreateCoordinateXY($x, $y); $geom = $fact->CreatePoint($coord); $geomReader = $agf->Write($geom); $geomProp = new MgGeometryProperty("GEOM", $geomReader); $bufferProps->Add($geomProp); $batchProp->Add($bufferProps); } echo "Created geometries via wkt\n"; $cmd = new MgInsertFeatures("Buffer", $batchProp); $cmdColl = new MgFeatureCommandCollection(); $cmdColl->Add($cmd); try { $svc->CreateFeatureSource($id, $params); $startTime = microtime(true); $props = $svc->UpdateFeatures($id, $cmdColl, false); $endTime = microtime(true); $diffTime = $endTime - $startTime; $reader = $props->GetItem(0)->GetValue(); while ($reader->ReadNext() == true) { $key = $reader->GetInt32("KEY"); } $reader->Close(); // Now select a few of the feature and make sure we get everything back correctly. $query = new MgFeatureQueryOptions(); $query->AddFeatureProperty("NAME"); $query->AddFeatureProperty("KEY");
function UpdateMarkup() { $featureService = $this->site->CreateService(MgServiceType::FeatureService); $featureSourceId = $this->GetFeatureSource(); //HACK: Another leaky abstraction. SHP will always choose FeatId, so once again //use the class definition to determine the identity property name $clsDef = $this->GetClassDefinition(); $idProps = $clsDef->GetIdentityProperties(); $keyProp = $idProps->GetItem(0); $idName = $keyProp->GetName(); $propertyValues = new MgPropertyCollection(); $propertyValues->Add(new MgStringProperty('Text', trim($this->args['UPDATETEXT']))); $commands = new MgFeatureCommandCollection(); $commands->Add(new MgUpdateFeatures('Markup', $propertyValues, $this->BuildFeatureFilter($idName))); $result = $featureService->UpdateFeatures($featureSourceId, $commands, false); MarkupEditor::CleanupReaders($result); }
function UploadMarkup() { $locale = "en"; if (array_key_exists("LOCALE", $this->args)) { $locale = $this->args["LOCALE"]; } $uploadFileParts = pathinfo($_FILES["UPLOADFILE"]["name"]); $fdoProvider = $this->GetProviderFromExtension($uploadFileParts["extension"]); if ($fdoProvider == null) { throw new Exception(GetLocalizedString("REDLINEUPLOADUNKNOWNPROVIDER", $locale)); } $resourceService = $this->site->CreateService(MgServiceType::ResourceService); $featureService = $this->site->CreateService(MgServiceType::FeatureService); $bs = new MgByteSource($_FILES["UPLOADFILE"]["tmp_name"]); $br = $bs->GetReader(); //Use file name to drive all parameters $baseName = $uploadFileParts["filename"]; $this->UniqueMarkupName($baseName); //Guard against potential duplicates $ext = $uploadFileParts["extension"]; $markupLayerResId = new MgResourceIdentifier($this->GetResourceIdPrefix() . $baseName . ".LayerDefinition"); $markupFsId = new MgResourceIdentifier($this->GetResourceIdPrefix() . $baseName . '.FeatureSource'); //Set up feature source document $dataName = $baseName . "." . $ext; $fileParam = "File"; $shpFileParts = array(); if (strcmp($fdoProvider, "OSGeo.SHP") == 0) { $dataName = null; $fileParam = "DefaultFileLocation"; $zip = new ZipArchive(); if ($zip->open($_FILES["UPLOADFILE"]["tmp_name"]) === TRUE) { for ($i = 0; $i < $zip->numFiles; $i++) { $stat = $zip->statIndex($i); $filePath = tempnam(sys_get_temp_dir(), "upload"); //Dump to temp file file_put_contents($filePath, $zip->getFromIndex($i)); //Stash for later upload and cleanup $entry = $stat["name"]; $shpFileParts[$entry] = $filePath; if (substr($entry, strlen($entry) - strlen(".shp")) == ".shp") { $dataName = $entry; } } //Abort if we can't find a .shp file. This is not a valid zip file if ($dataName == null) { throw new Exception(GetLocalizedString("REDLINEUPLOADSHPZIPERROR", $locale)); } } else { throw new Exception(GetLocalizedString("REDLINEUPLOADSHPZIPERROR", $locale)); } } $extraXml = ""; if (strcmp($fdoProvider, "OSGeo.SDF") == 0) { //Need to set ReadOnly = false for SDF $extraXml = "<Parameter><Name>ReadOnly</Name><Value>FALSE</Value></Parameter>"; } $fsXml = sprintf(file_get_contents("templates/markupfeaturesource.xml"), $fdoProvider, $fileParam, $dataName, $extraXml); $bs2 = new MgByteSource($fsXml, strlen($fsXml)); $resourceService->SetResource($markupFsId, $bs2->GetReader(), null); if (count($shpFileParts) > 0) { foreach ($shpFileParts as $name => $path) { $bs3 = new MgByteSource($path); $resourceService->SetResourceData($markupFsId, $name, "File", $bs3->GetReader()); //Cleanup unlink($path); } } else { //Not a SHP file $resourceService->SetResourceData($markupFsId, $dataName, "File", $bs->GetReader()); } //Query the geometry types $schemas = $featureService->DescribeSchema($markupFsId, "", null); $schema = $schemas->GetItem(0); $classes = $schema->GetClasses(); $klass = $classes->GetItem(0); $geomProp = $klass->GetDefaultGeometryPropertyName(); $clsProps = $klass->GetProperties(); $className = $schema->GetName() . ":" . $klass->GetName(); $geomTypes = -1; if ($clsProps->IndexOf($geomProp) >= 0) { $geom = $clsProps->GetItem($geomProp); $geomTypes = $geom->GetGeometryTypes(); //Since we're here. Validate the schema requirements. If this was created by this widget previously //it will be valid $idProps = $klass->GetIdentityProperties(); if ($idProps->GetCount() != 1) { throw new Exception(GetLocalizedString("REDLINEUPLOADINVALIDSCHEMA", $locale)); } else { //Must be auto-generated (implying numerical as well) $keyProp = $idProps->GetItem(0); if (!$keyProp->IsAutoGenerated()) { throw new Exception(GetLocalizedString("REDLINEUPLOADINVALIDSCHEMA", $locale)); } } if ($clsProps->IndexOf("Text") < 0) { throw new Exception(GetLocalizedString("REDLINEUPLOADINVALIDSCHEMA", $locale)); } } else { throw new Exception(GetLocalizedString("REDLINEUPLOADINVALIDSCHEMA", $locale)); } //Set up default style args $this->args["MARKUPNAME"] = $baseName; $this->args["MARKERCOLOR"] = DefaultStyle::MARKER_COLOR; $this->args["MARKERTYPE"] = DefaultStyle::MARKER_TYPE; $this->args["MARKERSIZEUNITS"] = DefaultStyle::MARKER_SIZE_UNITS; $this->args["MARKERSIZE"] = DefaultStyle::MARKER_SIZE; $this->args["LINECOLOR"] = DefaultStyle::LINE_COLOR; $this->args["LINEPATTERN"] = DefaultStyle::LINE_PATTERN; $this->args["LINESIZEUNITS"] = DefaultStyle::LINE_SIZE_UNITS; $this->args["LINETHICKNESS"] = DefaultStyle::LINE_THICKNESS; $this->args["FILLPATTERN"] = DefaultStyle::FILL_PATTERN; $this->args["FILLTRANSPARENCY"] = DefaultStyle::FILL_TRANSPARENCY; $this->args["FILLFORECOLOR"] = DefaultStyle::FILL_FORE_COLOR; $this->args["FILLBACKCOLOR"] = DefaultStyle::FILL_BACK_COLOR; $this->args["FILLBACKTRANS"] = DefaultStyle::FILL_BACK_TRANS; $this->args["BORDERPATTERN"] = DefaultStyle::BORDER_PATTERN; $this->args["BORDERSIZEUNITS"] = DefaultStyle::BORDER_SIZE_UNITS; $this->args["BORDERCOLOR"] = DefaultStyle::BORDER_COLOR; $this->args["BORDERTHICKNESS"] = DefaultStyle::BORDER_THICKNESS; $this->args["LABELSIZEUNITS"] = DefaultStyle::LABEL_SIZE_UNITS; $this->args["LABELFONTSIZE"] = DefaultStyle::LABEL_FONT_SIZE; //Omission is considered false, which is the default. If you ever change //the default style values, uncomment the matching "true" values //$this->args["LABELBOLD"] = DefaultStyle::LABEL_BOLD; //$this->args["LABELITALIC"] = DefaultStyle::LABEL_ITALIC; //$this->args["LABELUNDERLINE"] = DefaultStyle::LABEL_UNDERLINE; $this->args["LABELFORECOLOR"] = DefaultStyle::LABEL_FORE_COLOR; $this->args["LABELBACKCOLOR"] = DefaultStyle::LABEL_BACK_COLOR; $this->args["LABELBACKSTYLE"] = DefaultStyle::LABEL_BACK_STYLE; $markupLayerDefinition = $this->CreateMarkupLayerDefinitionContent($markupFsId->ToString(), $className); $layerBs = new MgByteSource($markupLayerDefinition, strlen($markupLayerDefinition)); //Save to new resource or overwrite existing $resourceService->SetResource($markupLayerResId, $layerBs->GetReader(), null); //Add to markup registry $cmds = new MgFeatureCommandCollection(); $props = new MgPropertyCollection(); $props->Add(new MgStringProperty("ResourceId", $markupFsId->ToString())); $props->Add(new MgStringProperty("LayerDefinition", $markupLayerResId->ToString())); $props->Add(new MgStringProperty("Name", $markupLayerResId->GetName())); $props->Add(new MgStringProperty("FdoProvider", $fdoProvider)); $props->Add(new MgInt32Property("GeometryTypes", $geomTypes)); $insertCmd = new MgInsertFeatures("Default:MarkupRegistry", $props); $cmds->Add($insertCmd); $res = $featureService->UpdateFeatures($this->markupRegistryId, $cmds, false); MarkupManager::CleanupReaders($res); //Add to map $this->args["MARKUPLAYER"] = $markupLayerResId->ToString(); $this->OpenMarkup(); }
$geometryFactory = new MgGeometryFactory(); $mergedGeometries = $geometryFactory->CreateMultiGeometry($inputGeometries); // Add buffer features to the temporary feature source. // Create multiple concentric buffers to show area. // If the stylization for the layer draws the features // partially transparent, the concentric rings will be // progressively darker towards the center. // The stylization is set in the layer template file, which // is used in function CreateBufferLayer(). $commands = new MgFeatureCommandCollection(); for ($bufferRing = 0; $bufferRing < $bufferRingCount; $bufferRing++) { $bufferDist = $srs->ConvertMetersToCoordinateSystemUnits($bufferRingSize * ($bufferRing + 1)); $bufferGeometry = $mergedGeometries->Buffer($bufferDist, $srsMeasure); $properties = new MgPropertyCollection(); $properties->Add(new MgGeometryProperty('BufferGeometry', $agfReaderWriter->Write($bufferGeometry))); $commands->Add(new MgInsertFeatures('BufferClass', $properties)); } // Old way, pre MapGuide OS 2.0 //$featureService->UpdateFeatures($bufferFeatureResId, $commands, false); // New way, post MapGuide OS 2.0 $bufferLayer->UpdateFeatures($commands); $bufferLayer->SetVisible(true); $bufferLayer->ForceRefresh(); $bufferLayer->SetDisplayInLegend(true); $map->Save(); } } } else { echo 'No selected layers'; } echo '</p>';
$src = new MgByteSource("NewSdfInt.LayerDefinition"); $rid = new MgResourceIdentifier("Library://TrevorWekel/NewSdfInt.LayerDefinition"); $rsvc->SetResource($rid, $src->GetReader(), null); $src = new MgByteSource("NewSdfString.LayerDefinition"); $rid = new MgResourceIdentifier("Library://TrevorWekel/NewSdfString.LayerDefinition"); $rsvc->SetResource($rid, $src->GetReader(), null); echo "Deleting existing feature source\n"; $rsvc->DeleteResource($id); echo "Creating new feature source\n"; $fsvc->CreateFeatureSource($id, $params); // We need to add some data to the sdf before using it. The spatial context // reader must have an extent. $cmdColl = new MgFeatureCommandCollection(); for ($i = 1; $i <= 20; $i++) { $insert = $intFeature->InsertCommand($i); $cmdColl->Add($insert); } echo "Updating features\n"; $fsvc->UpdateFeatures($id, $cmdColl, false); $mapId = new MgResourceIdentifier("Library://TrevorWekel/NewSdf.MapDefinition"); $map = new MgMap(); $map->Create($rsvc, $mapId, "NewMap"); echo "Building Selection from Add()\n"; $sel = new MgSelection($map); $slayer = $map->GetLayers()->GetItem(0); $sel->AddFeatureIdInt32($slayer, "IntKey", 1); $sel->AddFeatureIdInt32($slayer, "IntKey", 10); $sel->AddFeatureIdInt32($slayer, "IntKey", 20); echo "XML FeatureSet is\n" . $sel->ToXml() . "\n"; echo "\nString Filter: " . $sel->GenerateFilter($slayer, "StringKey") . "\n\n"; echo "Building Selection from XML\n";
// If the layer exists and is visible, then display the // previous results. EmitAddressResults($featureService, $addressMarkerDataResId, $mgSessionId); } } // Insert the results of the Geo-Code into the temporary // feature source and ensure the address marker layer // is visible. $geometryReaderWriter = new MgAgfReaderWriter(); $geometryFactory = new MgGeometryFactory(); $addrPoint = $geometryFactory->CreatePoint($geometryFactory->CreateCoordinateXY((double) $long, (double) $lat)); $properties = new MgPropertyCollection(); $properties->Add(new MgStringProperty('Address', $address1)); $properties->Add(new MgGeometryProperty('Location', $geometryReaderWriter->Write($addrPoint))); $commands = new MgFeatureCommandCollection(); $commands->Add(new MgInsertFeatures('AddressMarker', $properties)); $featureService->UpdateFeatures($addressMarkerDataResId, $commands, false); $addressLayer->SetVisible(true); $addressLayer->ForceRefresh(); $map->Save($resourceService); $success = true; } else { echo '<tr><td>Address not found: ' . $address . '<hr></td></tr>'; $success = false; } } catch (MgException $e) { echo $e->GetExceptionMessage(); echo '<br>'; echo $e->GetDetails(); } ?>
/** * Handles DELETE requests for this adapter. Overridable. Does nothing if not overridden. */ public function HandleDelete($single) { $trans = null; try { $tokens = explode(":", $this->className); $schemaName = $tokens[0]; $className = $tokens[1]; $classDef = $this->featSvc->GetClassDefinition($this->featureSourceId, $schemaName, $className); $commands = new MgFeatureCommandCollection(); if ($single === true) { if ($this->featureId == null) { throw new Exception($this->app->localizer->getText("E_NO_FEATURE_ID_SET")); } $idType = MgPropertyType::String; $tokens = explode(":", $this->className); $clsDef = $this->featSvc->GetClassDefinition($this->featureSourceId, $tokens[0], $tokens[1]); if ($this->featureIdProp == null) { $idProps = $clsDef->GetIdentityProperties(); if ($idProps->GetCount() == 0) { throw new Exception($this->app->localizer->getText("E_CANNOT_DELETE_NO_ID_PROPS", $this->className, $this->featureSourceId->ToString())); } else { if ($idProps->GetCount() > 1) { throw new Exception($this->app->localizer->getText("E_CANNOT_DELETE_MULTIPLE_ID_PROPS", $this->className, $this->featureSourceId->ToString())); } else { $idProp = $idProps->GetItem(0); $this->featureIdProp = $idProp->GetName(); $idType = $idProp->GetDataType(); } } } else { $props = $clsDef->GetProperties(); $iidx = $props->IndexOf($this->featureIdProp); if ($iidx >= 0) { $propDef = $props->GetItem($iidx); if ($propDef->GetPropertyType() != MgFeaturePropertyType::DataProperty) { throw new Exception($this->app->localizer->getText("E_ID_PROP_NOT_DATA", $this->featureIdProp)); } } else { throw new Exception($this->app->localizer->getText("E_ID_PROP_NOT_FOUND", $this->featureIdProp)); } } if ($idType == MgPropertyType::String) { $filter = $this->featureIdProp . " = '" . $this->featureId . "'"; } else { $filter = $this->featureIdProp . " = " . $this->featureId; } } else { $filter = $this->app->request->params("filter"); if ($filter == null) { $filter = ""; } } $deleteCmd = new MgDeleteFeatures("{$schemaName}:{$className}", $filter); $commands->Add($deleteCmd); if ($this->useTransaction) { $trans = $this->featSvc->BeginTransaction($this->featureSourceId); } //HACK: Due to #2252, we can't call UpdateFeatures() with NULL MgTransaction, so to workaround //that we call the original UpdateFeatures() overload with useTransaction = false if we find a //NULL MgTransaction if ($trans == null) { $result = $this->featSvc->UpdateFeatures($this->featureSourceId, $commands, false); } else { $result = $this->featSvc->UpdateFeatures($this->featureSourceId, $commands, $trans); } if ($trans != null) { $trans->Commit(); } $this->OutputUpdateFeaturesResult($commands, $result, $classDef); } catch (MgException $ex) { if ($trans != null) { $trans->Rollback(); } $this->OnException($ex); } }
function ClearDataSource($featureSrvc, $dataSourceId, $featureName) { $deleteCmd = new MgDeleteFeatures($featureName, "ID >= 0"); $commands = new MgFeatureCommandCollection(); $commands->Add($deleteCmd); $featureSrvc->UpdateFeatures($dataSourceId, $commands, false); }
} else { $srsXform = null; } while ($featureReader->ReadNext()) { $oGeomAgf = $featureReader->GetGeometry($geomPropName); $oGeom = $agfRW->Read($oGeomAgf); $wktReaderWriter = new MgWktReaderWriter(); $agfTextPoint = $wktReaderWriter->Write($oGeom); //echo "<!-- wkt: ".$agfTextPoint." -->\n"; if (!$merge) { /* use measure to accomodate differences in SRS */ $oNewGeom = $oGeom->Buffer($dist, $measure); $geomProp = new MgGeometryProperty("GEOM", $agfRW->Write($oNewGeom)); $oPropertyColl = new MgPropertyCollection(); $oPropertyColl->Add($geomProp); $oCommandsColl->Add(new MgInsertFeatures($schemaName . ':' . $layerName, $oPropertyColl)); } else { if ($srsXform == null) { $oNewGeom = $oGeom; } else { $oNewGeom = $oGeom->Transform($srsXform); } $inputGeometries->Add($oNewGeom); } } $featureReader->Close(); } if ($merge) { if ($inputGeometries->GetCount() > 0) { $dist = $srsMap->ConvertMetersToCoordinateSystemUnits($distance); if (!$arbitraryMapSrs) {
</head> <?php include '../utilityfunctions.php'; $mgSessionId = $_SERVER['REQUEST_METHOD'] == "POST" ? $_POST['SESSION'] : $_GET['SESSION']; try { // Initialize the Web Extensions and connect to the Server using // the Web Extensions session identifier stored in PHP session state. MgInitializeWebTier($configFilePath); $userInfo = new MgUserInformation($mgSessionId); $siteConnection = new MgSiteConnection(); $siteConnection->Open($userInfo); $featureService = $siteConnection->CreateService(MgServiceType::FeatureService); $addressMarkerDataResId = new MgResourceIdentifier("Session:" . $mgSessionId . "//AddressMarker.FeatureSource"); $commands = new MgFeatureCommandCollection(); $commands->Add(new MgDeleteFeatures('AddressMarker', "ID like '%'")); $featureService->UpdateFeatures($addressMarkerDataResId, $commands, false); // Create a ReserviceService object and use it to open the Map // object from the sessions repository. Use the Map object to hide // the "ParcelMarker" layer and then save the updated Map back to // the session. $resourceService = $siteConnection->CreateService(MgServiceType::ResourceService); $map = new MgMap(); $map->Open($resourceService, 'Sheboygan'); $layer = GetLayerByName($map, 'AddressMarker'); $layer->SetVisible(false); $layer->ForceRefresh(); $map->Save($resourceService); } catch (MgException $e) { echo $e->GetExceptionMessage(); echo $e->GetDetails();