|
POST
|
Hello, I'm wondering how to combine points that are within a small distance from each other, but are from the same feature class. The points represent signs on a road. When the feature was originally created an additional point was created if the sign had something on the back-- so, two points for the same sign. But, the tricky thing is each point was given a unique number. My question is how can I bring these points together and at the same time preserve the attributes? In ArcGIS Pro, I've tried arcpy.MergeLayers_geoanalytics, but that doesn't seem to work because it requires two layers. I've also tried arcpy.Integrate_management, but this treats the points within a specified distance as vertices, and sort of pulls them on top of each other. In this screen shot is an example of two signs with a point for the front of the signs and a point of the backs. I'm looking to combine these somehow?
... View more
08-12-2019
07:35 AM
|
0
|
6
|
12341
|
|
POST
|
Lance, Thanks. I changed the sde variable to a network directory sde connection file: sde = r'\\gisfile\GISstaff\Jared\connectionadmin.sde\gisedit.DBO.dFIRM_2019_Effective' It threw an error: ERROR 000733: Output Feature Class: Same as input Input Features
Failed to execute (CopyFeatures). I wonder if this has to do with env.overwriteOutput not being too reliable. EDIT: That was the wrong dataset name. It should be: sandbox.DBO.dFIRM_2019_Effective I ran it again with this and it gave me the schema lock error: ERROR 000464: Cannot get exclusive schema lock. Either being edited or in use by another application or service.
Failed to execute (CopyFeatures). I have nothing open except for Pyscripter? And nobody in my office is logged in as gisadmin?
... View more
08-07-2019
11:49 AM
|
0
|
1
|
6578
|
|
POST
|
This question is based off of another one I just had. I can't seem to update a feature dataset in a sql server enterprise geodatabase. I have sysadmin user role access to the database. One thing I've tried is copying the path of the connection file from an ArcPro project and using that in the script. This particular script here works perfect if I use it on a file geodatabase inside a folder. Basically, I'm not sure how to connect to the enterprise geodatabase. """
update the feature classes in the feature dataset gisedit.DBO.dFIRM_2019_Effective
from the shapefiles in this directory:
\\gisfile\GISsources\Federal\FEMA\DFIRM\EffectiveProducts\SHP\17197C_WillCo_FIRMdb
"""
import arcpy
from arcpy import env
import os
#shapefile variable
shp = r'\\gisfile\GISsources\Federal\FEMA\DFIRM\
EffectiveProducts\SHP\17197C_WillCo_FIRMdb'
#sde connection file variable
sde = r'C:\Users\jpilbeam\AppData\Local\Temp\ArcGISProTemp11396\
d532de7f-5c8c-43c9-94bc-3cf9407b9505\gissql.sde\dFIRM_2019_Effective'
env.workspace = shp
#populate the fcList
fcList = arcpy.ListFeatureClasses()
env.workspace = sde
env.overwriteOutput = True
#iterate list of shapefiles and copy to sde feature dataset
for shapefile in fcList:
in_shapefile = os.path.join(shp, shapefile)
out_featureclass = os.path.splitext(shapefile)[0]
print('Copying %s to %s' %(in_shapefile, out_featureclass))
arcpy.CopyFeatures_management(in_shapefile, out_featureclass)
##
print("done") Error: Traceback (most recent call last):
File "\\gisfile\GISstaff\Jared\Python Scripts\ArcGISPro\dFIRM.py", line 30, in <module>
arcpy.CopyFeatures_management(in_shapefile, out_featureclass)
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 2948, in CopyFeatures
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 2945, in CopyFeatures
retval = convertArcObjectToPythonObject(gp.CopyFeatures_management(*gp_fixargs((in_features, out_feature_class, config_keyword, spatial_grid_1, spatial_grid_2, spatial_grid_3), True)))
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 506, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000733: Output Feature Class: Same as input Input Features
Failed to execute (CopyFeatures).
EDIT: I forgot to mention that the shapefiles and the features in the dataset have the same names. I need to update the dataset every month with these shapefiles.
... View more
08-06-2019
12:18 PM
|
0
|
4
|
7471
|
|
POST
|
Lance Cole Right, those paths are set right in my actual code. Here are the files I'm testing on. Ultimately, I'm updating a feature dataset in the sql server database using a sde connection file. Current Code: """
update the feature classes in the feature dataset gisedit.DBO.dFIRM_2019_Effective
from the shapefiles in this directory:
\\gisfile\GISsources\Federal\FEMA\DFIRM\EffectiveProducts\SHP\17197C_WillCo_FIRMdb
"""
import arcpy
from arcpy import env
import os
shp = r'\\gisfile\GISstaff\Jared\Test\shapefiles'
gdb = r'\gisfile\GISstaff\Jared\Test\TestFGDB.gdb\dFIRM_2019_Effective'
env.workspace = shp
fcList = arcpy.ListFeatureClasses()
env.workspace = gdb
env.overwriteOutput = True
for shapefile in fcList:
print(shapefile)
in_shapefile = os.path.join(shp, shapefile)
print(in_shapefile)
out_featureclass = os.path.splitext(shapefile)[0]
print(out_featureclass, "\n")
print('Copying %s to %s' %(in_shapefile, out_featureclass))
arcpy.CopyFeatures_management(in_shapefile, out_featureclass)
##
print("done")
... View more
08-02-2019
08:17 AM
|
0
|
1
|
6448
|
|
POST
|
Lance, The CopyFeatures function failed: ERROR 000733: Output Feature Class: Same as input Input Features
Failed to execute (CopyFeatures). There were no errors up to that point. The print statement on your line 17 printed this: Copying pathto\Test\shapefiles\S_BASE_INDEX.shp to S_BASE_INDEX Apparently, it doesn't like that the shapefiles and the feature classes have the same names.
... View more
08-02-2019
07:11 AM
|
0
|
3
|
6448
|
|
POST
|
Joe, I attempted to put together what I thought you were saying more or less. So far, I haven't got it to work. I put the error below the code. I thought I'd try deleting the feature classes in the dataset first, then copy the shapefiles into that dataset. import arcpy
from arcpy import env
import os
#directory of shapefiles
shps = r'pathto\Test\shapefiles'
#directory of FCs in dataset
dataset = r'pathto\TestFGDB.gdb\dFIRM_2019_Effective'
#create lists for shapefiles and FCs
shpList = arcpy.ListFeatureClasses()
fcList = arcpy.ListFeatureClasses()
#iterate FC list, delete FCs, copy shapefiles to dataset
for fc in fcList:
arcpy.Delete_management(dataset, "FEATURECLASS") #(in_data, data_type)
arcpy.CopyFeatures_management(shpList, dataset) #(in_features, out_feature_class)
print("done") line 15, in <module>
for fc in fcList:
TypeError: 'NoneType' object is not iterable
... View more
08-01-2019
11:18 AM
|
0
|
5
|
6448
|
|
POST
|
Is there a way I can copy shapefiles in a directory to an Enterprise Geodatabase Feature Dataset in a stand-alone script? As a monthly update, the shapefiles would replace/update feature classes with the same names in a feature dataset. I've attempted to copy a shapefile using an SDE connection file with arcpy.CopyFeatures. The script ran but nothing happened. import arcpy
from arcpy import env
import os
ws = env.workspace = r'path\to\34512.shp'
out_ws = r'path\to\gissql(2).sde'
fcList = arcpy.ListFeatureClasses(ws)
for shapefile in fcList:
out_featureclass = os.path.join(out_ws, os.path.splitext(shapefile)[0])
arcpy.CopyFeatures_management(shapefile, out_featureclass)
... View more
07-31-2019
02:26 PM
|
0
|
10
|
7825
|
|
POST
|
That did it, thanks! for root, dirnames, filenames in os.walk(im): #iterate directory
for fname in filenames:
if fname.endswith(('.JPG', '.jpg')):
with open(os.path.join(root, fname), 'rb') as image: #file path and name
exif = exifread.process_file(image)
dt = str(exif['EXIF DateTimeOriginal']) #get 'Date Taken' from JPG
ds = time.strptime(dt, '%Y:%m:%d %H:%M:%S')
nt = time.strftime("%Y-%m-%d",ds)
newname = fname[:-4].replace(' ','_').replace('(','').replace(')','').replace('.','') + '_' + nt + ".jpg"
#print(newname)
image.close()
os.rename(os.path.join(root,fname), os.path.join(root,newname))
... View more
07-24-2019
06:57 AM
|
0
|
0
|
3644
|
|
POST
|
I tried this, but the repeats were still skipped: for root, dirnames, filenames in os.walk(im): #iterate directory
for fname in filenames:
if fname.endswith('.JPG'):
with open(os.path.join(root, fname), 'rb') as image: #file path and name
exif = exifread.process_file(image)
dt = str(exif['EXIF DateTimeOriginal']) #get 'Date Taken' from JPG
ds = time.strptime(dt, '%Y:%m:%d %H:%M:%S')
nt = time.strftime("%Y-%m-%d",ds)
newname = fname[:-4].replace(' ','_').replace('(','').replace(')','').replace('.','') + '_' + nt + ".jpg"
print(newname) prints: 7400010_2018-04-25.jpg
7400015_2018-04-25.jpg
7400016_2018-04-25.jpg
7400017_2018-04-25.jpg
...
... View more
07-23-2019
01:58 PM
|
0
|
2
|
3644
|
|
POST
|
Randy, that works nice, but is it possible to put the whole directory into a list?
... View more
07-23-2019
01:53 PM
|
0
|
0
|
3644
|
|
POST
|
Joshua, that appended JPG to the end of the date and skipped the repeats:
... View more
07-23-2019
01:22 PM
|
0
|
0
|
3644
|
|
POST
|
Hello, I have a lot of JPEGs in a Windows directory. In most cases these JPEGs do not have similar filenames. On the other hand, there are some repeats: Using exifread, I'm appending the 'date taken' to the end of the seven digit number of the filenames. This script gets me close, but it's not exactly doing what I want. It skips the files with similar names (e.g. 7400010 (2), 7400010b). Also, after running the script I'm having trouble avoiding the '.' of the file extension. Ideally, I'd like every filename to have this structure: 7400010_2018-04-25. And as far as the files with similar names goes, how do I preserve the (2) and the b? """
Loops through folder and adds the 'Date Taken' from JPG
"""
import arcpy, sys
import exifread
from exifread import exif
import os
##import time
from datetime import datetime
im = r"\\path\to\pics2\CH74"
for root, dirnames, filenames in os.walk(im): #iterate directory
for fname in filenames:
if fname.endswith('.JPG'):
with open(os.path.join(root, fname), 'rb') as image: #file path and name
exif = exifread.process_file(image)
dt = str(exif['EXIF DateTimeOriginal']) #get 'Date Taken' from JPG
ds = time.strptime(dt, '%Y:%m:%d %H:%M:%S')
nt = time.strftime("%Y-%m-%d",ds)
newname = fname[0:8] + "_" + nt + ".jpg"
image.close()
os.rename(os.path.join(root,fname), os.path.join(root,newname)) Here's how the filenames look after running this script:
... View more
07-23-2019
12:23 PM
|
0
|
8
|
3799
|
|
POST
|
Weng, It is Collector for ArcGIS, actually. Version 18.0.3. I should've mentioned that.
... View more
06-20-2019
07:07 AM
|
0
|
0
|
1359
|
|
POST
|
I can't find a way to change the green symbols in the map? There doesn't seem to be a way to do it in the CSS. On the other hand, I was able to change the number to light blue in the panel at least. Version: 2.9.0 JS API: 3.27 Here's the app: https://webapp.willcountyillinois.com/gisweb/2019_July4th/index.html
... View more
06-18-2019
12:35 PM
|
0
|
1
|
1361
|
|
POST
|
Hello, how do I lose what appears to be a subtitle ('1035243.583' in the popup box)? The number itself is from the attribute field called "Easting". I only want to see 'Post Number: 2610010'. In the web map Easting doesn't appear in the popup:
... View more
06-13-2019
12:12 PM
|
0
|
2
|
1447
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-25-2026 12:25 PM | |
| 1 | 05-04-2026 08:45 AM | |
| 1 | 04-20-2026 01:20 PM | |
| 1 | 07-24-2025 01:27 PM | |
| 1 | 11-13-2025 08:22 AM |
| Online Status |
Offline
|
| Date Last Visited |
Thursday
|