1/36. 2/36 something cool …

36
1/36

Upload: adam-lawrence

Post on 27-Dec-2015

223 views

Category:

Documents


9 download

TRANSCRIPT

Page 1: 1/36. 2/36 Something cool …

1/36

Page 2: 1/36. 2/36 Something cool …

2/36

Something cool … http://maps.google.com

Page 3: 1/36. 2/36 Something cool …

3/36

Google Maps API

Live earthquake mappinghttp://earthquakes.tafoni.net/

Other cool Google Maps API examples:

Page 4: 1/36. 2/36 Something cool …

4/36

More Google …

Search full text of bookse.g. http://books.google.com/books?q=uml

Calculator

Search tips & Hidden features

Also look for Google Code, Drive & Translate

Page 5: 1/36. 2/36 Something cool …

5/36

Google Earth ( http://earth.google.com )

Page 7: 1/36. 2/36 Something cool …

7/36

What can you do with arcpy.mapping?

Manage Map Documents (mxd)Manage DataFrames and Layers

Change extentsAdd, remove, insert, move, and update layersFix broken data sourcesetc.

Manage some layer properties (definitionQuery, showLabels, etc.)

Page Layout elementsPosition, size, text, …

Print & Export map Map automation, map book creation (pdf tools)

Publish to ArcGIS server (not covered in this course)

Check for warnings and errorsConvert MXD to MSD

Page 8: 1/36. 2/36 Something cool …

8/36

Arcpy.mapping Classes & Functions

Page 10: 1/36. 2/36 Something cool …

10/36

MapDocument Properties & Methods

PropertiesactiveView (rw)

author (rw)

credits (rw)

dataDrivenPages (ro)

dateExported (ro)

datePrinted (ro)

dateSaved (ro)

description (rw)

filePath (ro)

hyperlinkBase (rw)

relativePaths (ro)

summary (rw)

tags (rw)

title (rw)

MethodsdeleteThumbnail()

findAndReplaceWorkspacePaths( find_workspace_path, replace_workspace_path, {validate})

makeThumbnail ()

replaceWorkspaces( old_workspace_path, old_workspace_type, new_workspace_path, new_workspace_type, {validate})

save ()

saveACopy( file_name, {version})

(ro) = read-only(rw) = read-write

Page 12: 1/36. 2/36 Something cool …

12/36

Find DataFrames in MapDocument

Page 13: 1/36. 2/36 Something cool …

13/36

DataFrame Properties & Methods

Propertiescredits (rw)

description (rw)

displayUnits (rw)

elementHeight (rw)

elementPositionX (rw)

elementPositionY (rw)

elementWidth (rw)

extent (rw)

geographicTransformations (rw)

mapUnits (ro)

name (rw)

referenceScale (rw)

rotation (rw)

scale (rw)

spatialReference (rw)

time (ro)

type (ro)

MethodspanToExtent(extent)

zoomToSelectedFeatures()

Page 15: 1/36. 2/36 Something cool …

15/36

Layer Properties & Methods

Propertiesbrightness (rw)

contrast (rw)

credits (rw)

datasetName (rw)

dataSource (rw)

definitionQuery (rw)

description (rw)

isFeatureLayer (ro)

isGroupLayer (ro)

isRasterizingLayer (ro)

isRasterLayer (ro)

labelClasses (rw)

longName (ro)

name (rw)

serviceProperties (ro)

showLabels (rw)

transparency (rw)

visible (rw)

workspacePath (ro)

MethodsfindAndReplaceWorkspacePath( find_workspace_path, replace_workspace_path, {validate})

getExtent( {symbolized_extent})

getSelectedExtent( {symbolized_extent})

replaceDataSource( workspace_path, workspace_type, dataset_name, {validate})

save ()

saveACopy( file_name, {version})

supports( layer_property)

Selected properties

Layer = • .lyr file• Layer in DataFrame

Page 16: 1/36. 2/36 Something cool …

16/36

Find Layers in a DataFrame

i.e. All layers in all DataFrame’s

Page 17: 1/36. 2/36 Something cool …

17/36

Finding a specific layer in a DataFrame

Page 18: 1/36. 2/36 Something cool …

18/36

Working with Layers

arcpy.mapping can’tCreate new map layers in DataFrame or .lyr files from scratch Change all layer properties in a script

arcpy.mapping canAdd lyr file to DataFrame & change selected layer properties

dataSource, definitionQuery, etc. (see “(rw)” on previous slide)

Apply symbology from existing lyr files to existing layers in DataFrame

Page 19: 1/36. 2/36 Something cool …

19/36

Adding a Layer to a DataFrame

Page 20: 1/36. 2/36 Something cool …

20/36

Managing Layers in a DataFrame

Function Description

AddLayer Add a layer to a data frame within a map document (.mxd) using simple placement options.

AddLayerToGroup Add a layer to a group layer within a map document (.mxd) using simple placement options.

InsertLayer Insert a layer at a specific location within a data frame or within a group layer in a map document (.mxd).

MoveLayer Move a layer to a specific location within a data frame or group layer in a map document (.mxd).

RemoveLayer Remove a single layer or group layer from a specific data frame. If there is more than one layer that meets the criteria, then only the first layer will be removed unless the script iterates through each layer in a returned list.

UpdateLayer Update all layer properties or just the symbology for a layer in a map document (.mxd) by extracting the information from a source layer.

Page 21: 1/36. 2/36 Something cool …

21/36

Fixing broken data sources

Page 22: 1/36. 2/36 Something cool …

22/36

Methods for fixing broken data sourcesMapDocument.findAndReplaceWorkspacePaths(find_workspace_path, replace_workspace_path, {validate})

MapDocument.replaceWorkspaces(old_workspace_path, old_workspace_type, new_workspace_path, new_workspace_type,

{validate})

Layer.findAndReplaceWorkspacePath(find_workspace_path, replace_workspace_path, {validate})

Layer.replaceDataSource(workspace_path, workspace_type, dataset_name, {validate})

TableView.findAndReplaceWorkspacePath(find_workspace_path, replace_workspace_path, {validate})

TableView.replaceDataSource(workspace_path, workspace_type, dataset_name,

{validate})

Page 23: 1/36. 2/36 Something cool …

23/36

Fixing broken data source examples

Update all workspace paths for all the mxd’s in a folder from local system to UNC paths

Update all workspace paths to new folder and save to new mxd.

Page 24: 1/36. 2/36 Something cool …

24/36

Page Layout elements

Page 25: 1/36. 2/36 Something cool …

25/36

Getting Page Layout Elements

Page 27: 1/36. 2/36 Something cool …

27/36

Text Element

Page 28: 1/36. 2/36 Something cool …

28/36

RefreshActiveView() and RefreshTOC()

After changing the content of a DataFrame or Page Layout … arcpy.RefreshActiveView()

After changing items in the Table of Contents (add, remove, move, update layers) …arcpy.RefreshTOC()

Page 29: 1/36. 2/36 Something cool …

29/36

Exporting maps to images (jpg)

Page 30: 1/36. 2/36 Something cool …

30/36

Exporting maps to PDF

Page 31: 1/36. 2/36 Something cool …

31/36

PDFDocument’s

Page 32: 1/36. 2/36 Something cool …

32/36

Creating/Opening PDF Documents

Page 33: 1/36. 2/36 Something cool …

33/36

PDFDocument.appendPages Example

Page 34: 1/36. 2/36 Something cool …

34/36

Working with arcpy.mapping scripts

Edit in PyScripter and use Load …

Page 35: 1/36. 2/36 Something cool …

35/36

Help is not perfect

Should be:Find the MAPSURROUND_ELEMENT with the name "ScaleBar" and move it's x position (relative to its anchor point) to the center of the parentDataFrame.  Save this change to the MXD.

Update: ESRI listened to me:

Page 36: 1/36. 2/36 Something cool …

36/36