Closed Adriana-Martinez closed 4 years ago
Fixed through https://github.com/GeoNode/geonode/pull/6355
I had the same issue, and I installed gn-arcrest==10.5.1
instead of gn-arcrest==10.5
. after restarting Django and Nginx docker containers nothing changed. Does this change solve this issue?
as some discussion between me and @afabiani i noticed the rest:
trying to import resources from an ArcGIS Web Map Service I got the error code below:
Traceback (most recent call last):
File "/usr/src/geonode/geonode/services/serviceprocessors/arcgis.py", line 140, in get_resources
return self._parse_layers(self.parsed_service.layers)
File "/usr/src/geonode/geonode/services/serviceprocessors/arcgis.py", line 149, in _parse_layers
map_layers.extend(self._parse_layers(lyr.subLayers))
File "/usr/local/lib/python3.8/site-packages/arcrest/server.py", line 769, in subLayers
return [self._get_subfolder("../%s/" %
File "/usr/local/lib/python3.8/site-packages/arcrest/server.py", line 770, in <listcomp>
layer['parentLayer']['id'],
KeyError: 'parentLayer'
This is a sample structure of the received data.
"layers": [
{
"id": 0,
"name": "Street_Naming",
"parentLayerId": -1,
"defaultVisibility": true,
"subLayerIds": [
1
],
"minScale": 0,
"maxScale": 0
},
Also it seems that the demo url is giving the same issue https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer?f=pjson
Changing the code to
@property
def parentLayer(self):
if self._json_struct.get('parentLayer'):
return self._get_subfolder("../%s/" %
self._json_struct['parentLayer']['id'],
MapLayer)
if self._json_struct.get('parentLayerId'):
return self._get_subfolder("../%s/" %
self._json_struct['parentLayerId'],
MapLayer)
@property
def subLayers(self):
sub_layers = []
for layer in self._json_struct['subLayers']:
if layer.get('parentLayer'):
value = self._get_subfolder("../%s/" % layer['parentLayer']['id'], MapLayer)
sub_layers.append(value)
if layer.get('parentLayerId'):
value = self._get_subfolder("../%s/" % layer['parentLayerId'], MapLayer)
sub_layers.append(value)
return sub_layers
seems to fix the issue
@malnajdi thanks, I'll send a patch ASAP for this
@malnajdi @mahdin75 @Adriana-Martinez please try out
pip install gn-arcrest==10.5.3
@afabiani I think this issue can be closed
Expected Behavior
Add layers using remote service from ArcGIS REST Map Server
Actual Behavior
Error: Could not connect to the service at https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer
Steps to Reproduce the Problem
Specifications