Python is an open source interpreted programming language used in many GIS programs.

learn more… | top users | synonyms

1
vote
3answers
365 views

Invoke FME batch process/Process using c#

I want to invoke FME batch process and general FME processes using c#, I have no idea about FME, can anyone please let me know if anything like this is possible?or is it possible in python, any help ...
1
vote
1answer
1k views

Delete first two letters from a string field

I'm looking for a field calculator python statement to delete only the first two letters of string entries. For Ex: !Name!.strip([0:2]) I know this syntax is incorrect. Thanks a lot
1
vote
1answer
941 views

SImple model works, resulting script doesn't

The goal is to convert an XY layer (from Excel) into a feature class. The "MakeXY" portion works flawlessly, the arcpy.FeatureClassToFeatureClass_conversion portion inevitably returns a 999999 "Table ...
1
vote
2answers
249 views

Split a string column into 2 columns in python [closed]

I have a csv file and this is the structure of that file. It has only one column with number of strings. I want to split this one column into 2 columns at the character \. Can anyone please tell me ...
1
vote
2answers
177 views

Concatenating fields with label expressions using Python

I am trying to combine three numeric fields together for a feature's label. I only want to label the feature if it is over 0. The labeled numbers need to be separated a dash ("-"). This is what I ...
1
vote
2answers
216 views

Edit Field Value of Feature Class Using Python in ArcGIS 10.2

I have a feature class whose attribute table looks like this: Latitude | Longitude | Area For the area column, all rows are null. I would like to put in a specific value for all rows using Python. ...
1
vote
1answer
733 views

Writing conditional (if/then) statements into Field Calculator of ArcGIS for Desktop using Python parser?

I have gotten stuck on another seemingly simple arcgis field calculator python expression. I obtained a great answer to a another similar question a few years ago: Python Field Calculator ArcGIS 10 ...
1
vote
3answers
756 views

Python: How to create a Polygon Shapefile from a list of X,Y coordinates?

I have a list of X,Y coordinates from a csv file, that represent a polygon. I´m trying to create a Polygon-Shapefile from this list. I´ve been trying around and found a possbility to write the list to ...
1
vote
4answers
830 views

How do you create a point at the midpoint of a polyline with Python?

I have a polyline shapfile (that contains multiple lines) and am trying to create a point at the midpoint of each line using python. I am currently using the ET Geowizards tool 'PolylineToPoints' ...
1
vote
3answers
592 views

Simple WMS server

Is there a way to implement a WMS server using only php or python cgi and mysql? I can't use geoserver or mapserver and postgres and any other software as they are not provided by the administrator.
1
vote
2answers
11k views

Export list of values into csv or txt file

I would like to know how to export in Arcgis a list of values calculated in python script into one of the following data formats: csv, txt, xls, dbase or other. I would also like to know how to create ...
1
vote
1answer
985 views

How to evaluate raster calculator expressions from the console?

How can I execute from the console an expression that should be used with the raster calculator? I'm searching for something like this: qgis.someRasterCalcClass.evaluate("boh@1 + boh@2", ...
1
vote
2answers
298 views

Where to find PySAL toolbox for ArcGIS?

I installed PySAL but i can't find the toolbox for ArcGIS.
1
vote
1answer
356 views

Does arcpy have an issue with directory names starting with a number?

I have a script to export DDP extents to tif and when I change arcpy.mapping.ExportToTIFF(mxd,"tests\BA\BA10k_" + str(ddp.pageRow.PageName) + ".tif",df,9306,9306*ar,1800,True) to ...
1
vote
2answers
890 views

Help with a Simple Code to Read a Metadata from a Raster File

Please help me with a python code to read metadata from a Raster file. Thanks
1
vote
2answers
915 views

Running ArcGIS 10 Python script on a unix server - is it possible?

I've written some python scrips that use the ArcPy module to do some pretty intensive processing. I'd like to be able to run these on the fast unix server we have in our department so that I don't ...
1
vote
1answer
592 views

How to create a pop-up box if a condition is true in a table? (ArcMap 10)

I'm creating a script that will grab layout data from a table for the current Building Number of the current building my map series is on. It works fine, but I need it to pop up a window if multiple ...
1
vote
2answers
127 views

