Version 2.7 of the Python programming language

learn more… | top users | synonyms (1)

2
votes
2answers
40 views

Reading next row of *.txt column inside ArcPy for loop for batch process?

I'm not sure how to approach this problem with python, but in plain english, I'd like to rename rasters with the names given in the *.txt file (see screenshot) and concatenate the basename given by ...
0
votes
1answer
22 views

Valid input for ArcPy raster to polygon in 10.1?

I'm experiencing some strange problems with this code starting from files with *.tif.tif to what seems should be *.tif.tif.shp according to the code. The code is not working because of the ...
0
votes
1answer
19 views

Debugging AttributeError: 'Result' object has no attribute 'save' from ArcPy script?

I Keep getting this error message when i run the code below, can anyone tell me why? Error message: Traceback (most recent call last): File ...
1
vote
1answer
34 views

NAD83 2011 AZ central projection

I am having trouble getting GDAL to read a file geodatabase with data projected in NAD83(2011) State Plane Arizona Central FIPS 0202. I have developed the following code: # standard imports import ...
0
votes
0answers
30 views

Error 010092 for FeatureToRaster in Pythonwin

would someone be able to help me with this problem. As shown the process works for three files (of approx 1000) and then throw the Error 010092: Invalid Output Extent. All the files have been ...
0
votes
0answers
23 views

icu4c + Mapnik - I want to switch icu4c from 55.1 to 54.1 to get Mapnik to work

What is the best way to downgrade icu4c from 55.1 to 54.1 on Mac OS X Mavericks. I tried brew switch icu4c 54.1 and failed. Reason to switch back to 54.1 I am trying to setup and use Mapnik. I was ...
1
vote
1answer
74 views

QGIS Wien 2.8.1 RuntimeError concerning the sip module on Win 7

I am running windows 7 64bit and python 2.7.9 I just installed QGIS Wien 2.8.1 and it crashes on start up with the following code: Couldn't load PyQGIS. Python support will be disabled. Traceback ...
-1
votes
1answer
56 views

Python code for calculation between fields in shapefile?

