public function featureFromJSON($featureInfo) { if (isset($featureInfo['foundFieldName'])) { // will be set if we got here from a search $displayField = $featureInfo['foundFieldName']; } else { $displayField = $this->displayField; } $attribs = $featureInfo['attributes']; $displayAttribs = array(); // use human-readable field alias to construct feature details foreach ($attribs as $name => $value) { if (strtoupper($name) == strtoupper($displayField)) { $index = $value; } if ($value !== null && trim($value) !== '') { if (isset($this->fieldNames[$name])) { $name = $this->fieldNames[$name]; } $displayAttribs[$name] = $value; } } if ($this->geometryType && isset($featureInfo['geometry'])) { $geometry = $featureInfo['geometry']; } else { $geometry = NULL; } if (!isset($displayAttribs[$this->idField]) && !isset($displayAttribs[$this->fieldNames[$this->displayField]])) { // no usable data was included with this result return NULL; } $feature = new ArcGISFeature($displayAttribs, $geometry, $index, $this->getCategory()); if ($this->geometryType) { $feature->setGeometryType($this->geometryType); } $feature->setTitleField($this->fieldNames[$this->displayField]); if (isset($this->idField) && isset($attribs[$this->idField])) { $feature->setId($attribs[$this->idField]); } else { $feature->setId($feature->getTitle()); } return $feature; }