How to create a series of points along multiple polylines at once in ArcMap 10

I have a series of polylines that represent linear vegetation (shelterbelts, etc). I need to convert these to a series of points equally spaced in order to add them to a different shapefile that ...
1
vote
4answers
166 views

Arcpy: what tools are most suited for this job?

I'll try to be as much detailed as possible but please let me know if anything is missing: I'm trying to get the number of lines in layerA that intersect with each line in LayerB and stores that ...
1
vote
2answers
74 views

How to label only house number in python? [duplicate]

I have parcel data that has the site address field as ex. 123 First Avenue. I only want to label the house numbers on the map, so 123 in the example. How can I do this using the label expression in ...
1
vote
1answer
49 views

Overwrite option on a standalone ZonalStatisticsAsTable using ArcPy

How can I code an "overwrite option" on a standalone ZonalStatisticsAsTable using ArcPy? I don't see any overwrite option from a Esri example. # Execute ZonalStatisticsAsTable outZSaT = ...
1
vote
1answer
308 views

How to Properly Loop Through a List With a Cursor?

My team is working on a python script that does various updating tasks to our streets file. A part we are getting stuck on is trying to update a field. Currently we have a field FEDROUTE that is ...
1
vote
2answers
92 views

Suggest an algorithm to measure how a node is connected to road network

I try to measure how well a node is connected to the rest of the network. If a city has a distant suburb connected with one sole road, it's connectedness is, say 1. If it's connected by 2 roads, it's ...
1
vote
2answers
416 views

How to add shapefile as layer to map using Python and ArcPy?

