def __init(self): """ populates all the properties for the map service """ params = {"f": "json"} if self._securityHandler is not None: params['token'] = self._securityHandler.token json_dict = self._do_get(self._url, params, proxy_port=self._proxy_port, proxy_url=self._proxy_url) self._json = json.dumps(json_dict) self._json_dict = json_dict attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] for k, v in json_dict.iteritems(): if k == "tables": self._tables = [] for tbl in v: url = self._url + "/%s" % tbl['id'] self._tables.append( layer.TableLayer(url, securityHandler=self._securityHandler, proxy_port=self._proxy_port, proxy_url=self._proxy_url)) elif k == "layers": self._layers = [] for lyr in v: url = self._url + "/%s" % lyr['id'] layer_type = self._getLayerType(url) if layer_type == "Feature Layer": self._layers.append( layer.FeatureLayer( url, securityHandler=self._securityHandler, proxy_port=self._proxy_port, proxy_url=self._proxy_url)) elif layer_type == "Raster Layer": self._layers.append( layer.RasterLayer( url, securityHandler=self._securityHandler, proxy_port=self._proxy_port, proxy_url=self._proxy_url)) elif layer_type == "Group Layer": self._layers.append( layer.GroupLayer( url, securityHandler=self._securityHandler, proxy_port=self._proxy_port, proxy_url=self._proxy_url)) else: print 'Type %s is not implemented' % layer_type elif k in attributes: setattr(self, "_" + k, json_dict[k]) else: print k, " is not implemented for mapservice."
def __init(self): """ populates all the properties for the map service """ if self._token is None: param_dict = {"f": "json"} else: param_dict = {"f": "json", "token" : self._token } json_dict = self._do_get(self._url, param_dict) attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] for k,v in json_dict.iteritems(): if k == "tables": self._tables = [] for tbl in v: self._tables.append( layer.TableLayer(url, token_url=self._token_url, username=self._username, password=self._password) ) elif k == "layers": self._layers = [] for lyr in v: url = self._url + "/%s" % lyr['id'] layer_type = self._getLayerType(url) if layer_type == "Feature Layer": self._layers.append( layer.FeatureLayer(url, token_url=self._token_url, username=self._username, password=self._password) ) elif layer_type == "Raster Layer": self._layers.append( layer.RasterLayer(url, token_url=self._token_url, username=self._username, password=self._password) ) elif layer_type == "Group Layer": self._layers.append( layer.GroupLayer(url, token_url=self._token_url, username=self._username, password=self._password) ) else: print 'Type %s is not implemented' % layer_type elif k in attributes: setattr(self, "_"+ k, json_dict[k]) else: print k, " is not implemented for mapservice."