You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
400 lines
11 KiB
400 lines
11 KiB
2 years ago
|
<?php
|
||
|
|
||
|
class ARCGISMAPSERVICE
|
||
|
{
|
||
|
|
||
|
public $output;
|
||
|
|
||
|
public function get($objArr)
|
||
|
{
|
||
|
|
||
|
$_request = $objArr->_request;
|
||
|
|
||
|
switch ($_request) {
|
||
|
case "registerService":
|
||
|
$this->output = $this->registerService($objArr);
|
||
|
break;
|
||
|
|
||
|
case "fetchLayers":
|
||
|
$this->output = $this->fetchLayers($objArr);
|
||
|
break;
|
||
|
|
||
|
case "registerLayer":
|
||
|
$this->output = $this->registerLayer($objArr);
|
||
|
break;
|
||
|
|
||
|
case "getLegend":
|
||
|
$this->output = $this->getlegend($objArr);
|
||
|
break;
|
||
|
|
||
|
case "getInfo":
|
||
|
$this->output = $this->getinfo($objArr);
|
||
|
break;
|
||
|
|
||
|
case "getAttributes":
|
||
|
$this->output = $this->getAttributes($objArr);
|
||
|
break;
|
||
|
|
||
|
case "search":
|
||
|
$this->output = $this->search($objArr);
|
||
|
break;
|
||
|
|
||
|
case "getLegendGraphic":
|
||
|
$this->output = $this->getLegendGraphic($objArr);
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
public function registerService($objArr)
|
||
|
{
|
||
|
|
||
|
require("config.php");
|
||
|
|
||
|
require("arcgisservices/arcgisserviceobject.php");
|
||
|
|
||
|
$p = new PROXY();
|
||
|
|
||
|
$objArr->_serviceUrl = PROXY::checkUrlScheme($objArr->_serviceUrl);
|
||
|
|
||
|
$p->_url = $objArr->_serviceUrl . "?f=pjson";
|
||
|
|
||
|
$_username = $objArr->_username;
|
||
|
|
||
|
$_password = $objArr->_password;
|
||
|
|
||
|
$_isSecure = false;
|
||
|
|
||
|
if ((!empty($_username)) && (!empty($_password))) {
|
||
|
$_isSecure = addCredentialsToSession($objArr->_serviceUrl, $objArr->_username, $objArr->_password);
|
||
|
} else {
|
||
|
|
||
|
if (addCredentialsToSession($objArr->_serviceUrl, $objArr->_username, $objArr->_password)) {
|
||
|
$_isSecure = true;
|
||
|
} else {
|
||
|
removeCredentialsFromSession($objArr->_serviceUrl);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$p->get();
|
||
|
|
||
|
$r = new RESPONSE();
|
||
|
|
||
|
$r->_responseCode = $p->o_responseCode;
|
||
|
|
||
|
if ($p->o_responseCode == 200) {
|
||
|
$jp = json_decode($p->o_response);
|
||
|
|
||
|
$_serviceObject = new ARCGISSERVICEOBJECT();
|
||
|
|
||
|
$_serviceObject->_serviceId = md5($objArr->_serviceUrl);
|
||
|
|
||
|
$_serviceObject->_serviceUrl = $objArr->_serviceUrl;
|
||
|
|
||
|
$_serviceObject->_username = $objArr->_username;
|
||
|
|
||
|
$_serviceObject->_password = $objArr->_password;
|
||
|
|
||
|
$_serviceObject->_currentVersion = $jp->currentVersion;
|
||
|
|
||
|
$_serviceObject->_serviceDescription = $jp->serviceDescription;
|
||
|
|
||
|
$_serviceObject->_mapName = $jp->mapName;
|
||
|
|
||
|
$_serviceObject->_description = $jp->description;
|
||
|
|
||
|
$_serviceObject->_copyrightText = $jp->copyrightText;
|
||
|
|
||
|
$_serviceObject->_supportsDynamicLayers = $jp->supportsDynamicLayers;
|
||
|
|
||
|
$_serviceObject->_layers = $jp->layers;
|
||
|
|
||
|
$_serviceObject->_tables = $jp->tables;
|
||
|
|
||
|
$_serviceObject->_spatialReference = $jp->spatialReference;
|
||
|
|
||
|
$_serviceObject->_singleFusedMapCache = $jp->singleFusedMapCache;
|
||
|
|
||
|
$_serviceObject->_initialExtent = $jp->initialExten;
|
||
|
|
||
|
$_serviceObject->_fullExtent = $jp->fullExtent;
|
||
|
|
||
|
$_serviceObject->_minScale = $jp->minScale;
|
||
|
|
||
|
$_serviceObject->_maxScale = $jp->maxScale;
|
||
|
|
||
|
$_serviceObject->_units = $jp->units;
|
||
|
|
||
|
$_serviceObject->_supportedImageFormatTypes = $jp->supportedImageFormatTypes;
|
||
|
|
||
|
$_serviceObject->_documentInfo = $jp->documentInfo;
|
||
|
|
||
|
$_serviceObject->_capabilities = $jp->capabilities;
|
||
|
|
||
|
$_serviceObject->_supportedQueryFormats = $jp->supportedQueryFormats;
|
||
|
|
||
|
$_serviceObject->_exportTilesAllowed = $jp->exportTilesAllowed;
|
||
|
|
||
|
$_serviceObject->_supportsDatumTransformation = $jp->supportsDatumTransformation;
|
||
|
|
||
|
$_serviceObject->_maxRecordCount = $jp->maxRecordCount;
|
||
|
|
||
|
$_serviceObject->_maxImageHeight = $jp->maxImageHeight;
|
||
|
|
||
|
$_serviceObject->_maxImageWidth = $jp->maxImageWidth;
|
||
|
|
||
|
$_serviceObject->_supportedExtensions = $jp->supportedExtensions;
|
||
|
|
||
|
$r->_response = $_serviceObject;
|
||
|
} else {
|
||
|
$r->_errorDescription = $p->o_response;
|
||
|
}
|
||
|
|
||
|
return $r;
|
||
|
|
||
|
}
|
||
|
|
||
|
public function fetchLayers($objArr)
|
||
|
{
|
||
|
require("config.php");
|
||
|
|
||
|
require("arcgisservices/arcgisserviceobject.php");
|
||
|
|
||
|
require("arcgisservices/arcgisservicelayersobject.php");
|
||
|
|
||
|
$p = new PROXY();
|
||
|
|
||
|
$objArr->_serviceUrl = PROXY::checkUrlScheme($objArr->_serviceUrl);
|
||
|
|
||
|
$p->_url = $objArr->_serviceUrl . "?f=pjson";
|
||
|
|
||
|
$_username = $objArr->_username;
|
||
|
|
||
|
$_password = $objArr->_password;
|
||
|
|
||
|
$_isSecure = false;
|
||
|
|
||
|
$p->get();
|
||
|
|
||
|
$r = new RESPONSE();
|
||
|
|
||
|
$r->_responseCode = $p->o_responseCode;
|
||
|
|
||
|
$r_layers = Array();
|
||
|
|
||
|
if ($p->o_responseCode == 200) {
|
||
|
$jp = json_decode($p->o_response);
|
||
|
|
||
|
foreach ($jp->layers as $layer) {
|
||
|
|
||
|
$_arcgisservicelayerObject = new ARCGISSERVICELAYERSOBJECT();
|
||
|
|
||
|
$_arcgisservicelayerObject->_layerId = md5($objArr->_serviceUrl . $layer->id);
|
||
|
|
||
|
$_arcgisservicelayerObject->_serviceId = md5($objArr->_serviceUrl);
|
||
|
|
||
|
$_arcgisservicelayerObject->_serviceUrl = $objArr->_serviceUrl;
|
||
|
|
||
|
$_arcgisservicelayerObject->_layerUrl = $objArr->_serviceUrl . "/" . $layer->id;
|
||
|
|
||
|
$_arcgisservicelayerObject->_id = $layer->id;
|
||
|
|
||
|
$_arcgisservicelayerObject->_name = $layer->name;
|
||
|
|
||
|
$_arcgisservicelayerObject->_parentLayerId = $layer->parentLayerId;
|
||
|
|
||
|
$_arcgisservicelayerObject->_defaultVisibility = $layer->defaultVisibility;
|
||
|
|
||
|
$_arcgisservicelayerObject->_subLayerIds = $layer->subLayerIds;
|
||
|
|
||
|
$_arcgisservicelayerObject->_minScale = $layer->minScale;
|
||
|
|
||
|
$_arcgisservicelayerObject->_maxScale = $layer->maxScale;
|
||
|
|
||
|
$r_layers[] = $_arcgisservicelayerObject;
|
||
|
|
||
|
}
|
||
|
|
||
|
$r->_response = $r_layers;
|
||
|
|
||
|
} else {
|
||
|
$r->_errorDescription = $p->o_response;
|
||
|
}
|
||
|
|
||
|
return $r;
|
||
|
}
|
||
|
|
||
|
public function registerLayer($objArr)
|
||
|
{
|
||
|
require("config.php");
|
||
|
|
||
|
require("arcgisservices/arcgislayerobject.php");
|
||
|
|
||
|
$p = new PROXY();
|
||
|
|
||
|
$objArr->_serviceUrl = PROXY::checkUrlScheme($objArr->_serviceUrl);
|
||
|
|
||
|
$p->_url = $objArr->_serviceUrl . "/" . $objArr->_layerId . "?f=pjson";
|
||
|
|
||
|
$_username = $objArr->_username;
|
||
|
|
||
|
$_password = $objArr->_password;
|
||
|
|
||
|
$_isSecure = false;
|
||
|
|
||
|
$p->get();
|
||
|
|
||
|
$r = new RESPONSE();
|
||
|
|
||
|
$r->_responseCode = $p->o_responseCode;
|
||
|
|
||
|
if ($p->o_responseCode == 200) {
|
||
|
|
||
|
$jp = json_decode($p->o_response);
|
||
|
|
||
|
$_layerObject = new ARCGISLAYEROBJECT();
|
||
|
|
||
|
$_layerObject->_layerId = md5($objArr->_serviceUrl . $jp->id);
|
||
|
|
||
|
$_layerObject->_serviceUrl = $objArr->_serviceUrl;
|
||
|
|
||
|
$_layerObject->_layerUrl = $objArr->_serviceUrl . "/" . $jp->id;
|
||
|
|
||
|
$_layerObject->_currentVersion = $jp->currentVersion;
|
||
|
|
||
|
$_layerObject->_id = $jp->id;
|
||
|
|
||
|
$_layerObject->_name = $jp->name;
|
||
|
|
||
|
$_layerObject->_type = $jp->type;
|
||
|
|
||
|
$_layerObject->_description = $jp->description;
|
||
|
|
||
|
$_layerObject->_geometryType = $jp->geometryType;
|
||
|
|
||
|
$_layerObject->_sourceSpatialReference = $jp->sourceSpatialReference;
|
||
|
|
||
|
$_layerObject->_copyrightText = $jp->copyrightText;
|
||
|
|
||
|
$_layerObject->_parentLayer = $jp->parentLayer;
|
||
|
|
||
|
$_layerObject->_subLayers = $jp->subLayers;
|
||
|
|
||
|
$_layerObject->_minScale = $jp->minScale;
|
||
|
|
||
|
$_layerObject->_maxScale = $jp->maxScale;
|
||
|
|
||
|
$_layerObject->_drawingInfo = $jp->drawingInfo;
|
||
|
|
||
|
$_layerObject->_defaultVisibility = $jp->defaultVisibility;
|
||
|
|
||
|
$_layerObject->_extent = $jp->extent;
|
||
|
|
||
|
$_layerObject->_hasAttachments = $jp->hasAttachments;
|
||
|
|
||
|
$_layerObject->_htmlPopupType = $jp->htmlPopupType;
|
||
|
|
||
|
$_layerObject->_displayField = $jp->displayField;
|
||
|
|
||
|
$_layerObject->_typeIdField = $jp->typeIdField;
|
||
|
|
||
|
$_layerObject->_fields = $jp->fields;
|
||
|
|
||
|
$_layerObject->_indexes = $jp->indexes;
|
||
|
|
||
|
$_layerObject->_relationships = $jp->relationships;
|
||
|
|
||
|
$_layerObject->_canModifyLayer = $jp->canModifyLayer;
|
||
|
|
||
|
$_layerObject->_canScaleSymbols = $jp->canScaleSymbols;
|
||
|
|
||
|
$_layerObject->_hasLabels = $jp->hasLabels;
|
||
|
|
||
|
$_layerObject->_capabilities = $jp->capabilities;
|
||
|
|
||
|
$_layerObject->_maxRecordCount = $jp->maxRecordCount;
|
||
|
|
||
|
$_layerObject->_supportsStatistics = $jp->supportsStatistics;
|
||
|
|
||
|
$_layerObject->_supportsAdvancedQueries = $jp->supportsAdvancedQueries;
|
||
|
|
||
|
$_layerObject->_hasZ = $jp->hasZ;
|
||
|
|
||
|
$_layerObject->_supportedQueryFormats = $jp->supportedQueryFormats;
|
||
|
|
||
|
$_layerObject->_ownershipBasedAccessControlForFeatures = $jp->ownershipBasedAccessControlForFeatures;
|
||
|
|
||
|
$_layerObject->_useStandardizedQueries = $jp->useStandardizedQueries;
|
||
|
|
||
|
$_layerObject->_advancedQueryCapabilities = $jp->advancedQueryCapabilities;
|
||
|
|
||
|
$_layerObject->_supportsDatumTransformation = $jp->supportsDatumTransformation;
|
||
|
|
||
|
$r->_response = $_layerObject;
|
||
|
|
||
|
} else {
|
||
|
$r->_errorDescription = $p->o_response;
|
||
|
}
|
||
|
|
||
|
return $r;
|
||
|
}
|
||
|
|
||
|
public function getlegend($objArr)
|
||
|
{
|
||
|
|
||
|
require("config.php");
|
||
|
|
||
|
$p = new PROXY();
|
||
|
|
||
|
$objArr->_serviceUrl = PROXY::checkUrlScheme($objArr->_serviceUrl);
|
||
|
|
||
|
$p->_url = $objArr->_serviceUrl . "/legend?f=pjson";
|
||
|
|
||
|
$_username = $objArr->_username;
|
||
|
|
||
|
$_password = $objArr->_password;
|
||
|
|
||
|
$_isSecure = false;
|
||
|
|
||
|
$p->get();
|
||
|
|
||
|
$r = new RESPONSE();
|
||
|
|
||
|
$r->_responseCode = $p->o_responseCode;
|
||
|
|
||
|
if ($p->o_responseCode == 200) {
|
||
|
|
||
|
$jp = json_decode($p->o_response);
|
||
|
|
||
|
foreach ($jp->layers as $layer) {
|
||
|
|
||
|
if($layer->layerId == $objArr->_layerId){
|
||
|
|
||
|
$r->_response = $layer->legend;
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
} else {
|
||
|
$r->_errorDescription = $p->o_response;
|
||
|
}
|
||
|
|
||
|
return $r;
|
||
|
}
|
||
|
|
||
|
public function getinfo($objArr)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
public function getAttributes($objArr)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
public function search($objArr)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
?>
|