I am working on an application and I am a beginner in Python :( I want to add a shapefile, the execution is successful and everything but no result appears on ArcMap, here is the code I use: import ...
1
vote
2answers
198 views

Extract a record by name in pyshp?

I would like to extract a named subset of the text records from a shapefile using Python/pyshp. Is there a clean/efficient way to do this? Ideally I'd like to use dictionary-like access such as: ...
1
vote
2answers
226 views

How do I execute a script in the arcpy window?

I've been writing python in my text editor so I have a python script, script.py. I'm still developing it so don't want to put it in my toolbox yet, and at the moment this means copying and pasting it ...
1
vote
2answers
515 views

Conditional Labeling based on attributes in ArcGIS 10

I am trying to label a street centerline layer with a condition based on street width. I am using the Python parser and I can't figure out this simple logic. Neither of these questions address how ...
1
vote
2answers
2k views

How to set workspace as Python script tool variable/parameter?

I'm pretty new to Python. I'm trying to write a script and as I want to automate it as much as possible, I'm wondering is it possible to set the workspace as a variable so that when it's run as a ...
1
vote
2answers
805 views

python - Calculate field with part of file name

So I previously successfully used the sample code here: Model Builder - How to calculate Field using part of filename # Import standard library modules import arcpy, os, sys from arcpy import env # ...
1
vote
2answers
198 views

What is the best quick way to populate a field (in ArcGIS 10)? (for rare language/font e.g. Guzrati numerals)

I have polygons generated from shapefile (esri) format I have a tiff image of plot/parcel map(this tiff has plot id scribed in somewhat consecutive in manner) of that polygon feature. I would ...
1
vote
2answers
235 views

Python syntax error…cannot see the error!

I'm very new to python and have created a script for enabling a user to list file types in a workspace making use of the parameters function in ArcGIS so it's more user friendly. However I cannot get ...
1
vote
2answers
1k views

Problem loading vector layer (pyQGIS)

I've installed the qgis on ubuntu 12.04 following the instructions on http://hub.qgis.org/projects/quantum-gis/wiki/Download. I am trying to test the Python API and try to do the follwoing from ...
1
vote
2answers
2k views

How can I save raster dataset using arcpy

I'm trying to save filled raster object to geo database by my specified filename. import arcpy from arcpy import env from arcpy.sa import * env.workspace = r"C:\GIS ...
1
vote
2answers
445 views

How to translate (reposition) a raster in Python?

I tried to use QGIS GeoReferencer to translate a raster layer, but somehow failed. It just goes to somewhere unexpected. Now I decide to do it myself, with python. I think some libraries like GDAL ...
1
vote
3answers
871 views

an arcgisscripting method for sanitizing a filename?

Is there an arcgisscripting method for sanitizing a filename to get rid of characters which Arcgis barfs on, the meek hyphen - for example?
1
vote
2answers
61 views

Using Python For a Field Calc

In AcrMap 10.2 I'm trying to add a field and run this script in Field Calc: !shape.isMultipart! to see if I have any multipart lines. I keep getting geoprocessing failures. I am clicking the ...
1
vote
2answers
125 views

Field Calcuator to add percent using Python

What might I go wrong here is that I am trying to add percent. I use the Field Calcualtor and it keeps getting an error. I am opening the Table to add a field named Percent and then type this: ...
1
vote
1answer
168 views

Simple field calculator equation in ArcGIS 10.2.1 not working with python parser

I am trying to calculate a percentage in a field in a table. customers and total_customers are short integer fields. arcpy.AddField_management(tableSepSel2, "percent", "DOUBLE") ...
1
vote
1answer
217 views

Secure credentials for scheduled python script targeting ArcSDE 10.1 on AWS

I have a python script that will be used as a scheduled task. Our dba team is wanting the credentials to be as secure as possible. I would say that using the os security system as far as locking ...
1
vote
2answers
469 views

Import CSV column into existing feature using arcpy

My goal is to take a CSV that contains 50 rows and one column and import the data into a feature class with over 3,000 rows using arcpy. I want to pick a random row from the CSV and then iterate ...
1
vote
2answers
280 views

Why my python script of r.watershed has no output?

I type those code in pyscripter, import os import sys #set up GRASS environment variables sys.path.append(os.path.join(os.environ['GISBASE'], 'etc', 'python')) import grass.script as g import ...
1
vote
2answers
820 views

Create an X,Y latitude and longitude grid from an raster

I have a satellite image (LandSat 5), I want create a raster with X,Y coordinates, this is possible in Model Builder of ArcGis 10.0? or other option. I know that the option $$YMAP ($$XMAP) not work ...
1
vote
3answers
496 views

Problem with python script to control GRASS GIS from outside - How to import grass.script under Win 8.1?

I am working with GRASS 6.4.3 and python 2.7.6 under WIN 8.1. I am a novice with computer science and coding, and I have seen many posts including those:Is it possible to use GRASS GIS in Python ...
1
vote
2answers
158 views

How to get an indication of how points are spatially distributed?

Let's say I have a set of points and I want to get an indication of their spatial distribution. That is, if all points are at one location a possible return value would be 0, whereas if all points are ...
1
vote
1answer
216 views

ArcGIS arcpy reprojecting raster issue

I have a raster which I want to reproject from GCS_WGS_1984 to GCS_NorthAmerican_1983. I am using the following code: try: spatial_ref = ...
1
vote
2answers
667 views

Creating a new feature class with python and then adding attibutes

I am having trouble adding rows to a shapefile after it has been created. I'm not sure if I need to create the shapefile in memory and add the data or creating then re-open the file. While I've ...
1
vote
1answer
93 views

turn a Result object into a number

**import arcpy from arcpy import env from arcpy.sa import * import math # Check out any necessary licenses arcpy.CheckOutExtension("spatial") # OverwriteOutput arcpy.env.overwriteOutput = True ...
1
vote
2answers
470 views

How to remove z & m coordinates from shapes with QGIS? (Or arcgis, grass, gdal, Python…)

I've recently received some parcel data in shapefile format that has z & m coordinates (all = 0.0). The WKT for a typical parcel looks like this: "MULTIPOLYGON (((2672464.560700002 ...
1
vote
1answer
577 views

How to access row from dbf table?

I have got the following problem: I would like to access a row from a dbf table. I have tried to access it through SearchCursor, but I am not able to do it without knowing the field name. This is my ...
1
vote
2answers
934 views

Importing ArcPy taking many seconds and code is really slow for GeoProcessing Tools 64-bit (ArcGIS 10.1 SP1)

I've installed ArcGIS10.1 SP1 and whenever I import arcpy (on Pywin console or Eclipse PyDev) it takes aprox. 15-20seconds. Is this normal? I don't think so... I had Python 2.7.3 64-bit previously ...