|
1246 | 1246 | ],
|
1247 | 1247 | "source": [
|
1248 | 1248 | "map1 = gis.map('California, USA')\n",
|
1249 |
| - "map1.layout.height = '650px'\n", |
1250 |
| - "map1.legend = True\n", |
| 1249 | + "map1.legend.enabled = True\n", |
1251 | 1250 | "map1"
|
1252 | 1251 | ]
|
1253 | 1252 | },
|
|
1268 | 1267 | }
|
1269 | 1268 | ],
|
1270 | 1269 | "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\")" |
1280 | 1281 | ]
|
1281 | 1282 | },
|
1282 | 1283 | {
|
|
1342 | 1343 | "cell_type": "markdown",
|
1343 | 1344 | "metadata": {},
|
1344 | 1345 | "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>." |
1440 | 1347 | ]
|
1441 | 1348 | },
|
1442 | 1349 | {
|
|
1456 | 1363 | }
|
1457 | 1364 | ],
|
1458 | 1365 | "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", |
1462 | 1367 | "res.url"
|
1463 | 1368 | ]
|
1464 | 1369 | },
|
|
1479 | 1384 | "\n",
|
1480 | 1385 | "[2] https://enterprise.arcgis.com/en/server/latest/create-web-apps/windows/exportwebmap-specification.htm\n",
|
1481 | 1386 | "\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" |
1483 | 1388 | ]
|
1484 | 1389 | }
|
1485 | 1390 | ],
|
|
0 commit comments