|
POST
|
What data do you have to work with? For example, are the streets attributed with speed (e.g. 20mph) or time (e.g. 0.05 hours/mile)? Or do you have a completely blank street file?
... View more
07-20-2016
02:20 PM
|
0
|
0
|
1972
|
|
POST
|
If your catchment layer has classes (landcover classes?) then what does your landcover raster have? I'm clearly missing something here.
... View more
07-18-2016
08:59 PM
|
0
|
0
|
4914
|
|
POST
|
In Map Algebra -> Raster Calculator, you can use an expression like: Con("landcover"==5,1) Translation: for every pixel in the land cover raster, if land cover value is 5 (or whatever your forest gridcode is), make the output value 1 (or whatever value you want), otherwise make the value NoData. Now when you convert to polygon, it will only consider 1 vs NoData, so many less separate conversions.
... View more
07-18-2016
03:57 PM
|
2
|
3
|
4914
|
|
POST
|
What are you getting by dissolving on land cover type that you can't get from a raster? It sounds like maybe you've thought this through, but many people are just more comfortable with vector so they try to force the data into that format, unnecessarily. Also, do you need all land cover types or only those relevant to core habitat? Con or Reclassify may be able to simplify your raster before converting to vector. The point is to have the fewest huge polygons. It takes a long time to convert a million square pixels, but a short time to convert just a few classes.
... View more
07-18-2016
03:31 PM
|
2
|
6
|
4914
|
|
POST
|
This is about the bare minimum required to make it happen via Python: >>> mxd = arcpy.mapping.MapDocument("CURRENT") # map
... df = arcpy.mapping.ListDataFrames(mxd)[0] # get 1st data frame
... sr = df.spatialReference # get spatial reference
... ext = df.extent # extent object
... BL = arcpy.Point(ext.XMin,ext.YMin) # bottom left
... BR = arcpy.Point(ext.XMax,ext.YMin) # bottom right
... TR = arcpy.Point(ext.XMax,ext.YMax) # top right
... TL = arcpy.Point(ext.XMin,ext.YMax) # top left
... df_poly = arcpy.Polygon(arcpy.Array([[BL,BR,TR,TL,BL]]),sr) # create polygon
... arcpy.CopyFeatures_management(df_poly,r'in_memory\poly') # write to disk
... View more
07-18-2016
03:21 PM
|
1
|
0
|
4443
|
|
POST
|
I suppose you've considered staying in raster-world until you absolutely have to switch to vector? "Raster is faster" (although vector is correcter...)
... View more
07-18-2016
03:00 PM
|
1
|
8
|
6799
|
|
POST
|
Actuuuually, the .shp + .dbf can exceed 2GB (but neither individually). Just a fun fact: FAQ: Are there file size limitations for shapefiles? Anyhow, since some of your errors seem to indicate geometry issues, you may want to run Check Geometry or Repair Geometry on your feature class.
... View more
07-18-2016
02:17 PM
|
1
|
11
|
6799
|
|
POST
|
You can also use the SetNull tool to expand the NoData region around the smaller raster to the extent of the larger raster. Set the Output Extent and Snap Raster environments to the larger raster, and use a Raster Calculator expression like: SetNull(IsNull("small_ras"),"small_ras")
... View more
07-13-2016
04:34 PM
|
4
|
0
|
5381
|
|
POST
|
You've found your answer, but in general you can do this by including more fields in your cursor: with arcpy.da.InsertCursor(outputFC, ["SHAPE@","ID"]) as cursor: # should use 'with' notation
for row in cursor:
row[0] = # the geometry value
row[1] = # the ID value
cursor.insertRow(row) # write entire row
... View more
07-13-2016
02:49 PM
|
2
|
0
|
2992
|
|
POST
|
The expression you want is: Con("acc_log_norm"==0, "modis3_norm_final", "acc_log_norm") Translation: If "acc_log_norm" equals zero, then use "modis3_norm_final", else use "acc_log_norm".
... View more
07-13-2016
01:05 PM
|
1
|
0
|
2860
|
|
POST
|
Your enumerate 'i' still starts at 0, even though the list you're enumerating starts at 1. >>> my_fields = [u'HydroID', u'Commercial_Forestry', u'Cultivated', u'Indigenous', u'Mines', u'Natural_Vegetation_Forest', u'Urban', u'Waterbodies', u'Wetlands', u'CatchAreaKm2']
... for i, landuse in enumerate(my_fields[1:]):
... print (i,my_fields)
...
(0, u'HydroID')
(1, u'Commercial_Forestry')
(2, u'Cultivated')
(3, u'Indigenous')
(4, u'Mines')
(5, u'Natural_Vegetation_Forest')
(6, u'Urban')
(7, u'Waterbodies')
(8, u'Wetlands')
>>> my_fields = [u'HydroID', u'Commercial_Forestry', u'Cultivated', u'Indigenous', u'Mines', u'Natural_Vegetation_Forest', u'Urban', u'Waterbodies', u'Wetlands', u'CatchAreaKm2']
... for i, landuse in enumerate(my_fields[1:-1]):
... print (i,my_fields)
...
(0, u'HydroID')
(1, u'Commercial_Forestry')
(2, u'Cultivated')
(3, u'Indigenous')
(4, u'Mines')
(5, u'Natural_Vegetation_Forest')
(6, u'Urban')
(7, u'Waterbodies')
... View more
07-13-2016
12:13 PM
|
1
|
3
|
2704
|
|
POST
|
Of course, that definition query ('% TH %') will not match your original example ('PETROLEUM WELL NO 1 TH'), which does not end in a space.
... View more
07-12-2016
05:00 PM
|
0
|
0
|
1816
|
|
POST
|
Ignores 'TH' anywhere': "Name" Not Like '%TH%' Ignores 'TH' only at the end: "Name" Not Like '%TH' Ignores 'TH' preceded by a space: "Name" Not Like '% TH%' etc. Building a query expression—Help | ArcGIS for Desktop
... View more
07-12-2016
01:22 PM
|
2
|
0
|
1816
|
|
POST
|
Just saving some people time: Script: '''
Created by SGT Russel Klueg
11 JULY 16
About: This script is meant to increase the response time of data creation
by allowing for the earthquake to be put in and outputting KMLs of all critical
infrastructure within a set distance of the location.
'''
import os, time, arcpy, csv
from arcpy import env
#Allows data to be overwritten
env.overwriteOutput = True
path = r'C:\Users\JOC-001\Desktop\Python Scripts\Earthquake\Earthquake Infrastructure.mxd'
#sets the path listed as the Map Document
mxd = arcpy.mapping.MapDocument(path)
#declares the Dataframe
df = "HSIP"
outPath = 'C:/Users/JOC-001/Documents/ArcGIS/Scratch.gdb/'
env.workspace = outPath
sr = arcpy.SpatialReference("WGS 1984")
#Takes the current time and creates a folder from it in YYYYMMDD HHMM format
current = time.strftime('%Y%m%d %H%M')
os.mkdir(current)
earthquake = 'C:/Users/JOC-001/Desktop/Python Scripts/Earthquake/'
folder = earthquake + current + '/'
print("The output folder for this entire process is below:\n" + folder)
#the next few lines take a verified user input to use as the Lat and Long
lat = float(raw_input("Please enter the Latitude of the event." + \
"\nNumber should range between between 36.5 and 42.5\n"))
while lat < 36.5 or lat > 42.5:
lat = float(raw_input("Please enter a valid Latitude between 36.5 and 42.5\n"))
long = float(raw_input("Please enter the Longitude of the event." + \
"\nNumber should range between between -87 and -92\n"))
while long < -92 or long > -87:
long = float(raw_input("Please enter a valid Longitude between -87 and -92\n"))
finalCoords = folder + 'coords.csv'
#Creates a csv file and moves it into the appropriate folder
with open('coords.csv', 'wb') as coords:
writer = csv.writer(coords, delimiter=',')
data = [['Lat', 'Long'],[lat, long]]
writer.writerows(data)
os.rename(earthquake+'coords.csv', finalCoords)
#Creatst the layer, converts to .shp and buffers it at 50 miles.
eventPoint = folder + 'event.lyr'
arcpy.MakeXYEventLayer_management(finalCoords, 'Long', 'Lat', 'Event', sr)
arcpy.SaveToLayerFile_management('Event', eventPoint)
arcpy.FeatureClassToFeatureClass_conversion(eventPoint, outPath, 'finalPoint')
arcpy.Buffer_analysis(outPath + 'finalPoint', 'pointBuffer', '50 Miles')
bufferFile = outPath + 'pointBuffer'
#Iterates through every single layer in the MXD and selects data and exports it.
for lyr in arcpy.mapping.ListLayers(mxd):
if not lyr.isGroupLayer:
name = lyr.name
arcpy.SelectLayerByLocation_management(lyr, 'INTERSECT', bufferFile)
arcpy.CopyFeatures_management(lyr, name) Error: Traceback (most recent call last): File "C:\Users\JOC-001\Desktop\Python Scripts\Earthquake\Earthquake.py", line 67, in <module> arcpy.CopyFeatures_management(lyr, name) File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\management.py", line 2429, in CopyFeatures raise e ExecuteError: ERROR 000210: Cannot create output C:/Users/JOC-001/Documents/ArcGIS/Scratch.gdb\Animal Aquaculture Facilities Failed to execute (CopyFeatures).
... View more
07-12-2016
11:09 AM
|
1
|
1
|
2592
|
|
POST
|
If I understand correctly, your point coordinates are "correct" for some coordinate reference system slightly different from State Plane Meters, like there is an offset of 30m or so (as I've mapped above). The offset value in your spreadsheet corresponds to the offset from the road center, where zero would be the center of the road. Unfortunately, as they are, the coordinates don't correspond to the road in terms of regular State Plane Meters. Does your survey plan give any other hints about the coordinate reference system?
... View more
07-11-2016
03:22 PM
|
0
|
1
|
5010
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-30-2013 02:22 PM | |
| 1 | 04-12-2011 11:19 AM | |
| 1 | 09-17-2021 09:43 AM | |
| 1 | 04-04-2012 12:05 PM | |
| 2 | 07-16-2020 11:31 AM |
| Online Status |
Offline
|
| Date Last Visited |
07-15-2023
12:11 AM
|