How do I calculate sum of selected multiple field in shapefile by using python. here i want to do sum of selected fields row by row. for that i want to use equation , which is: W= sum(selected fields ...
0
votes
1answer
35 views

How to setup GDAL setting for python using OSGEO4W?

I have installed OSGEO4W installer. In that I have installed Express Desktop install option. QGIS GDAL uDig and GRASS GIS were installed in C:/OSGEO4W64. I have added 'C:/OSGEO4W64/bin' in the path. ...
1
vote
1answer
16 views

How to make a loop for select by attribute?

I am trying to pull out a sample out of a geodatabase file. I have 100800 sample and I need to select 28 records, basically every 3600, I am going to start with FID=0 and go from there. Unfortunately ...
1
vote
1answer
31 views

How do I get items from OrderedDict to parse addresses

My task is to take a full address and parse them out. I found a module called usaddress ( https://pypi.python.org/pypi/usaddress ) that will take '12345 Old Hillbilly LN Lot 7 Oklahoma City, OK ...
2
votes
1answer
66 views

How can I use updateParameters to handle both points AND polyline feature layers?

I'm using ArcMap 10.2.1 and Python 2.7.5. I would like my updateParameters to enable and disable fields based on if a feature is a point or a polygon. If the point is selected then I need the ...
1
vote
1answer
74 views

GeoDjango Setup: Python 'GDALAllRegister' Attribute Error

I am trying to setup Geodjango 1.8 in a virtualenv with Python 2.7.9 (Win32). I have installed and setup Postgres/PostGis and have my Path setup to my OSGeo4W directory. I have also installed the ...
0
votes
1answer
34 views

ArcGIS saving blank file while using ArcPy to join shapefile and Excel table?

I'm working on a project that utilizes ArcPy to join a shapefile and a excel file. This join takes information from the excel file and creates a map that highlights certain areas different shades of a ...
3
votes
1answer
74 views

Arcpy.da.UpdateCursor, Error - Sequence size must match size of row

I am trying to use an UpdateCursor fill in a field but I keep getting an error, can anyone tell me what I am doing wrong? My code is below: import arcpy fc= "C:\Users\Keri\Desktop\GEP_690\Project ...
2
votes
1answer
67 views

DBSCAN gives “AttributeError: NoneType has no attribute issparse”

I am running a Python script invoking the DBSCAN tool to cluster feature points. When I open ArcMap, load the feature layer, and run the script, it works the way I expect it to. But if I run it ...
1
vote
1answer
22 views

Saving each file in for loop gives ERROR 000872?

I am beginner to Python programming. I know, I am asking a really silly question. I am trying to extract DEM for each watershed from a bigger DEM. Therefore, I am using extract by mask. The bigger DEM ...
2
votes
2answers
97 views

How to check active users of ArcGIS 10.2 Floating License with python 2.7?

I want to find the users who are using ArcGIS 10.2 license with python script. Also, what kind of license they are using. Is it possible to get the number of users which are connected to ArcGIS server ...
1
vote
0answers
86 views

Buffer Csv gets repeated when more than one feature is selected in mapcanvas in PYQGIS

I have a function which will allow the user to select a feature or more features in map canvas and performs buffer for the selected feature(s) and writes the output to a csv file. I dont have any ...
2
votes
3answers
68 views

GetRasterBand() method for gdal in Python

I was going through a tutorial book called Python Geospatial Development. On the chapter on using working with geospatial data in python there is an example of a script meant to handle and analysis ...
1
vote
0answers
35 views

Reading/writing utf-8 encoded data using Fiona?

So I have a 'cpg' file with my 'in_file' shapefile data (definitely set to 'utf-8'). I was using 'meta' to create the same schema/crs as 'in_file'...though it runs, my text fields are borked on ...
1
vote
1answer
23 views

Clipping a Raster into 5x5(25) equal tiles through the use of arcpy?

I am curious to find our if there is a way to create a python code that enables you to clip a raster into equal parts example: 5x5(25) tiles with the use of arcpy? From what I can think of you would ...
1
vote
1answer
47 views

No expected output when accessing variable from one function and using in another fucntion

I have a function say selectedfeatures this function would be called when a selection changed event happens in mapcanvas. self.canvas.selectionChanged.connect(self.selectedfeatures) ...
2
votes
2answers
42 views

Updating the Z value within an XYZ.txt file

Following a post from a few weeks ago: Creating polygon from 2 txt files (Parent ID + Coordinates) and thanks to the help and code, the script works very well. Now I need to reverse the process in ...
1
vote
0answers
26 views

Trying to install PyGreSQL, receiving DLL load failed error

I am trying to install the PyGreSQL package into Python 2.7. I am running 32-bit Python on a 64-bit Windows 7 machine. The installer I am using is the file PyGreSQL-4.1.1.win32-py2.7.exe from here. ...
3
votes
1answer
50 views

how to copy layer and add to same mxd and rename layer using ArcPy and ArcMap 10.2?

I am trying to copy a layer in an mxd and add that layer to the bottom of the TOC using Python, but I have not found a way to save the mxd programatically without making a copy. I also haven't found ...
2
votes
1answer
83 views

Is it possible to find the feature class name from a python label expression in ArcGIS?

Does anyone know how to find the path to a feature class within a label expression using ArcGIS? I don’t need to simply display the path. My overall goal is to create a python function to display ...
1
vote
2answers
106 views

Errors using arcpy.CalculateField_management

EDIT: What I forgot to mention when I first had this question is that I was trying to do these calculations on a layer which had joins, BUT where the join was on data that was added from an Excel ...
1
vote
2answers
54 views

Automation of changing symbology for a given layer

I have a shape file that is a 10-by-10 grid of squares. The shape file has 50 attribute columns (named p_1 through p_50) where each column has 100 entries (corresponding to the 100 grid squares) and ...
0
votes
0answers
49 views

Creating Convex hull and finding buffer in QGIS

I have a layer and features are selected using Select Features by freehand tool and for that selected features, convex hull was done and for that convex hull i am trying to find buffer and write it in ...
0
votes
2answers
47 views

Shapely (geos) crashes during unary_union

When attempting to union multiple polygons with Shapely 1.5.6 in Python 2.7.9, using GEOS 3.4.2, I get the following error in the underlying C++ code: Assertion failed: (!"should never be reached"), ...
2
votes
2answers
87 views

Using lists in Python functions [closed]

I have some code in a function that uses a list, which works, but is there a way to write a list outside of the function and use it within the function code? For example in my code below I have a ...
1
vote
0answers
26 views

What is the correct way to write the code for getting layers from the server?

I'm writing a script to call raster from the server to load them to my MXD file. It is just like when you add the data in Arcmap. Problem is that the raster I have is on the server. Is this correct ...
1
vote
1answer
28 views

if condition is false but output is true . what is the exact expression of greater than to bands value ('mjune@1'> 99.6:)

from qgis.core import * from qgis.gui import * from qgis.analysis import QgsRasterCalculator, QgsRasterCalculatorEntry from math import * from PyQt4.QtCore import QFileInfo import os from osgeo ...
0
votes
1answer
26 views

How to join two plugins in QGIS?

I have created two different plugins in QGIS using python. I would like to combine both in one plugin. How can I do that?
1
vote
1answer
67 views

How to sum 10 raster bands instead of 9 from code?

I want to sum 10 raster bands but the problem is that the following code will only work for summing 9 bands, which means the output image consists of 9 bands. from qgis.core import * from qgis.gui ...
1
vote
2answers
87 views

How to delete a shapefile from a directory using QGIS?

I am using the following code to clip a shape file using processing tools via Python and would like to delete the clipped file from the directory. Here is my code. from PyQt4.QtCore import * from ...
1
vote
0answers
82 views

How to auto-increment attribute fields using cursors and conditional statements?

I am trying to create unique IDs for an attribute named "FACILITYID" (str) and have got a ton of help from related posts and online python tutorials. I selected the rows I wished to create unique ID's ...
2
votes
1answer
271 views

Converting values in datetime field to strings in text field using Python parser of ArcGIS for Desktop?

In the attribute table of my file geodatabase feature class I have a populated field called DateField of type date, and a text field called TextField. I have not yet hit on a way to convert the ...
2
votes
1answer
69 views

Error message trying to merge Shapefiles in Python

I try to merge all Shapefiles from one folder together into one, using this: shapeList = arcpy.ListFeatureClasses() print shapeList for fc in shapeList: if fc == "*domain*": ...
0
votes
0answers
35 views

True Altitude of GPS cooridnates

Given two points a=(lat1, long1) , b=(lat2, long2). I want to divide the line between a and b into points with equidistant length. (for example 100 Points) For each of these points i need to ...
2
votes
2answers
273 views

How to count point shp inside polygon shp using Python?

This is my first time here, so I'll try to be as specific as I can. What I'm trying to do is found out which polygon contains the most points and write the result in a text file. Here is my script : ...
2
votes
0answers
172 views

How to load GeoJSON into PostgreSQL database using Python?

What I have tried to do is (In Python IDLE): import psycopg2 import json try: conn = psycopg2.connect("dbname='carto' user='postgres' host= localhost password='password'") except: print "I am ...
1
vote
3answers
122 views

Programmatically adding .shp file to .mxd file

I have spent hours attempting to find the solution to the following problem online, but all answers I have found are quite old, and none work. Here is the situation: I have a variety of .shp files. I ...
1
vote
0answers
47 views

“addItem” in Portal for ArcGIS

I'm trying to upload a .pdf file in the content of my Portal for ArcGIS with a python script. I'm trying with the "additem" REST operation. My code is as follows: import urllib import urllib2 import ...
-1
votes
1answer
46 views

Writing code to create MapDocument object gives ValueError: MapDocObject: Unexpected error? [closed]

I am trying to write the code but it gave me the error within the Python window: >>> mxd = arcpy.mapping.MapDocument("CURRENT") path = "C:\Student\MapScripting10_0" ...
1
vote
0answers
36 views

Difficulty with python package mgrs by Howard Butler

I am developing an app in python and I am trying to import Howard Butler's mgrs package. I am using setuptools to install the package. It does not find the setuptools library module. I have tried ...
2
votes
0answers
50 views

Error ET Geowizard Clean Polygon() takes no arguments (3 given)

I want to clean polygon feature classes with ET Geowizards (clean polygon) because I cannot find any tool within ArcMap (ArcInfo) that does the same. I have really small gaps within the polygons (but ...
1
vote
2answers
151 views

Permanently add a python toolbox to ArcToolbox

I've written a python toolbox for my company containing several scripts to speed up various repetitive tasks. Each time we want to use it we have to open ArcToolbox, right click and select "Add ...
0
votes
0answers
23 views

How to use random number generator to select by attributes in ArcMap? [duplicate]

I am not familiar in using Python and random number generator. I was wondering how to select 250 rows/values from a column named "JUROL". Every value in that column is different and the column ...