POST
|
Has anyone ever encountered this errow while performing a Clip?
... View more
10-08-2014
12:55 PM
|
0
|
1
|
2755
|
POST
|
I agree with Dan Patterson . The ESRI help has tons of really good examples for stuff like this. Most of the time you can just copy/ paste from the help documentation.
... View more
09-15-2014
02:51 PM
|
0
|
0
|
347
|
DOC
|
This is a great feature. Thank you for starting this.
... View more
09-15-2014
02:39 PM
|
0
|
0
|
7565
|
POST
|
Thank you Riyas, I new to Python too! and can use this! I can try to explain it a little bit... -The first part (6 lines) is importing your libraries and setting up all your variables. -The loop starts (line 😎 iterating though the list of "*.xls" files in the workspace folder -look at the first sheet in the excel file (line 11) -line 14 and 15 are getting the names the first two fields. -line 18 is creating the points -line 19 is adding the points to the new feature class (targetFc)
... View more
09-15-2014
02:36 PM
|
0
|
1
|
517
|
POST
|
Thank you all for the suggestions, I picked up,"Programming ArcGIS 10.1 with Python Cook Book" and "Learning Python, 5th Edition"
... View more
08-27-2014
03:19 PM
|
0
|
0
|
978
|
POST
|
I came across this method some time ago. This method does not use arcpy and is much faster. The only issue is that you have to import the geometry of your polygons. GeospatialPython.com: Point in Polygon 2: Walking the line
def point_in_poly(x,y,poly):
# check if point is a vertex
if (x,y) in poly: return "Point " + str(x) + "," + str(y) + " is IN"
# check if point is on a boundary
for i in range(len(poly)):
p1 = None
p2 = None
if i==0:
p1 = poly[0]
p2 = poly[1]
else:
p1 = poly[i-1]
p2 = poly
if p1[1] == p2[1] and p1[1] == y and x > min(p1[0], p2[0]) and x < max(p1[0], p2[0]):
return "Point " + str(x) + "," + str(y) + " is IN"
n = len(poly)
inside = False
p1x,p1y = poly[0]
for i in range(n+1):
p2x,p2y = poly[i % n]
if y > min(p1y,p2y):
if y <= max(p1y,p2y):
if x <= max(p1x,p2x):
if p1y != p2y:
xints = (y-p1y)*(p2x-p1x)/(p2y-p1y)+p1x
if p1x == p2x or x <= xints:
inside = not inside
p1x,p1y = p2x,p2y
if inside: return "Point " + str(x) + "," + str(y) + " is IN"
else: return "Point " + str(x) + "," + str(y) + " is OUT"
# Test a vertex for inclusion
poligono = [(-33.416032,-70.593016), (-33.415370,-70.589604),
(-33.417340,-70.589046), (-33.417949,-70.592351),
(-33.416032,-70.593016)]
lat= -33.416032
lon= -70.593016
print point_in_poly(lat, lon, poligono)
# test a boundary point for inclusion
poly2 = [(1,1), (5,1), (5,5), (1,5), (1,1)]
x = 10
y = 1
print point_in_poly(x, y, poly2)
... View more
08-27-2014
03:13 PM
|
0
|
0
|
2128
|
POST
|
Thank you. There are so many books out there, I just hoping to get a few suggestions from people who are interested in GIS. I like how the site breaks the books down into user level categories.
... View more
08-19-2014
02:14 PM
|
0
|
0
|
978
|
POST
|
Hey GeoNet community! I'm looking for a good book on Python. I recently finished, "Python Scripting for ArcGIS" by Zandbergen and really enjoyed it. Does anyone out there have any other good recommendations? I've been finding myself using Arcpy less then 50% of the time in my code, so it doesn't necessarily have to be specific to Python and ArcPy. Thank you
... View more
08-19-2014
02:02 PM
|
1
|
9
|
4670
|
DOC
|
This is the theme file I use in PyScripter to create the dark theme. PyScripter and Dark Themes | data.dv-proj.com
... View more
08-19-2014
12:51 PM
|
0
|
2
|
4904
|
POST
|
Thank you guys for the help, It ended up being the projection of the shapefile I was modifying. It was different from the mxd. @Neil Ayres...thank your for your suggestion, I ended up using "arcpy.PointGeometry" and adding a Describe variable in the beginning of the code. I like the fact that it adds the SR to the points.
... View more
08-19-2014
08:53 AM
|
0
|
0
|
713
|
POST
|
Sorry its in the "NAD_1927_StatePlane_Louisiana_Offshore_FIPS_1703" coordinate system.
... View more
08-19-2014
08:39 AM
|
0
|
1
|
713
|
POST
|
Filip Král I am running ArcGIS 10.0, so Im not able to use the "new" insert cursor (da).
... View more
08-19-2014
08:28 AM
|
0
|
0
|
713
|
POST
|
The shapefile is in the ........... coordinate system The file is already in a MXD file, the script deletes all existing points and adds the new ones. Thank your responding
... View more
08-19-2014
08:27 AM
|
0
|
2
|
713
|
POST
|
I'm using Python to read the points and add them to an existing shape file. The problem is that the all the points are in the same location and no where the location they are supposed to be. NOTE: If I calculate the X and Y fields, all the correct coordinates are displayed. If export the data and import back in, the points are in the correct location. Does anyone have any suggestions on fixing this?
import arcpy
arcpy.overwriteoutput = True
out_path = r"M:\work\nettoc\MAS201300311\PythonModule\import_data"
pointFC = r"M:\work\nettoc\MAS201300311\PythonModule\import_data\POI.shp"
geoType = "POINT"
StructurePoints = open(r"M:\work\nettoc\MAS201300311\PythonModule\import_data\TEST2.txt", "r")
coordList = []
# Parse the exported text file and create a list that Python can read
# figure out position of the lat and long in the header
headerLine = StructurePoints.readline()
valueList = headerLine.split(",")
latValueIndex = valueList.index('"SURF_LATITUDE"')
longValueIndex = valueList.index('"SURF_LONGITUDE"')
planValueIndex = valueList.index('"PLAN"')
typeValueIndex = valueList.index('"PLAN_SITE_TYPE"')
ancRadiusValueIndex = valueList.index('"ANCHOR_RADIUS"')
# Read line in the file and append to coordinate list
for line in StructurePoints.readlines():
# need to say what the seperating value is, in this case its the ","
segmentedLine = line.split(",")
# only append the value (index) indicated... we could have used "segmentedline[2]", but if lat changes position in the header list
# we would have to change the index number.
coordList.append([segmentedLine[planValueIndex], segmentedLine[typeValueIndex], segmentedLine[ancRadiusValueIndex], segmentedLine[longValueIndex], segmentedLine[latValueIndex]])
# Loop and delete any existing features in the shapefile
rows = arcpy.UpdateCursor(pointFC)
for row in rows:
rows.deleteRow(row)
del rows, row
print "Prepairing shape file..."
# Loop through new created coordlist and insert the the points in the existing shape file
rowInserter = arcpy.InsertCursor(pointFC)
#Loop through each coordinate in the list
for coordinate in coordList:
# Grab a set of coordinates from the list and assign them to a point obejct
longValue = float(coordinate[3])
latValue = float(coordinate[4])
pointGeometry = arcpy.Point(longValue,latValue)
# use the insert cursor to put in the point object in the feature class
newPoint = rowInserter.newRow()
newPoint.Shape = pointGeometry
newPoint.DESCR = coordinate[0] + ", " + coordinate[1]
newPoint.ANCHOR_RAD = coordinate[2]
rowInserter.insertRow(newPoint)
del rowInserter
print "The following points were created"
print coordList
... View more
08-18-2014
08:59 AM
|
0
|
7
|
1292
|
Title | Kudos | Posted |
---|---|---|
1 | 08-19-2014 02:02 PM | |
1 | 08-19-2014 12:58 PM |