Esri / arcgis-python-api

Documentation and samples for ArcGIS API for Python
https://developers.arcgis.com/python/
Apache License 2.0
1.87k stars 1.1k forks source link

Widget JavaScript Not Detected #10

Closed DruidSmith closed 7 years ago

DruidSmith commented 8 years ago

Trying to run the samples -

Configured the Jupyter Notebook environment via

%%sh
conda install -c conda-forge ipywidgets
conda install -c esri arcgis

Both of those installed fine

Enabled widgets via

%%sh
jupyter nbextension enable --py --sys-prefix widgetsnbextension

_Enabling notebook extension jupyter-js-widgets/extension...

Then if I try to instantiate a sample map:

from arcgis.gis import GIS

gis = GIS()
map = gis.map('Seattle, WA', 6)
map

I get a JavaScript error: Widget Javascript not detected. It may not be installed properly. Did you enable the widgetsnbextension? If not, then run "jupyter nbextension enable --py --sys-prefix widgetsnbextension"

Non-ESRI widgets work fine in my other notebooks.

AtmaMani commented 8 years ago

@DruidSmith can you try enabling the map widget as mentioned in this section of the help

DruidSmith commented 8 years ago

I've already tried that - it didn't work (see screenshots below). I've gotten to the point where other ArcGIS Online content is being returned (such as user profile and item search results), but the maps will not instantiate. One other note (not sure if it makes a difference): I am running on Jupyter Hub on a server rather than launching Jupyter locally from the command line.

arcgis python

rohitgeo commented 8 years ago

@DruidSmith can you confirm that you have ipywidgets version 5.1.5 or higher?

Also, please open Tools > Developer Tools in Chrome and send a screenshot of any errors you get in the Console when you try to create and view the map widget.

DruidSmith commented 8 years ago

Hi Rohit:

%%sh
conda list ipywidgets
python -V

# packages in environment at /opt/anaconda3:
#
ipywidgets                5.2.2                    py35_0  
Python 3.5.2 :: Anaconda custom (64-bit)
DruidSmith commented 8 years ago

In Console it is throwing an error relating to require.js

