Exemplo n.º 1
0
 def addGraphic(self, layerName, geometry, symbol):
     """ loads a geometry (ArcPy Geometry Object) into Graphic Layer"""
     allowed_geomtypes = ['polygon', 'polyline', 'point', 'multipoint']
     if not (geometry.type.lower() in allowed_geomtypes):
         return False, layerName
     geom = _unicode_convert(json.loads(geometry.JSON))
     geomType = self.__look_up_geom(geometry.type.lower())
     if self._storedFeatures.has_key(layerName):
         self._storedFeatures[layerName]['featureSet']['features'].append({
             "geometry":
             geom,
             "symbol":
             symbol.asDictionary
         })
     else:
         template_ld = {
             "layerDefinition": {
                 "name": layerName,
                 "geometryType": geomType
             },
             "featureSet": {
                 "geometryType": geomType,
                 "features": [{
                     "geometry": geom,
                     "symbol": symbol.asDictionary
                 }]
             }
         }
         self._storedFeatures[layerName] = template_ld
     return True, layerName
Exemplo n.º 2
0
 def addGraphic(self, layerName, geometry, symbol):
     """ loads a geometry (ArcPy Geometry Object) into Graphic Layer"""
     allowed_geomtypes = ['polygon', 'polyline', 'point', 'multipoint']
     if not (geometry.type.lower() in allowed_geomtypes):
         return False, layerName
     geom = _unicode_convert(json.loads(geometry.JSON))
     geomType = self.__look_up_geom(geometry.type.lower())
     if self._storedFeatures.has_key(layerName):
         self._storedFeatures[layerName]['featureSet']['features'].append({"geometry":geom,
                                                                            "symbol":symbol.asDictionary})
     else:
         template_ld = {
             "layerDefinition":{
                 "name":layerName,
                 "geometryType":geomType
                 },
             "featureSet":{
                 "geometryType":geomType,
                 "features":[{"geometry":geom,
                              "symbol":symbol.asDictionary}]
             }
         }
         self._storedFeatures[layerName] = template_ld
     return True, layerName
Exemplo n.º 3
0
 def __str__(self):
     """ returns object as string """
     return json.dumps(_unicode_convert(self.asDictionary), default=_date_handler)
Exemplo n.º 4
0
 def __str__(self):
     """ returns object as string """
     return json.dumps(_unicode_convert(self.asDictionary),
                       default=_date_handler)