Skip to content

Commit 59e1e74

Browse files
authored
Merge pull request #2133 from Esri/NA/guides_13
Update table to pdf
2 parents fb4e1be + c6f1257 commit 59e1e74

File tree

1 file changed

+15
-110
lines changed

1 file changed

+15
-110
lines changed

samples/05_content_publishers/pdf_table_to_pdf_map.ipynb

Lines changed: 15 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,8 +1246,7 @@
12461246
],
12471247
"source": [
12481248
"map1 = gis.map('California, USA')\n",
1249-
"map1.layout.height = '650px'\n",
1250-
"map1.legend = True\n",
1249+
"map1.legend.enabled = True\n",
12511250
"map1"
12521251
]
12531252
},
@@ -1268,15 +1267,17 @@
12681267
}
12691268
],
12701269
"source": [
1271-
"map1.clear_graphics()\n",
1272-
"overlap_rows.spatial.plot(kind='map', map_widget=map1,\n",
1273-
" renderer_type='c', # for class breaks renderer\n",
1274-
" method='esriClassifyNaturalBreaks', # classification algorithm\n",
1275-
" class_count=7, # choose the number of classes\n",
1276-
" col='ACRES', # numeric column to classify\n",
1277-
" cmap='hot', # color map to pick colors from for each class\n",
1278-
" alpha=0.7 # specify opacity\n",
1279-
" )"
1270+
"overlap_rows.spatial.plot(map_widget=map1)"
1271+
]
1272+
},
1273+
{
1274+
"cell_type": "code",
1275+
"execution_count": null,
1276+
"metadata": {},
1277+
"outputs": [],
1278+
"source": [
1279+
"smm = map1.content.renderer(0).smart_mapping()\n",
1280+
"smm.class_breaks_renderer(break_type=\"color\", classification_method='natural-breaks', num_classes=7, field=\"ACRES\")"
12801281
]
12811282
},
12821283
{
@@ -1342,101 +1343,7 @@
13421343
"cell_type": "markdown",
13431344
"metadata": {},
13441345
"source": [
1345-
"If you would also like to export the fire impacting counties into a PDF map, the required steps are: (1) obtain the web map json via the `Item.get_data()` API method, (2) modify the web map json to also include `exportOptions` and `mapOptions`, and (3) use `arcgis.mapping.export_map()` to get the PDF deliverable of the web map."
1346-
]
1347-
},
1348-
{
1349-
"cell_type": "code",
1350-
"execution_count": 25,
1351-
"metadata": {},
1352-
"outputs": [
1353-
{
1354-
"data": {
1355-
"text/plain": [
1356-
"dict_keys(['operationalLayers', 'baseMap', 'spatialReference', 'version', 'authoringApp', 'authoringAppVersion'])"
1357-
]
1358-
},
1359-
"execution_count": 25,
1360-
"metadata": {},
1361-
"output_type": "execute_result"
1362-
}
1363-
],
1364-
"source": [
1365-
"webmap_json = item.get_data()\n",
1366-
"webmap_json.keys()"
1367-
]
1368-
},
1369-
{
1370-
"cell_type": "code",
1371-
"execution_count": 26,
1372-
"metadata": {},
1373-
"outputs": [
1374-
{
1375-
"data": {
1376-
"text/plain": [
1377-
"{'spatialReference': {'latestWkid': 3857, 'wkid': 102100},\n",
1378-
" 'xmin': -14383204.412078053,\n",
1379-
" 'ymin': 3664734.601863475,\n",
1380-
" 'xmax': -11976355.265435062,\n",
1381-
" 'ymax': 5254624.790194718}"
1382-
]
1383-
},
1384-
"execution_count": 26,
1385-
"metadata": {},
1386-
"output_type": "execute_result"
1387-
}
1388-
],
1389-
"source": [
1390-
"map1.extent"
1391-
]
1392-
},
1393-
{
1394-
"cell_type": "markdown",
1395-
"metadata": {},
1396-
"source": [
1397-
"Based on <a href=\"https://enterprise.arcgis.com/en/server/latest/create-web-apps/windows/exportwebmap-specification.htm\">webmap spec</a>, the `mapOptions` and `exportOptions` also need to be specified for the json input. Here, the `extent` and `scale` are chosen based on the extents of the California State <a href=\"#References\">[2]</a>."
1398-
]
1399-
},
1400-
{
1401-
"cell_type": "code",
1402-
"execution_count": 27,
1403-
"metadata": {},
1404-
"outputs": [],
1405-
"source": [
1406-
"webmap_json['mapOptions'] = {\n",
1407-
" \"extent\" : {\n",
1408-
" \"xmin\": -14383204.412078043,\n",
1409-
" \"ymin\": 3664734.6018634685,\n",
1410-
" \"xmax\": -11976355.2654350533,\n",
1411-
" \"ymax\": 5254624.790194712,\n",
1412-
" \"spatialReference\": {\n",
1413-
" \"latestWkid\": 3857,\n",
1414-
" \"wkid\": 102100\n",
1415-
" }\n",
1416-
" },\n",
1417-
" \"scale\" : 9244648.868618,\n",
1418-
" \"spatialReference\" : {\n",
1419-
" \"wkid\" : 102100\n",
1420-
" }\n",
1421-
"}"
1422-
]
1423-
},
1424-
{
1425-
"cell_type": "code",
1426-
"execution_count": 28,
1427-
"metadata": {},
1428-
"outputs": [],
1429-
"source": [
1430-
"webmap_json['exportOptions'] = { \"dpi\" : 96,\n",
1431-
" \"outputSize\" : [746, 575]\n",
1432-
" }"
1433-
]
1434-
},
1435-
{
1436-
"cell_type": "markdown",
1437-
"metadata": {},
1438-
"source": [
1439-
"Finally, we used <a href=\"https://developers.arcgis.com/python/api-reference/arcgis.mapping.toc.html?highlight=export#arcgis.mapping.export_map\">`export_map`</a> method to create a PDF output of the web map item <a href=\"#References\">[3]</a>."
1346+
"Finally, we used <a href=\"https://developers.arcgis.com/python/latest/api-reference/arcgis.map.toc.html#arcgis.map.Map.print\">`print`</a> method to create a PDF output of the web map item <a href=\"#References\">[3]</a>."
14401347
]
14411348
},
14421349
{
@@ -1456,9 +1363,7 @@
14561363
}
14571364
],
14581365
"source": [
1459-
"from arcgis.mapping import export_map\n",
1460-
"res = export_map(web_map_as_json=webmap_json, format='PDF', layout_template='MAP_ONLY')\n",
1461-
"#res[\"url\"]\n",
1366+
"res = map1.print(file_format='PDF', layout_template='MAP_ONLY')\n",
14621367
"res.url"
14631368
]
14641369
},
@@ -1479,7 +1384,7 @@
14791384
"\n",
14801385
"[2] https://enterprise.arcgis.com/en/server/latest/create-web-apps/windows/exportwebmap-specification.htm\n",
14811386
"\n",
1482-
"[3] https://developers.arcgis.com/python/api-reference/arcgis.mapping.toc.html?highlight=export#arcgis.mapping.export_map"
1387+
"[3] https://developers.arcgis.com/python/latest/api-reference/arcgis.map.toc.html#arcgis.map.Map.print"
14831388
]
14841389
}
14851390
],

0 commit comments

Comments
 (0)