I am trying to extract the html code out of an ArcGIS Online map from Python.
from arcgis.gis import GIS
import pandas as pd
g = GIS("https://www.arcgis.com",
"name", "password")
p = {
'type':"CSV",
'title': '2020#12',
'snippet':'hwa',
'description':'test ' + \
'dataframe object to a GIS item',
'tags': 'python',
}
i=g.content.add (item_properties=p,
data="C:/Users/Name/PycharmProjects/colors/Map/New.csv"
)
q=i.publish ()
print (q)
search =
g.content.search(query="owner:name",
item_type="Feature Layer")
print(search)
map=g.map (location="United States")
item=search [0]
print (item)
map.add_layer(item)
props={'title': '2020#156',
'snippet':'hwa',
'tags': 'python',
"renderer":"autocast",
"field_name": "Threat"}
map.save (props)
map.embed ()
I get an error for called embed ().
AttributeError: 'MapView' object has no attribute
'_preview_image_display_handler'
I have tried the export_to_html () method. It throws no error but the html code is invalid when I try and embed it in google sites.
I'm also running into this issue, it does run in jupyter notebook but not in an IDE
Running into the same issue in VS code and keen on finding a solution
Managed to solve this by updating arcgis to v3.0.3 and update .NET Desktop Runtime v6, see
However, I get another error related to numpy then
I got the issue again but I think I managed to solve this for good this time.
I think the the map should have been generated at least once before being embedded . This removed the "MapView" error for me. By the way, I am running my code in a notebook and use nbconvert for the html conversion.