Questions tagged [arcpy]

ArcPy is a Python module for interacting with ArcGIS tools. The module was developed by Esri, the company that makes ArcGIS. ArcPy offers a high-level implementation of Esri's ArcObjects programming library. The best place to ask about ArcPy is our sister site GIS Stack Exchange.

ArcPy is used for customizing mapping and geoprocessing solutions within the ArcGIS 10 software. It can be accessed through the Python window of ArcMap, ArcGIS ModelBuilder as an imported script-tool, toolboxes written entirely in Python or externally through IDEs. Executing machines must have a valid installation of ArcGIS for Desktop or ArcGIS Engine to use the arcpy site package.

The following command is used to import the module into a Python script.

import arcpy

There are very large number of ArcPy Q&As at the GIS Stack Exchange. This sister site is the best place to ask questions concerning the ArcPy site-package.

758 questions
48
votes
5 answers

python dict to numpy structured array

I have a dictionary that I need to convert to a NumPy structured array. I'm using the arcpy function NumPyArraytoTable, so a NumPy structured array is the only data format that will work. Based on this thread: Writing to numpy array from…
Christa
  • 497
  • 1
  • 4
  • 8
40
votes
5 answers

Unzip all zipped files in a folder to that same folder using Python 2.7.5

I would like to write a simple script to iterate through all the files in a folder and unzip those that are zipped (.zip) to that same folder. For this project, I have a folder with nearly 100 zipped .las files and I'm hoping for an easy way to…
tpdance
  • 1,273
  • 1
  • 9
  • 13
38
votes
3 answers

Flask app with ArcGIS, Arcpy does not run

I have a script that gets a table from MSSQL database and then registers it with ArcGIS. It uses several other arcpy methods as well. I tried to combine it with Flask and developed an HTML interface where you can specify tables. The script runs on…
EFKan
  • 634
  • 5
  • 9
18
votes
8 answers

RuntimeError: b'no arguments in initialization list'

I'm trying to solve my issue in my own but I couldn't, I'm trying to run this code in every format you can imagine and in ArcGIS pro software it's the same I can't find this error message in any other issue. From similar issues, it seems some data…
Maram Mubarak
  • 323
  • 2
  • 3
  • 11
9
votes
4 answers

how to create datetime from a negative epoch in Python

First timer on StackExchange. I am working with ArcGIS Server and Python. While trying to execute a query using the REST endpoint to a map service, I am getting the values for a field that is esriFieldTypeDate in negative epoch in the JSON…
Anand
  • 93
  • 1
  • 4
9
votes
4 answers

Only accept alphanumeric characters and underscores for a string in python

I'm currently writing validation code for a tool parameter in ArcMap 10 (updateMessages) and need to prevent users from using non-alphanumeric characters within a string as it will be used to name a newly created field in a feature class. I have so…
Howeitzer
  • 220
  • 1
  • 2
  • 7
8
votes
1 answer

Why does importing module in '__main__' not allow multiprocessig to use module?

I've already solved my problem by moving the import to the top declarations, but it left me wondering: Why cant I use a module that was imported in '__main__' in functions that are the targets of multiprocessing? For example: import os import…
user7811364
7
votes
2 answers

arcpy get database path of feature class in feature dataset

I am trying to get the database path of a feature class that may or may not be in a feature dataset. I am using the os.path.dirname of the feature class. This will give me either the database path if the feature class is not in a feature dataset…
Genspec
  • 2,279
  • 2
  • 14
  • 10
7
votes
2 answers

return characters between two underscores

I would like to extract a string of characters between two underscores. The number of characters between and on each side of the '_' will vary, but there will only ever be two underscores. The long field with underscores is a text field, the field…
cherrytree
  • 1,561
  • 3
  • 16
  • 33
7
votes
2 answers

Python: how to create a point shape-file from a text file

I'm writing a python code to read the points in a polygon shape-file and save them in a point shape file. So first I made a text file and stored the points' (x,y) in that .txt file. then I tried to make a point shape-file from the text file but it…
user2841098
  • 313
  • 5
  • 12
6
votes
1 answer

Where and how can I install ArcPy for Python 2.7?

I have checked http://www.lfd.uci.edu/~gohlke/pythonlibs/, http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//003m00000002000000.htm, and https://pypi.python.org/pypi/pygeoif/0.4.1 None of these logical places can I download arcpy for…
KubiK888
  • 4,377
  • 14
  • 61
  • 115
6
votes
2 answers

How to limit the raster processing extent using a spatial mask?

I am trying to limit raster processing in MATLAB to include only areas within a shapefile boundary, similar to how ArcGIS Spatial Analyst functions use a mask. Here is some (reproducible) sample data I am working with: A 4-band NAIP image (WARNING…
Borealis
  • 8,044
  • 17
  • 64
  • 112
6
votes
3 answers

Importing arcpy module into anaconda's Spyder

I would like to use arcpy into Anaconda's Spyder. I have a full ArcGIS license, so this is not an issue. I am able to semi-import the module by way of copying the the arcpy folder out of C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy and into…
user2657663
  • 73
  • 1
  • 1
  • 4
5
votes
3 answers

ogr2ogr Or arcpy for csv to shapefile?

Can ogr2ogr or arcpy do a direct csv to shapefile conversion? I'm trying to automate some processes with a small script and was hoping I can do it easily with ogr2ogr or arcpy which I'm new to. Any input would be appreciated.
Steven Lutz
  • 467
  • 1
  • 6
  • 16
5
votes
4 answers

Check if Sphinx doc called the script

I am currently trying to generate sphinx documentation for scripts which use the ArcGIS arcpy library. I am running into an issue when sphinx tries to run the scripts while generating the documentation, as arcpy scripts take input parameters from…
navigator_
  • 288
  • 1
  • 10
1
2 3
50 51