Version 2.7 of the Python programming language

learn more… | top users | synonyms (1)

0
votes
0answers
9 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 ...
0
votes
0answers
18 views

sorting elements in the list in python [on hold]

suppose the list is like this l = [("Texas","city1"), ("Texas","city2"), ("Texas","city3"), ("Texas","city4"), ("Texas","city5"), ("Georgia","city6"), ("Georgia","city9"), ("Georgia","city10"), ...
0
votes
0answers
9 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 ...
2
votes
1answer
36 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
0answers
32 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
15 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
68 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
44 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
47 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 ...
0
votes
0answers
27 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
21 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
46 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
40 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
21 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
44 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
72 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
84 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
46 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
42 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
34 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
81 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
25 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
25 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
25 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
59 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
1answer
65 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
69 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
181 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
57 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
31 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
221 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
120 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
109 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
39 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
43 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
32 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
41 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
120 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 ...
0
votes
2answers
80 views

Select layer by attribute for entries in a dictionary (python)

I'm kinda new to python (and programming) and having trouble figuring out how to properly specify what I want to do. Basically, my code compares names of well owners and orps owners and saves all ...
1
vote
0answers
34 views

Why when I use the ReadAsArray() Shell restart in this code?

I want to read the .pix file in the 3 different Array in python and I use this program but when I run that nothing do And shell be restart and program closed . from scipy import ndimage import ...
0
votes
1answer
82 views

Distance with Bearing Calculation not working

I have this function in Python that calculate distance from a point with bearing. Problem is the latitude part is generating the wrong answer and i cannot figure out where i went wrong: def ...
1
vote
2answers
102 views

Issue in the popdown box (QComboBox) in QGIS 2.6 Python plugin

I had developed a plugin that counts the number of features for a layer in Qgis2.6. When i load a layer say 'Airport' for first time and click the pop-down box in the plugin,it lists the airport ...
0
votes
1answer
75 views

QGIS 2.6 Crashed for my own plugin

I had developed a plugin that counts the number of features for a layer in QGIS 2.6. I am using Windows 7 os. It works fine when i loaded a layer. But when I remove that added layer and then if I ...
1
vote
1answer
115 views

Attribute Error:'NoneType' object has no attribute 'name'

I am developing a plugin that counts the number of features for a layer in qgis2.6.The plugin works fine when there is a layer but when there is no layer,it throws an error.For reference,a part of the ...
1
vote
1answer
66 views

Multi-part Geometrical Intersection error

I am working with intersection of polygon and line segments (continued from a previous question). When a Line intersects with a Polygon, the result is a LineString; When a LineRing intersects with ...
1
vote
1answer
73 views

Loading Vector Layer using python console in qgis

I am using qgis2.6 version and new to pyQGIS. I tried to load a vector file using python console in qgis. I don't know where I am wrong. The layer was not loaded and does not show any error too. Help ...
0
votes
1answer
67 views

Understanding desc.fields

First time poster so I hope I did this right. I'm relatively new to Python scripting and am trying to understand the error I'm getting. I have the following simple code and what I don't understand is ...
2
votes
1answer
47 views

Object Inspector Button not enabled in python console of qgis

I am using QGIS2.6 version. I loaded an existing py file in a editor. Though I added a codes in the editor, the object inspector button was not enabled. Please help me in figuring out what would be ...
1
vote
1answer
125 views

Python Basemap fails

I am using Anaconda 2.1.0 and Basemap installation is successful conda install basemap However, I keep getting the following error when I try to project lat,lon to a planar: Assertion failed: (0), ...