shrug-l: Zoom map to the extent of a layer in Arcpy.mp

Pollock, William H. (Bill) William.H.Pollock at dep.state.fl.us
Fri Jun 2 14:53:18 EDT 2017


Thanks Jim and Janelle –

Yes, thanks i have come across those bits...

Migrating from arcpy.mapping to ArcGIS Pro
http://pro.arcgis.com/en/pro-app/arcpy/mapping/migratingfrom10xarcpymapping.htm

But that’s what is puzzling...

Why are certain layer-specific functions (Zoom To, Get Extent) NOT accessible from the Map object, but rather only from the MapFrame and Camera objects?

There is a context-menu function in the Contents tab to accomplish this and apply to the Map, but no ArcPy.mp approach to do the same.

Thanks again.


[cid:image001.png at 01D2DBAF.ABABD2D0]


William Pollock, GISP
Kyra Solutions, Inc.
FL Department of Environmental Protection
850.245.2722 ext. 4722



From: Janelle Versnick [mailto:Janelle.Versnick at citizensfla.com]
Sent: Friday, June 2, 2017 2:30 PM
To: 'Jeff Reed' <fsu1jreed at gmail.com>; Pollock, William H. (Bill) <William.H.Pollock at dep.state.fl.us>
Cc: shrug-l at lists.dep.state.fl.us
Subject: RE: shrug-l: Zoom map to the extent of a layer in Arcpy.mp

I would check this link out. http://pro.arcgis.com/en/pro-app/arcpy/mapping/mapframe-class.htm<https://urldefense.proofpoint.com/v2/url?u=http-3A__pro.arcgis.com_en_pro-2Dapp_arcpy_mapping_mapframe-2Dclass.htm&d=DwMGaQ&c=-Q2oFtSeUeVdqcGrCCygxt6LResmVl0POOzRQwCZt0Q&r=FAqjIOx-pcrFksx2QCBU9vvFSJik7v39msusBaSUzSIdQZnp89FWM1k9-7mn_3ho&m=j8laF0QZ2eGrL5qrcVaTM5hoklOSiiFBYNAA4tBjBh4&s=E7Jx81RnCp8-pO6CW0ljKLIdUa5NaT_A6TNxuuTS0u4&e=>

getLayerExtent (layer, {selection_only}, {symbolized_extent})

Returns a layer's extent for all features or only the selected features in a layer.

panToExtent (extent)

Pans and centers the MapFrame using a new Extent<https://urldefense.proofpoint.com/v2/url?u=http-3A__pro.arcgis.com_en_pro-2Dapp_arcpy_classes_extent.htm&d=DwMGaQ&c=-Q2oFtSeUeVdqcGrCCygxt6LResmVl0POOzRQwCZt0Q&r=FAqjIOx-pcrFksx2QCBU9vvFSJik7v39msusBaSUzSIdQZnp89FWM1k9-7mn_3ho&m=j8laF0QZ2eGrL5qrcVaTM5hoklOSiiFBYNAA4tBjBh4&s=ntDU_do_kyzcW-z5I1YbtKIta_BUoB7d85qVPW4mM_I&e=> object without changing the map frame's scale.

zoomToAllLayers ({selection_only}, {symbolized_extent})

Modifies the MapFrame view to match the extent of all layers or selected layers in a map.




Janelle Versnick, GISP | Data Science Analyst
Corporate Analytics
Citizens Property Insurance Corporation

Office: 850-521-8373
Email: Janelle.Versnick at Citizensfla.com<mailto:Janelle.Versnick at Citizensfla.com>


From: Thomas, Jim [mailto:jim_thomas at golder.com]
Sent: Friday, June 2, 2017 2:29 PM
To: Jeff Reed <fsu1jreed at gmail.com>; Pollock, William H. (Bill) <William.H.Pollock at dep.state.fl.us>
Cc: shrug-l at lists.dep.state.fl.us
Subject: RE: shrug-l: Zoom map to the extent of a layer in Arcpy.mp

Hi,  Saw this post from esri on geonet 5/3/2017.  Not sure if it’s what you’re trying to do.

“I just talked to an arcpy.mp developer and he said zooming on a Map View is not supported in arcpy.mp yet and probably will not be for awhile.”

https://geonet.esri.com/thread/194310-zoom-map-to-an-layer-in-arcpymp-arcgis-pro-project



