|
POST
|
ArcGIS Pro uses the Anaconda Python distribution. You can run your script standalone by activating the arcgispro-py3 environment and calling python or directly by calling propy.bat. It's explained in the help http://pro.arcgis.com/en/pro-app/arcpy/get-started/using-conda-with-arcgis-pro.htm
... View more
10-28-2017
01:27 PM
|
1
|
2
|
3624
|
|
POST
|
You probably just need to add a "Calculate Statistics" step in your script.
... View more
08-20-2017
04:23 PM
|
1
|
0
|
950
|
|
POST
|
It's probably because you're not stripping the newline/carriage return character off each line and the last line doesn't have a trailing return. Try line = line.strip() in the body of your for loop.
... View more
07-31-2017
05:42 AM
|
1
|
3
|
2422
|
|
POST
|
The EVI formula only works with reflectance (from 0 - 1) because of the coefficients in the formula - L=1, C1 = 6, C2 = 7.5, and G (gain factor) = 2.5 NDVI has no such coefficients, so you can calculate it regardless of whether your data is scaled or not. Note that that scale factor I referred to is specifically for the MODIS MYD09A1 surface reflectance product. MODIS MYD09A1 surface reflectance values are multiplied by 1000 and then stored as 16-bit integer data to reduce file size/storage space. The scale factor converts the 16 bit values to floating point values from 0.0 - 1.0 If you want Landsat EVI, you can just download it these days. If you want to calculate it yourself, you need to use reflectance data (not DN) which you can either download (the surface reflectance product) or calculate it yourself (either simple top of atmosphere reflectance or atmospheric correction to surface reflectance).
... View more
07-26-2017
06:39 PM
|
0
|
0
|
3015
|
|
POST
|
Have you tried passing the full path to "../ArcGISPro/GenerateVectorTpks.py"? My example above is simplistic, but I use this method a lot for some pretty complex stuff. Mainly loading non-arcgis conda environments to do some heavy lifting with specific native libraries that don't play nicely with ArcGIS Desktop (we're stuck at 10.2 for the foreseeable future), but running from 10.2 ArcToolbox script tools/python toolboxes.
... View more
02-15-2017
02:25 PM
|
0
|
1
|
5583
|
|
POST
|
You're passing the arguments to Popen incorrectly, you need to pass each argument as a list element not a single string. Replace cmd = ["D:/Program Files/ArcGIS/Pro/bin/Python/Scripts/propy.bat", "../ArcGISPro/GenerateVectorTpks.py -rt all -vt electric -oc " + operCo] With cmd = ["D:/Program Files/ArcGIS/Pro/bin/Python/Scripts/propy.bat", "../ArcGISPro/GenerateVectorTpks.py", "-rt", "all", "-vt", "electric", "-oc", operCo] For example: #test27.py
import sys, subprocess
operCo = "blahblah"
cmd = ["C:/Program Files/ArcGIS/Pro/bin/Python/Scripts/propy.bat", "C:/Temp/testpro.py", "-rt", "all", "-vt", "electric", "-oc", operCo]
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False)
output, error = p.communicate()
print('*'*10)
print(sys.version)
print(' '.join(sys.argv))
print('*'*10)
print(output)
#testpro.py
import sys
print(sys.version)
print(*sys.argv) Outputs: **********
2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit (Intel)]
C:/Temp/test27.py
**********
3.5.2 |Continuum Analytics, Inc.| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)]
C:/Temp/testpro.py -rt all -vt electric -oc blahblah
... View more
02-15-2017
02:01 PM
|
1
|
5
|
5583
|
|
POST
|
You're calling a conda python without activating the conda environment. Use "D:/Program Files/ArcGIS/Pro/bin/Python/Scripts/propy.bat" instead of 'etc.../envs/arcgispro-py3/python.exe'. More info:Python, conda, and ArcGIS Pro—ArcPy Get Started | ArcGIS Desktop
... View more
02-14-2017
06:15 PM
|
1
|
7
|
5583
|
|
POST
|
You may wish to look into ArcGIS Server which is available for Linux (RHEL and derivatives supported). ArcGIS Server 10.5 system requirements—Installation Guides (10.5) | ArcGIS Enterprise
... View more
02-05-2017
05:41 PM
|
1
|
1
|
1588
|
|
POST
|
Please never just say "it's not working". You are much more likely to get an answer by specifying what should happen and what actually happens, i.e does your script actually run at all, does it output the wrong result, does it output nothing, does it crash with an exception, what was the exception message, does python crash, does any smoke come out of your pc, does your pc vanish in a fiery explosion? Etc...
... View more
12-31-2016
07:59 PM
|
1
|
0
|
2455
|
|
POST
|
The cause of your actual error is not importing the zipfile module in Append2Zip.py, but that is the least of your worries. Have a read of 6. Modules — Python 2.7.13 documentation You've got quite a mess there. A script calling functions from another module that contains code that will get executed when the module is imported is a big issue and will come back and bite you in the future. Make sure you understand what 'if __name__ == "__main__:' is doing, any code that is outside this if statement will get run when the module is imported. For example, the code in Append2Zip.py will get executed when it's imported, i.e before your RemoveAddLayer and ZipFiles.ZipShape code. Without spending ages rewriting your script for you, here is the simplest way to fix your code: ###RemoveAddLayer.py##
#import arcpy
import os
from arcpy import env
#import functions
import ZipFiles
import Append2Zip
def RemoveAddLayer
#your remove addlayer code
if __name__ == "__main__:
RemoveAddLayer()
path = r"Z:\Jared\Python Scripts\Data"
out_path = r"W:\Data"
ZipFiles.ZipShapes(path, out_path)
path = r'Z:\Jared\Disclaimer - Final.txt'
zipfolders = [r'W:\Data\WillCounty_AddressPoint.zip', r'W:\Data\WillCounty_Street.zip'] #list of zip folders
for zipfolder in zipfolders: # loop through zipfolders
Append2Zip.append2Zip(zipfolder, path) #call function above?????????????????????????
... View more
12-04-2016
02:39 PM
|
1
|
0
|
1586
|
|
POST
|
You may need to change outname to Raster(outname) so you're comparing dem to a raster object instead of a string.
... View more
11-02-2016
01:36 AM
|
1
|
7
|
3516
|
|
POST
|
What do you mean by "tiles"? Are you building a tile cache for web services? An overview of the Tile Cache toolset—Help | ArcGIS for Desktop Are you trying to cut up your data into more manageable sections retaining the same format and datatype? Are you trying to create a series of map images from your data ?
... View more
10-29-2016
11:37 PM
|
0
|
0
|
1832
|
|
POST
|
Perhaps run the plotting as a separate script via a subprocess.
... View more
10-28-2016
12:28 PM
|
1
|
0
|
34351
|
|
POST
|
Mike, something like: from collections import namedtuple
import arcpy
egdb = r'path\to\connection.sde'
egdb_conn = arcpy.ArcSDESQLExecute(egdb)
table = 'SCHEMA.TABLE'
fields = ('SOMEVALUE', 'SOMENAME')
sql = 'SELECT {0} FROM {1}'.format(','.join(fields), table)
egdb_return = egdb_conn.execute(sql)
row = namedtuple('row', fields)
for i in egdb_return:
#With a dict
i = dict(zip(fields,i))
print((i['SOMEVALUE'], i['SOMENAME'])
#With a named tuple
i = row(*i)
print((i.SOMEVALUE, i.SOMENAME))
... View more
10-27-2016
07:05 PM
|
1
|
0
|
4136
|
|
POST
|
Easiest way is to just run the entire python script with Admin privileges.
... View more
10-21-2016
02:13 PM
|
1
|
0
|
18335
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-24-2022 03:08 PM | |
| 1 | 07-30-2025 03:00 PM | |
| 1 | 06-10-2025 08:06 PM | |
| 5 | 05-20-2025 07:56 PM | |
| 1 | 05-04-2025 10:34 PM |