require.js:900 TypeError: Cannot read property 'load_ipython_extension' of undefined
    at https://analytics-notebook.edap-cluster.com/user/dsmith04@ad.edap-cluster.c…static/notebook/js/main.min.js?v=f8115aaf7a88fe8ef22f54c4da3b8915:12132:31
    at Object.execCb (https://analytics-notebook.edap-cluster.com/user/dsmith04@ad.edap-cluster.c…components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce:1690:33)
    at Object.check (https://analytics-notebook.edap-cluster.com/user/dsmith04@ad.edap-cluster.c…/components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce:865:51)
    at Object.<anonymous> (https://analytics-notebook.edap-cluster.com/user/dsmith04@ad.edap-cluster.c…components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce:1140:34)
    at https://analytics-notebook.edap-cluster.com/user/dsmith04@ad.edap-cluster.c…/components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce:131:23
    at https://analytics-notebook.edap-cluster.com/user/dsmith04@ad.edap-cluster.c…components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce:1190:21
    at each (https://analytics-notebook.edap-cluster.com/user/dsmith04@ad.edap-cluster.c…c/components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce:56:31)
    at Object.emit (https://analytics-notebook.edap-cluster.com/user/dsmith04@ad.edap-cluster.c…components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce:1189:17)
    at Object.check (https://analytics-notebook.edap-cluster.com/user/dsmith04@ad.edap-cluster.c…/components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce:940:30)
    at Object.enable (https://analytics-notebook.edap-cluster.com/user/dsmith04@ad.edap-cluster.c…components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce:1177:22)check @ require.js:900
utils.js:36Loading extension: nb_anacondacloud/main
rohitgeo commented 8 years ago

@DruidSmith in the screenshot posted above, you are running the widget installation commands from within the notebook (in cell [1]). Have you tried running them from your shell and restarting jupyter notebook / jupyterhub?

DruidSmith commented 7 years ago

Here's some additional debug info - maybe it's an ipywidgets versioning issue?

Loading extension: nbpresent/js/nbpresent.min utils.js:36 Loading extension: nb_anacondacloud/main utils.js:36 Loading extension: arcgis/mapview require.js:900 TypeError: Cannot read property 'load_ipython_extension' of undefined(…)check @ require.js:900 utils.js:36Loading extension: nb_conda/main utils.js:36Loading extension: jupyter-js-widgets/extension

and when we actually run the leaflet cell:

Could not cross validate the widget frontend and backend versions. Error: Timeout while trying to cross validate the widget frontend and backend versions.(…) data:application/x-…:822 Uncaught SyntaxError: Unexpected token ? data:application/x-…:5 Uncaught SyntaxError: Unexpected token ? data:application/x-…:9 Uncaught SyntaxError: Unexpected token ? data:application/x-…:1660 Uncaught SyntaxError: Unexpected token ?

An example of the “unexpected token” from one of the javascript errors above is:

/*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new 

…. (a bunch of code removed for clarity) …

a.$===m&&(a.$=fd),b&&a.jQuery===m&&(a.jQuery=ed),m},typeof b===K&&(a.jQuery=a.$=m),m});
?_=1476479156478
rohitgeo commented 7 years ago

@DruidSmith, can you please check if this is resolved in v0.3 that was released a short time ago?

DruidSmith commented 7 years ago

@rohitgeo The other challenge now is that some of our accounts are dependent on AGOL Enterprise Accounts and the issue there is with SAML support, posted a note about whether a Python SAML library could be used to authenticate against our enterprise ID.

rohitgeo commented 7 years ago

@DruidSmith SAML will work through the 'pro' authentication scheme described at https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/#ArcGIS-Pro-user-connecting-to-the-active-portal-in-the-Pro-app

cyrusblankinship commented 7 years ago

I had the same exact issue as @DruidSmith so i tried re-running:

conda install -c conda-forge ipywidgets conda install -c esri arcgis jupyter nbextension enable --py --sys-prefix widgetsnbextension

However, now I'm getting the error:

arcpy must be run from inside the Conda environment, which ArcGIS uses to manage the installation of Python. You can access this environment by launching Python from the links inside the "ArcGIS > ArcGIS Pro" Start Menu Group: "Python Interactive Terminal" starts a Python session. "Python Command Prompt" opens a Command Prompt window initialized with Conda.

I'm running everything via the Python Command Prompt so I dont see how this can be an issue. Please help!

rohitgeo commented 7 years ago

I've seen this message 'Widget JavaScript not detected' on occasion but it seems to be unrelated to the map widget and comes from the ipywidgets dependency. I've seen the map widget work even with this error message.

From the discussion at https://github.com/ipython/ipywidgets/issues/669:

I don't know about anyone else, but I still see this message ALL THE TIME, on lots of different systems. Sometimes it goes away after running the suggested command, sometimes it doesn't. Sometimes reinstalling ipywidgets helps, sometimes it doesn't. Sometimes it means the widgets aren't working, sometimes it doesn't. Sometimes I manage to get it to go away somehow, but then it comes back the next time anything is upgraded. This message and the associated machinery is really a big pain when using ipywidgets. :-(

rohitgeo commented 7 years ago

Another thing to check is that the notebook server must be restarted after you install the arcgis package for the widget to work. This would explain the widget not working if installed from within the Jupyter Notebook environment using %%sh magic.

DruidSmith commented 7 years ago

Is using the "pro" option is predicated on the machine running Jupyter also having an active ArcGIS Pro session running?

We have Jupyter running in a separate, server-based environment, as such it doesn't look like that would work for us.

AtmaMani commented 7 years ago

@DruidSmith yes, the 'Pro' authentication works when you have the arcgis API installed in arcgispro-py3 conda env of ArcGIS Pro and by having Pro session running.

Is using the "pro" option is predicated on the machine running Jupyter also having an active ArcGIS Pro session running?

DruidSmith commented 7 years ago

We're running the Jupyter environment on a Linux server and there isn't yet a Linux version of ArcGIS Pro available. Are there any other ways that we could authenticate to ArcGIS Online via our Enterprise logon?

prasunkgupta commented 7 years ago

I am not able to display the map on Jupyter notebook.

image

I am using Python 3.6.2 on a Windows 64 bit machine and have installed arcgis on conda. This is the message when I run python on my windows command prompt:

Python 3.6.2 | packaged by conda-forge | (default, Jul 23 2017, 22:58:45) [MSC v.1900 64 bit (AMD64)] on win32

The command "conda list" on command prompt gives following output:

arcgis                    1.2.1                    py36_1    esri
bleach                    1.5.0                    py36_0    conda-forge
certifi                   2017.7.27.1              py36_0    conda-forge
colorama                  0.3.9                    py36_0    conda-forge
decorator                 4.1.2                    py36_0    conda-forge
entrypoints               0.2.3                    py36_1    conda-forge
html5lib                  0.9999999                py36_0    conda-forge
ipykernel                 4.6.1                    py36_0    conda-forge
ipython                   6.1.0                    py36_0    conda-forge
ipython_genutils          0.2.0                    py36_0    conda-forge
ipywidgets                7.0.0                    py36_0    conda-forge
jedi                      0.10.2                   py36_0    conda-forge
jinja2                    2.9.6                    py36_0    conda-forge
jsonschema                2.5.1                    py36_0    conda-forge
jupyter_client            5.1.0                    py36_0    conda-forge
jupyter_core              4.3.0                    py36_0    conda-forge
kerberos-sspi             0.2                      py36_0
markupsafe                1.0                      py36_0    conda-forge
mistune                   0.7.4                    py36_0    conda-forge
mkl                       2017.0.3                      0
nbconvert                 5.2.1                    py36_1    conda-forge
nbformat                  4.3.0                    py36_0    conda-forge
notebook                  5.0.0                    py36_0    conda-forge
numpy                     1.13.1                   py36_0
pandas                    0.20.3                   py36_1    conda-forge
pandoc                    1.19.2                        0    conda-forge
pandocfilters             1.4.1                    py36_0    conda-forge
pickleshare               0.7.4                    py36_0    conda-forge
pip                       9.0.1                    py36_0    conda-forge
prompt_toolkit            1.0.15                   py36_0    conda-forge
pygments                  2.2.0                    py36_0    conda-forge
python                    3.6.2                         0    conda-forge
python-dateutil           2.6.1                    py36_0    conda-forge
pytz                      2017.2                   py36_0    conda-forge
pywin32                   220                      py36_1    conda-forge
pyzmq                     16.0.2                   py36_2    conda-forge
setuptools                36.2.2                   py36_0    conda-forge
simplegeneric             0.8.1                    py36_0    conda-forge
six                       1.10.0                   py36_1    conda-forge
testpath                  0.3.1                    py36_0    conda-forge
tornado                   4.5.1                    py36_0    conda-forge
traitlets                 4.3.2                    py36_0    conda-forge
vs2015_runtime            14.0.25420                    0    conda-forge
wcwidth                   0.1.7                    py36_0    conda-forge
webencodings              0.5                      py36_0    conda-forge
wheel                     0.29.0                   py36_0    conda-forge
widgetsnbextension        3.0.2                    py36_0    conda-forge
wincertstore              0.2                      py36_0    conda-forge

Also, the error shown in the screenshot disappears when I re-run the cell. No output, no error message. Just blank. image

The console, however, shows a 404 GET message as below: image

I have double checked the ipywidgets installation using conda install -c conda-forge ipywidgets image

and there seems to be no issue with that too.

rwmajor2 commented 7 years ago

@prasunkgupta Can you validate your ipywidgets version?

import ipywidgets
print(ipywidgets.__version__)
prasunkgupta commented 7 years ago

@rwmajor2 Thank you for replying. This is what I get: image

rwmajor2 commented 7 years ago

@prasunkgupta Thanks. With the recent release of ipywidgets 7.0, we have seen this issue. Currently, it only works with 6.x ipywidgets.

prasunkgupta commented 7 years ago

@rwmajor2 I did downgrade my ipywidgets installation image

But I still can't see map in jupyter notebook b

rohitgeo commented 7 years ago

Can you try issuing the following commands in cmd.exe/terminal after downgrading ipywidgets to 6.0:

jupyter nbextension install --py --sys-prefix arcgis
jupyter nbextension enable  --py --sys-prefix arcgis
rohitgeo commented 7 years ago

@prasunkgupta I believe I’ve found out the reason for the widget not working.

The problem is that widgetsnbextension v3.0.0 is incompatible with the map widget but gets installed when we install the arcgis package.

The workaround is to delete this package, install widgetsnbextension=2.0.0 and then install the arcgis package:

(newenv) C:\Users\rohit\newenv>conda uninstall widgetsnbextension
(newenv) C:\Users\rohit\newenv>conda install -c conda-forge widgetsnbextension=2.0.0
(newenv) C:\Users\rohit\newenv>conda install -c esri arcgis

New, retry creating the map widget in a new notebook: (newenv) C:\Users\rohit\newenv>jupyter notebook

aitorcalero commented 7 years ago

Hello Rohit, I've faced the same issue and follow the thread to your last post and the map widgets is no working yet. Right now, I do not get the error, but I cannot see the map.

I've also tried your last workaround but, when doing so, I cannot install the esri arcgis conda package.

This is the error I get in the Browser Console

captura de pantalla 2017-08-30 a las 1 21 02
rohitgeo commented 7 years ago

@aitorcalero @prasunkgupta we have released an update to the arcgis package that should resolve the problem.

The following commands can be used to create a new environment in conda and install the new package in it:

conda create -n newenvname python=3.6
activate newenvname
conda install -c esri arcgis

This should install arcgis v1.2.2 along with nbextensions < 3 and ipywidgets < 7 that should resolve the problems you are seeing.

@aitorcalero the log indicates that you still have nbextensions v3.0.0. Can you check with "conda list"?

prasunkgupta commented 7 years ago

It works! Thank you @rohitgeo @rwmajor2 image

aitorcalero commented 7 years ago

Hello, I've followed your instructions and created a new environment but the map is not working yet. However, the error is now different (screenshot) screenclip 3

antonio-remirez commented 7 years ago

Hi Aitor,

I think there's a bug with your locale configuration while creating the map view. You can fix it (just for testing) adding this single line to the map view javascript code (line 325):

var bms = that.model.get('gallery_basemaps'); that.model.set('basemap','streets');

I'm using 'streets' cause in Spanish it's the same name :)

You can find this file here: C:\ProgramData\Anaconda3\share\jupyter\nbextensions\arcgis\mapview.js

Probably this will be fixed soon.

Antonio Remirez

rwmajor2 commented 7 years ago

@aitorcalero @playgis Thanks for your feedback on the basemap issue. We will investigate this immediately. You might also try the following in your notebook, setting the basemap before you actually display the widget.

map = GIS().map() map.basemap = "streets" map

aitorcalero commented 7 years ago

Thank you Antonio! It worked! In my case, mapview file is in "%USERPROFILE%\AppData\Local\Continuum\Anaconda3\share\jupyter\nbextensions\arcgis\mapview.js"

rwmajor2 commented 7 years ago

@aitorcalero Can you explain your portal just a little? Are you using AGOL or Portal for ArcGIS? How is your Basemaps Group defined? Thanks for your feedback.

aitorcalero commented 7 years ago

Sure! It's an ArcGIS Online account Geogeeks where the basemap gallery is customized with some maps from Spanish sources. As @playgis has pointed, it could be a localization issue within the mapview.js code.

rwmajor2 commented 7 years ago

@aitorcalero Thanks for your input. I will look at this scenario further.

antonio-remirez commented 7 years ago

I think I found it.

While you are creating the widget model (init.py) the basemap list is always used in English:

self.basemaps = ["streets", "satellite", "hybrid", "topo", "gray", "dark-gray", "oceans", "national-geographic", "terrain", "osm", "topo-vector", "streets-vector", "gray-vector", "dark-gray-vector", "streets-navigation-vector", "streets-night-vector", "streets-relief-vector"]

But after that the basemap gallery names are created using AGOL content so it might be in other languaje:

self.gallery_basemaps = basemaps

Debugging a little I found that this may cause significant differences between both of them:

image

So when you create the map view it is not well set the basemap attribute (cause it is in Spanish!):

that.map = new Map(that.el, { basemap: that.model.get('basemap'), center: that.model.get('center').reverse(), zoom: that.model.get('zoom') });

rwmajor2 commented 7 years ago

@playgis That is correct. We pass through 2 lists: the standard JSAPI Basemap names and the actual basemaps used by the organization (gallery_basemaps). On the JavaScript side, we push them all onto the esriBaseMaps class so any of them can be used. But, the interesting part is it should be setting the default basemap name to 'topografico', but on the Notebook JS side it is looking for 'topographic' for some reason, which leads to me think it is some localization issue.

rohitgeo commented 7 years ago

@aitorcalero can you please post the result of: gis.properties['defaultBasemap']

rwmajor2 commented 7 years ago

@rohitgeo Based on the AGOL link @playgis provided, below is what I get:

from arcgis.gis import *
gis = GIS("https://geogeeks.maps.arcgis.com")
gis.properties['defaultBasemap']
{'baseMapLayers': [{'id': 'defaultBasemap',
   'layerType': 'ArcGISTiledMapServiceLayer',
   'opacity': 1,
   'resourceInfo': {'capabilities': 'Map,Tilemap,Query,Data',
    'copyrightText': 'Sources: Esri, HERE, DeLorme, Intermap, increment P Corp., GEBCO, USGS, FAO, NPS, NRCAN, GeoBase, IGN, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), swisstopo, MapmyIndia, © OpenStreetMap contributors, and the GIS User Community',
    'currentVersion': 10.3,
    'description': 'This map is designed to be used as a basemap by GIS professionals and as a reference map by anyone. The map includes administrative boundaries, cities, water features, physiographic features, parks, landmarks, highways, roads, railways, and airports overlaid on land cover and shaded relief imagery for added context. The map provides coverage for the world down to a scale of ~1:72k. Coverage is provided down to ~1:4k for the following areas: Australia and New Zealand; India; Europe; Canada; Mexico; the continental United States and Hawaii; South America and Central America; Africa; and most of the Middle East. Coverage down to ~1:1k and ~1:2k is available in select urban areas. This basemap was compiled from a variety of best available sources from several data providers, including the U.S. Geological Survey (USGS), U.S. Environmental Protection Agency (EPA), U.S. National Park Service (NPS), Food and Agriculture Organization of the United Nations (FAO), Department of Natural Resources Canada (NRCAN), GeoBase, Agriculture and Agri-Food Canada, DeLorme, HERE, Esri, OpenStreetMap contributors, and the GIS User Community. For more information on this map, including our terms of use, visit us online at http://goto.arcgisonline.com/maps/World_Topo_Map',
    'documentInfo': {'AntialiasingMode': 'None',
     'Author': 'Esri',
     'Category': 'imageryBaseMapsEarthCover (Imagery, basemaps, and land cover)',
     'Comments': '',
     'Keywords': 'World,Global,Europe,North America,South America,Southern Africa,Australia,New Zealand,India',
     'Subject': 'topographic, topography, administrative boundaries, cities, water features, physiographic features, parks, landmarks, highways, roads, railways, airports, land cover, shaded relief imagery',
     'TextAntialiasingMode': 'Force',
     'Title': 'World Topographic Map'},
    'exportTilesAllowed': False,
    'fullExtent': {'spatialReference': {'latestWkid': 3857, 'wkid': 102100},
     'xmax': 20037507.067161843,
     'xmin': -20037507.067161843,
     'ymax': 19971868.88040863,
     'ymin': -19971868.880408604},
    'initialExtent': {'spatialReference': {'latestWkid': 3857, 'wkid': 102100},
     'xmax': 28848255.049479112,
     'xmin': -28848255.049479112,
     'ymax': 16430757.376790084,
     'ymin': -2077452.082122866},
    'layers': [{'defaultVisibility': False,
      'id': 0,
      'maxScale': 0,
      'minScale': 0,
      'name': 'Citations',
      'parentLayerId': -1,
      'subLayerIds': None}],
    'mapName': 'Layers',
    'maxImageHeight': 4096,
    'maxImageWidth': 4096,
    'maxRecordCount': 100,
    'maxScale': 70.5310735,
    'minScale': 591657527.591555,
    'serviceDescription': 'This map is designed to be used as a basemap by GIS professionals and as a reference map by anyone. The map includes administrative boundaries, cities, water features, physiographic features, parks, landmarks, highways, roads, railways, and airports overlaid on land cover and shaded relief imagery for added context. The map provides coverage for the world down to a scale of ~1:72k. Coverage is provided down to ~1:4k for the following areas: Australia and New Zealand; India; Europe; Canada; Mexico; the continental United States and Hawaii; South America and Central America; Africa; and most of the Middle East. Coverage down to ~1:1k and ~1:2k is available in select urban areas. This basemap was compiled from a variety of best available sources from several data providers, including the U.S. Geological Survey (USGS), U.S. Environmental Protection Agency (EPA), U.S. National Park Service (NPS), Food and Agriculture Organization of the United Nations (FAO), Department of Natural Resources Canada (NRCAN), GeoBase, Agriculture and Agri-Food Canada, DeLorme, HERE, Esri, OpenStreetMap contributors, and the GIS User Community. For more information on this map, including the terms of use, visit us &lt;a href="http://goto.arcgisonline.com/maps/World_Topo_Map " target="_new" &gt;online&lt;/a&gt;.',
    'singleFusedMapCache': True,
    'spatialReference': {'latestWkid': 3857, 'wkid': 102100},
    'supportedExtensions': 'KmlServer',
    'supportedImageFormatTypes': 'PNG32,PNG24,PNG,JPG,DIB,TIFF,EMF,PS,PDF,GIF,SVG,SVGZ,BMP',
    'supportedQueryFormats': 'JSON, AMF',
    'supportsDynamicLayers': False,
    'tables': [],
    'tileInfo': {'cols': 256,
     'compressionQuality': 90,
     'dpi': 96,
     'format': 'JPEG',
     'lods': [{'level': 0,
       'resolution': 156543.03392800014,
       'scale': 591657527.591555},
      {'level': 1, 'resolution': 78271.51696399994, 'scale': 295828763.795777},
      {'level': 2, 'resolution': 39135.75848200009, 'scale': 147914381.897889},
      {'level': 3, 'resolution': 19567.87924099992, 'scale': 73957190.948944},
      {'level': 4, 'resolution': 9783.93962049996, 'scale': 36978595.474472},
      {'level': 5, 'resolution': 4891.96981024998, 'scale': 18489297.737236},
      {'level': 6, 'resolution': 2445.98490512499, 'scale': 9244648.868618},
      {'level': 7, 'resolution': 1222.992452562495, 'scale': 4622324.434309},
      {'level': 8, 'resolution': 611.4962262813797, 'scale': 2311162.217155},
      {'level': 9, 'resolution': 305.74811314055756, 'scale': 1155581.108577},
      {'level': 10, 'resolution': 152.87405657041106, 'scale': 577790.554289},
      {'level': 11, 'resolution': 76.43702828507324, 'scale': 288895.277144},
      {'level': 12, 'resolution': 38.21851414253662, 'scale': 144447.638572},
      {'level': 13, 'resolution': 19.10925707126831, 'scale': 72223.819286},
      {'level': 14, 'resolution': 9.554628535634155, 'scale': 36111.909643},
      {'level': 15, 'resolution': 4.77731426794937, 'scale': 18055.954822},
      {'level': 16, 'resolution': 2.388657133974685, 'scale': 9027.977411},
      {'level': 17, 'resolution': 1.1943285668550503, 'scale': 4513.988705},
      {'level': 18, 'resolution': 0.5971642835598172, 'scale': 2256.994353},
      {'level': 19, 'resolution': 0.29858214164761665, 'scale': 1128.497176},
      {'level': 20, 'resolution': 0.14929107082380833, 'scale': 564.248588},
      {'level': 21, 'resolution': 0.07464553541190416, 'scale': 282.124294},
      {'level': 22, 'resolution': 0.03732276770595208, 'scale': 141.062147},
      {'level': 23, 'resolution': 0.01866138385297604, 'scale': 70.5310735}],
     'origin': {'x': -20037508.342787, 'y': 20037508.342787},
     'rows': 256,
     'spatialReference': {'latestWkid': 3857, 'wkid': 102100}},
    'units': 'esriMeters'},
   'title': 'Mapa topográfico mundial',
   'url': 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer',
   'visibility': True}],
 'id': '1254ac139ecf423fbb04020bc57025a5',
 'operationalLayers': [],
 'title': 'Topográfico'}
aitorcalero commented 7 years ago

I've just checked that if I use map.basemap = 'topographic' is does not work, whereas if I use map. basemap = 'topográfico' it does.

rohitgeo commented 7 years ago

@aitorcalero thanks for this information. Can you also please post the output of the following:

g = gis.groups.search(gis.properties.basemapGalleryGroupQuery, outside_org=True)[0]
for bmi in g.content():
    print(bmi)
    print(bmi.get_data()['baseMap']['title'])
    print(bmi.get_data()['baseMap']['baseMapLayers'])
aitorcalero commented 7 years ago

This is what I get with a Python error at the end:

<Item title:"Calles" type:Web Map owner:esri_es> Calles [{'id': 'World_Street_Map_8421', 'layerType': 'ArcGISTiledMapServiceLayer', 'url': 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer', 'visibility': True, 'opacity': 1, 'title': 'Mapa de calles mundial'}] <Item title:"Imágenes" type:Web Map owner:esri_es> Imágenes [{'id': 'World_Imagery_2017', 'layerType': 'ArcGISTiledMapServiceLayer', 'url': 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer', 'visibility': True, 'opacity': 1, 'title': 'Imágenes del mundo'}] <Item title:"Imágenes con etiquetas" type:Web Map owner:esri_es> Imágenes con etiquetas [{'id': 'World_Imagery_6611', 'layerType': 'ArcGISTiledMapServiceLayer', 'url': 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer', 'visibility': True, 'opacity': 1, 'title': 'Imágenes del mundo'}, {'id': 'World_Boundaries_and_Places_1145', 'layerType': 'ArcGISTiledMapServiceLayer', 'url': 'https://services.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer', 'visibility': True, 'opacity': 1, 'title': 'Fronteras mundiales y lugares', 'isReference': True}] <Item title:"Lona gris claro" type:Web Map owner:esri_es> Lona gris claro [{'id': 'World_Light_Gray_Base_1486', 'layerType': 'ArcGISTiledMapServiceLayer', 'url': 'https://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer', 'visibility': True, 'opacity': 1, 'title': 'Base Lona gris claro mundial'}, {'id': 'World_Light_Gray_Reference_8656', 'layerType': 'ArcGISTiledMapServiceLayer', 'url': 'https://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer', 'visibility': True, 'opacity': 1, 'title': 'Referencia gris claro mundial', 'isReference': True}] <Item title:"Lona gris oscuro" type:Web Map owner:esri_es> Lona gris oscuro [{'id': 'layer0', 'layerType': 'ArcGISTiledMapServiceLayer', 'url': 'https://services.arcgisonline.com/arcgis/rest/services/Canvas/World_Dark_Gray_Base/MapServer', 'visibility': True, 'opacity': 1, 'title': 'Base Lona gris oscuro mundial'}, {'id': 'World_Dark_Gray_Reference_8618', 'layerType': 'ArcGISTiledMapServiceLayer', 'url': 'https://services.arcgisonline.com/arcgis/rest/services/Canvas/World_Dark_Gray_Reference/MapServer', 'visibility': True, 'opacity': 1, 'title': 'Referencia gris oscuro mundial', 'isReference': True}] <Item title:"Mapa Hipsométrico de España" type:Web Map owner:ServiciosOnline> MapaBase_r_WGS84_WM [{'id': 'MapaBase_r_WGS84_WM_2014', 'opacity': 1, 'visibility': True, 'url': 'http://www.mapabase.es/arcgis/rest/services/Raster/MapaBase_r_WGS84_WM/MapServer'}] <Item title:"Mapa Topográfico de España" type:Web Map owner:ServiciosOnline> MapaBase_h_WGS84_WM [{'id': 'MapaBase_h_WGS84_WM_2375', 'opacity': 1, 'visibility': True, 'url': 'http://www.mapabase.es/arcgis/rest/services/Raster/MapaBase_h_WGS84_WM/MapServer'}] <Item title:"Mapa Topográfico Simplificado de España" type:Web Map owner:ServiciosOnline> TopograficoSimplificado_WGS84_WM_Relieve [{'id': 'TopograficoSimplificado_WGS84_WM_Relieve_549', 'opacity': 1, 'visibility': True, 'url': 'http://www.mapabase.es/ArcGIS/rest/services/Vector/TopograficoSimplificado_WGS84_WM_Relieve/MapServer'}] <Item title:"MapaBase_o_WGS84_WM" type:Map Image Layer owner:aitor.calero.masquemapas>


TypeError Traceback (most recent call last)

in () 13 for bmi in g.content(): 14 print(bmi) ---> 15 print(bmi.get_data()['baseMap']['title']) 16 print(bmi.get_data()['baseMap']['baseMapLayers']) TypeError: 'NoneType' object is not subscriptable
DrewSmithee commented 7 years ago

I'm receiving the same error, "Widget Javascript not detected. It may not be installed or enabled properly."

import widgetsnbextension
import ipywidgets
import arcgis

print(widgetsnbextension.__version__)
print(ipywidgets.__version__)
print(arcgis.__version__)

2.0.0
6.0.0
1.2.2

The versions seem ok based on the conversation above, but no luck.

I'm also using the spyder console instead of jupyter if that would change anything.

rohitgeo commented 7 years ago

The widget is only supported on Jupyter Notebook.

DrewSmithee commented 7 years ago

After trying in jupyter, I receive the same error.

image

rohitgeo commented 7 years ago

What does the JavaScript console show?

DrewSmithee commented 7 years ago

image

rohitgeo commented 7 years ago

We have released a new update (v1.2.3) that should resolve the issue. Can you please try it out? The commands below create a new conda environment and install the ArcGIS Python API in it:

conda create -n newenvname python=3.6
activate newenvname
conda install -c esri arcgis

# try it out
jupyter notebook
antonio-remirez commented 7 years ago

Updated to v1.2.3 and working properly.

Thank you very much!

aitorcalero commented 7 years ago

I also confirm that is now working well, thanks @rohitgeo

jtkknelson commented 7 years ago

Worked for me in Chrome but not Internet Explorer (no error but map not displaying). Version 0.2.0 displays map in IE but includes the Widget Javascript error message.

rohitgeo commented 7 years ago

Thanks for reporting this. I checked and found that Internet Explorer is not supported by Jupyter Notebook. See http://jupyter-notebook.readthedocs.io/en/latest/notebook.html#browser-compatibility