From: SHRUG-L [mailto:shrug-l-bounces at lists.dep.state.fl.us] On Behalf Of Jeff Reed
Sent: Friday, June 02, 2017 1:53 PM
To: Pollock, William H. (Bill) <William.H.Pollock at dep.state.fl.us<mailto:William.H.Pollock at dep.state.fl.us>>
Cc: shrug-l at lists.dep.state.fl.us<mailto:shrug-l at lists.dep.state.fl.us>
Subject: Re: shrug-l: Zoom map to the extent of a layer in Arcpy.mp

Doh!

Sorry, I didn't read that close........I have no clue there.

On Fri, Jun 2, 2017 at 12:48 PM, Pollock, William H. (Bill) <William.H.Pollock at dep.state.fl.us<mailto:William.H.Pollock at dep.state.fl.us>> wrote:
Thanks Jeff –

But those apply to ArcGIS Desktop and ArcPy.mapping.

Looking for the equivalents in ArcGIS Pro and ArcPy.mp.

Thanks again.
+ bill


William Pollock, GISP
Kyra Solutions, Inc.
FL Department of Environmental Protection
850.245.2722 ext. 4722<tel:(850)%20245-2722>

From: Jeff Reed [mailto:fsu1jreed at gmail.com<mailto:fsu1jreed at gmail.com>]
Sent: Friday, June 2, 2017 1:46 PM
To: Pollock, William H. (Bill) <William.H.Pollock at dep.state.fl.us<mailto:William.H.Pollock at dep.state.fl.us>>
Cc: shrug-l at lists.dep.state.fl.us<mailto:shrug-l at lists.dep.state.fl.us>
Subject: Re: shrug-l: Zoom map to the extent of a layer in Arcpy.mp

Yes there is.

There's the getSelectedExtent method for a Layer<http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Layer/00s300000008000000/>:
•  getExtent ({symbolized_extent}) - Returns a layer's geometric or symbolized extent
•  getSelectedExtent ({symbolized_extent}) - Returns a layer's geometric or symbolized extent for selected features
A getSelectedExtent method <http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/DataFrame/00s300000003000000/> Dataframe<http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/DataFrame/00s300000003000000/>:
•  panToExtent (extent) - Pans and centers the data frame extent using a new Extent object without changing the data frame's scale
•  zoomToSelectedFeatures () - Changes the data frame extent to match the extent of the currently selected features for all layers in a data frame
Plus you can try these:
•  df.zoomToSelectedFeatures() - will zoom to the extents of the data frame to all selected features in the map frame
•  lyr.getSelectedExtent() - will zoom to to a selection set for a specific layer

On Fri, Jun 2, 2017 at 9:48 AM, Pollock, William H. (Bill) <William.H.Pollock at dep.state.fl.us<mailto:William.H.Pollock at dep.state.fl.us>> wrote:
Howdy SHRUG –

Anyone find a way to “zoom Map to the extent of a layer in Arcpy.mp” ?

There are many scenarios where this basic function, zooming to a layer or a selection, would be used, right ?

Zoom map to the extent of a layer in Arcpy.mp (May 02, 2017)
https://geonet.esri.com/thread/194310-zoom-map-to-an-layer-in-arcpymp-arcgis-pro-project

Choosing and zooming to features using SQL query in ArcPy with ArcGIS Pro? (Dec 14, 2015)
https://gis.stackexchange.com/questions/173687/choosing-and-zooming-to-features-using-sql-query-in-arcpy-with-arcgis-pro

Thank you and cheers,
+ bill

William Pollock, GISP
Kyra Solutions, Inc.
FL Department of Environmental Protection
850.245.2722 ext. 4722<tel:(850)%20245-2722>


_______________________________________________
SHRUG-L mailing list
SHRUG-L at lists.dep.state.fl.us<mailto:SHRUG-L at lists.dep.state.fl.us>
http://lists.dep.state.fl.us/mailman/listinfo/shrug-l



--
Jeff Reed
GIS Analyst/ECUA
Adjunct Professor/Delta State University

[Dep Customer Survey]<http://survey.dep.state.fl.us/?refemail=William.H.Pollock@dep.state.fl.us>



--
Jeff Reed
GIS Analyst/ECUA
Adjunct Professor/Delta State University

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20170602/c4449e19/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 35599 bytes
Desc: image001.png
URL: <http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20170602/c4449e19/attachment-0001.png>


More information about the SHRUG-L mailing list