|
POST
|
Update: I uninstalled ArcMap 10.5.1 then reinstalled. Might not have been necessary but it made sure i started fresh. I also deleted any folders referring to older versions of ArcMap. This is where I then installed the version of PythonWin you pointed out: C:\Python27\ArcGIS10.5\Lib\site-packages The pywin32-223.win32-py2.7.exe version is compatible with Python IDLE 2.7.13, which is the version that is installed with ArcGIS 10.5.1. After the install the PythonWin application lives here: C:\Python27\ArcGIS10.5\Lib\site-packages\pythonwin\Pythonwin.exe I think before I was simply not installing it in the correct location.
... View more
06-20-2018
12:21 PM
|
0
|
2
|
11216
|
|
POST
|
Jimmy, Thanks for the info. Did you install in your ArcGIS 10.5 folder? I did download the win32-py27 version as ArcMap requires Python 2.7. It saved to my 10.5 folder: C:\Python27\ArcGIS10.5. I got this Setup message and then finished the install. I'm not sure what this message meant. I opened Pywin and tried a few of my scripts. There were errors for all of them. It won't even import the Arcpy module, or any module for that matter. It seems as though it doesn't know where to find them. I uninstalled then reinstalled Pywin, but the same message appears. Have any idea what I'm doing wrong?
... View more
06-19-2018
12:36 PM
|
0
|
0
|
11216
|
|
POST
|
Dan, Line 21 never printed. But, that's OK because every layer points to the same "BonnScott.sde" connection. I think this would have printed if the connection had a name different from BonnScott. Yes, line 23 did print. Sorry, I should have mentioned that the script ran fine with no errors.
... View more
06-14-2018
01:10 PM
|
0
|
2
|
2608
|
|
POST
|
We have a new database connection and all our MXDs have to be updated. I ran a script to update the layers on a bunch of MXDs. Then I opened a map, right clicked a layer, properties, then checked under the source tab to see if the changes took place. But, the layer was still referencing the old connection. Is there a snippet I could include in this script, or something else, that verifies that the layers have indeed been updated? There is a print statement in the script, but that just prints the name of the MXD. It doesn't really give concrete proof. import arcpy
import os
def find_and_replace(MXD_workspace, oldPath, newPath):
arcpy.env.workspace = MXD_workspace
path = arcpy.env.workspace
for root, dirs, files in os.walk(path):
for name in files:
if name.endswith(".mxd"):
mxd_name = name
fullpath = os.path.join(root,name)
print mxd_name
print fullpath
mxd = arcpy.mapping.MapDocument(fullpath)
for df in arcpy.mapping.ListDataFrames(mxd):
for flayer in arcpy.mapping.ListLayers(mxd, "*", df):
if flayer.isFeatureLayer or flayer.isRasterLayer:
try:
mxd.findAndReplaceWorkspacePaths(oldPath, newPath, False)
print "Repaired the path for " + name
except:
print(mxd_name + " cannot replace paths")
mxd.save()
del mxd
print "complete..."
if __name__ == '__main__':
find_and_replace(r"\\gisfile\GISmaps\AtlasMaps\ATLAS_MAPS_18\CountyBoard",
r"Database Connections\BonnScott.sde",
r"Database Connections\gisEddy.gissql.sde") #(path2MXDs, path2oldGDB, path2newGDB)
... View more
06-14-2018
12:17 PM
|
0
|
5
|
2813
|
|
POST
|
Stephen, Thanks for the reply. Where would I download the source code from?
... View more
06-12-2018
08:03 AM
|
0
|
1
|
1379
|
|
POST
|
In this webapp the input data displays in order that a user adds it. Is there a way to alphabetize it? I heard you can do this with the unique ID, but I'm struggling to see how. Here's how the data is displayed as of now:
... View more
06-12-2018
07:41 AM
|
0
|
3
|
1514
|
|
POST
|
I updated from ArcMap 10.4 to 10.5 and now Pythonwin is not opening. Here is the full error message: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "pywin\framework\startup.py", line 49, in <module>
__import__(moduleName)
File "C:\Python27\ArcGIS10.4\Lib\site-packages\pythonwin\pywin\framework\intpyapp.py", line 3, in <module>
import win32con
ImportError: No module named win32con
It's looks as though it is because it's still rooted in the ArcGIS 10.4 folder. What is the best way to fix this?
... View more
03-20-2018
06:36 AM
|
0
|
8
|
14720
|
|
POST
|
Thanks for the help. I'll have to come back to this because i've been put on another project that should come first.
... View more
03-07-2018
06:22 AM
|
0
|
0
|
2028
|
|
POST
|
https://community.esri.com/message/755067-arcpyfeatureclasstofeatureclassconversion
... View more
03-05-2018
01:37 PM
|
0
|
0
|
4242
|
|
POST
|
I'm wondering how to have a single parameter in the arcpy.FeatureClassToFeatureClass_conversion() function instead of repeating the block of code for two variables (Address_Points and Street), basically. From what I understand, the way this script is set up now, the outer loop prints once for each variable. Then it prints once for each variable again in the inner loop. It runs as I expect, namely with no errors and saves the two feature classes as shapefiles in the Test folder. import arcpy
arcpy.env.overwriteOutput = True
# variables
infeatures = [r'fullpath\gisedit.DBO.Street',
r'fullpath\gisedit.DBO.Address_Points']
outpath = r'fullpath\GISstaff\Jared\Test'
outfeatures = ['WillCounty_Streets', 'WillCounty_AddressPoints']
# loop and print feature classes
for infs in infeatures:
print infs
for otfs in outfeatures:
print otfs
arcpy.FeatureClassToFeatureClass_conversion(infs,outpath,otfs) Result: >>> fullpath\gisedit.DBO.Street
WillCounty_Streets
WillCounty_AddressPoints
fullpath\gisedit.DBO.Address_Points
WillCounty_Streets
WillCounty_AddressPoints How do I get the print out to look like this? WillCounty_Streets
WillCounty_AddressPoints
... View more
03-05-2018
01:36 PM
|
0
|
5
|
3304
|
|
POST
|
Joe, Same result. I put the question to stack exchange, where they often like to do a lot of nagging rather than helping. From what they were saying, though, I guess it's repeating because the outer loop loops once for each variable and then loops for each variable again for the inner loop. So, I guess that sort of draws out my main problem--I'm wondering how to use a list as a means to have one variable in the arcpy.FeatureClassToFeatureClass_conversion() function instead of repeating the block of code for each variable, basically. This wasn't ,my original question, so maybe I should post an additional one.
... View more
03-05-2018
01:01 PM
|
0
|
2
|
4242
|
|
POST
|
When I run it in regular mode both print statements are printed twice. I've attempted to use break after the for statements, but then it only runs the loop enough to print one of the two variables. I also tried to exit the loop with continue and pass, which didn't do anything.
... View more
03-05-2018
09:22 AM
|
0
|
4
|
4242
|
|
POST
|
That worked great, thanks. I adapted it to save two files as you can see in the variables, and it works fine. However, after running the debugger on it I noticed it's looping through the whole thing numerous times and taking longer than it should to complete. Maybe you can spot why that is? import arcpy
arcpy.env.overwriteOutput = True
# full path to connection file:
infeatures = ([r'Database Connections\Jared to Plainfield.sde\gisedit.DBO.MGU_Will\gisedit.DBO.Street',
r'Database Connections\Jared to Plainfield.sde\gisedit.DBO.MGU_Will\gisedit.DBO.Address_Points'])
outpath = r'\\gisfile\GISstaff\Jared\Test'
outfeatures = ['WillCounty_Streets', 'WillCounty_AddressPoints']
for infs in infeatures:
print infs
for otfs in outfeatures:
arcpy.FeatureClassToFeatureClass_conversion(infs,outpath,otfs)
print otfs
... View more
03-05-2018
08:15 AM
|
0
|
6
|
4242
|
|
POST
|
Is there a way using arcpy to grab feature classes directly from an SDE and copy to a folder? I have a real chunky way to do it, namely using these functions: arcpy.mapping.ListDataFrames()
arcpy.mapping.ListLayers()
arcpy.mapping.AddLayer()
arcpy.FeatureClassToFeatureClass_conversion()
The script overall adds features from an SDE to an mxd then saves them as shapefiles in a folder. How can I avoid using the mxd as a sort of springboard?
... View more
03-02-2018
02:36 PM
|
0
|
9
|
4718
|
|
POST
|
Found out Open Data supports the following file types: map services feature services image services CSVs PDFs & Word docs
... View more
03-01-2018
07:49 AM
|
1
|
0
|
1020
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 13 hours ago | |
| 1 | 2 weeks ago | |
| 1 | 07-24-2025 01:27 PM | |
| 1 | 11-13-2025 08:22 AM | |
| 1 | 11-12-2025 08:37 AM |
| Online Status |
Offline
|
| Date Last Visited |
15 hours ago
|