This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arcpy | |
# read California cities features' geometries into a WKT string | |
arcpy.Multipoint( | |
arcpy.Array([ | |
arcpy.Point(*coords) for coords in [ | |
r[0] for r in arcpy.da.SearchCursor('cities', 'SHAPE@XY', | |
"STATE_NAME = 'California'", | |
arcpy.SpatialReference(3857)) | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Script that demonstrates how to use predefined layer files (.lyr) | |
to change the selection symbol for any map document layer. The | |
selection symbol is not exposed via `arcpy.mapping.Layer` object, so | |
it is necessary to emulate the selection using another layer drawn | |
on top of the layer that you targeting your selection against. | |
The script assumes that you have prepared beforehand 3 layers (.lyr | |
files) for each shape type (point, polyline, polygon). | |
''' |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
To be able to run this tool inside ArcGIS Pro: | |
1. Copy the ArcGIS Pro env to a new folder. | |
2. In clean ArcGIS Pro env, install with built-in Pro package manager: | |
* PyQt 5.6 | |
* shapely 1.7 | |
3. Create a new custom script tool (with a parameter to specify path to a shapefile | |
or a feature class) and point to this source Python module. | |
4. Run the script tool. It might take some seconds for the tool to start. This is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import threading | |
import arcpy | |
from PyQt5.QtWidgets import (QMainWindow, QLabel, QApplication) | |
from PyQt5.QtCore import Qt | |
class MainWindow(QMainWindow): | |
def __init__(self, *args, **kwargs): | |
super(MainWindow, self).__init__(*args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import arcpy | |
from PyQt5.QtWidgets import (QMainWindow, QLabel, QApplication) | |
from PyQt5.QtCore import Qt | |
class MainWindow(QMainWindow): | |
def __init__(self, *args, **kwargs): | |
super(MainWindow, self).__init__(*args, **kwargs) | |
self.setWindowTitle("Basic App") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arcpy | |
#---------------------------------------------------------------------- | |
def are_collinear(p1, p2, p3, tolerance=0.5): | |
"""return True if 3 points are collinear. | |
tolerance value will decide whether lines are collinear; may need | |
to adjust it based on the XY tolerance value used for feature class""" | |
x1, y1 = p1[0], p1[1] | |
x2, y2 = p2[0], p2[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from comtypes.client import GetModule, CreateObject | |
from snippets102 import GetStandaloneModules, InitStandalone | |
esriCarto = GetModule(r"C:\Program Files (x86)\ArcGIS\Desktop10.5\com\esriCarto.olb") | |
# First time through, need to import the “StandaloneModules”. Can comment out later. | |
GetStandaloneModules() | |
InitStandalone() | |
# Create a map document object |