A version of the Python programming language

learn more… | top users | synonyms (1)

2
votes
1answer
31 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
23 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
134 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
32 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
2answers
63 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
14 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 ...
0
votes
1answer
27 views

Writing a simple code to replaceWorkspace

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
29 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 ...
0
votes
0answers
35 views

gdal and python runtime error

Can't seem to figure what might be causing this error. The first file from the input path was processed while the rest of the files has an error. Any idea? @echo off setlocal enabledelayedexpansion ...
2
votes
0answers
16 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 ...
0
votes
2answers
51 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
50 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
29 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
37 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
votes
0answers
81 views

Error while launching my own plugin in Qgis2.6

I built a plugin using plugin builder in Qgis2.6.The plugin was created successfully and i copied the folder to Qgis plugins folder.Then i made some changes like adding a combo box using QT designer ...
1
vote
2answers
47 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
60 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
55 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
42 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
46 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
50 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
31 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
78 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), ...
1
vote
0answers
35 views

Upgrade Geodatabase crashes python and ArcCatalog

We are currently in the process of upgrading our ArcGIS for Server license (10.0 to 10.2.2) and our SQL Server instance from 2008 (SQL Express) to 2012 (Full blown). We have around 60 databases to ...
2
votes
3answers
98 views

How to change properties of an item in a legend in ArcMap 10.2 using python

For many of my projects I use a single mxd to create multiple maps using a python script to switch on/off various raster layers before exporting to pdf. Before beginning the exporting process I ...
2
votes
1answer
45 views

How do I import an ASCII grid using arcpy?

I'm trying to automate the setup of some flood depth/hazard maps. The user specifies a folder containing depth grids generated by a hydraulic model (.asc format) and some background mapping (geotiff ...
1
vote
1answer
43 views

Cannot find pythonwin on my ArcGIS 10.1?

What is the version for the Python in ArcGIS 10.1 and what is the build ? My laptop does not show having pythonwin in the folder under C:\Python27\ArcGIS10.1\Lib\site-packages\pythonwin. Is there ...
2
votes
2answers
48 views

How to find number of synchronized records in ArcGIS10.2.2 (Data Management)

I want to find number of records synchronized while using arcpy.SynchronizeChanges_management tool. Right now, I'm getting only messages like process is Executing, Synchronize successfully ...
2
votes
0answers
35 views

how to extend polyline to the intersection point?

I have a polyline shape file, would like to extend the polyline to the intersection point of the nearby polyline and snap using python in Qgis. Thanks
1
vote
1answer
74 views

Python IDEs (PyScripter,PythonWin) crashing when installed with ArcGIS for Desktop?

I am learning Python, so here is a real newbie question! Everything writen in ArcGis Python's windows is working fine. The same lines, correctly writen in an IDE, when run, are crashing it. Working ...
2
votes
1answer
47 views

How to calculate area using QgsDistanceArea?

I am trying the following code as given in the QGIS documentation: d = QgsDistanceArea() d.setProjectionsEnabled(True) print "distance in meters: ", d.measureLine(QgsPoint(10,10),QgsPoint(11,11)) ...
3
votes
1answer
87 views

How to use QGIS field calculator in python?

I would like to use QGIS Field Calculator in Python to update the existing column based on certain conditions? How can I do this?
1
vote
1answer
26 views

Which parameter and Data Type to set for spatial reference in ArcGIS Python script tool?

I developed a python script for user defined grid and I want to make a tool from this script. The problem I am facing is to set up parameter for spatial reference. I used GetParameterAsText ...
1
vote
1answer
36 views

Slanted raster along the line? Wind erosion model and windbreak effectivity

I'm working on wind erosion modelling and windbreak potential. Imagine windbreak, which has some values of optical porosity (in %) and this values determinates the effectivity of windbreak in specific ...
1
vote
1answer
20 views

Using ModelBuilder to replicate series of tasks without deleting output features first?

I am calling a number of files that I want to clip etc in ModelBuilder which clips data and sends it to a specific feature class. I want to re-run that same process for which I have converted the ...
2
votes
0answers
34 views

How do you find out where there are missing tiles on a basemap on ArcGIS Server?

I have a basemap service on ArcGIS Server 10.1 where after doing a cache update (exploded cache), some of the tiles are missing. I have added a "missing tiles.png" so that it shows where the missing ...
2
votes
1answer
106 views

How to add vertex to an existing polyline programatically?

I have a Polyline and would like to add new vertex to before start point or end point or at any part of the polyline using python in qgis. How can i do that?
0
votes
1answer
37 views

How to set attribute to selected field?

I am trying to create a temporary point layer in memory using the following python code. # create layer vl = QgsVectorLayer("Point", "temporary_points", "memory") pr = vl.dataProvider() # add fields ...
2
votes
0answers
105 views

Calculate area in square meters from degrees?

I have a polygon shape file in geographic coordinate system, i would like to calculate area in square meters in QGIS using python. Is there any formula or equation to do this? Thanks
0
votes
0answers
38 views

Create Polygon from coordinates? [duplicate]

I have coordinates in string format like POLYGON ((7.4986406 6.431006900000041,7.498971 6.43207,7.499096 6.432481,7.499398 6.43182,7.499522 6.431524,7.499529199999982 6.431510499999964,7.499529 ...
1
vote
3answers
166 views

latitude and longitude coordinates into postal code with town names

Here is my problem. I have a csv file, with latitude and longitude coordinates. I would need to know the name of the French towns and the relevant postal codes that match these coordinates. My ...
3
votes
1answer
79 views

Merging multiple 16-bit image bands to create a True Color Tiff

I'm trying to merge three Tiff band images in python, red, green and blue into a True color image. PIL does not support the file depth as they are 16-bit files with 11-bit values. I have seen it ...
0
votes
0answers
56 views

Python script suddenly freezes and start to consume memory

I have a Python 2.7 script that generates multiple polygons around certain polygon (see picture). The meaning is determinate the effectivity of windbreaks. I don't know if my solution for this problem ...
2
votes
0answers
43 views

how to open second window in my plugin for QGIS?

I create a Mainwindow for my plugin, but if I want to open a second window from this Mainwindow, with click on push button. How can I do? I tried the following function in my Main Class: dialog = ...
1
vote
0answers
40 views

set extent for jpeg programmatically

I feel like this should be easy, but how can I set coordinates for a jpeg image using Python? I have a python add-in that draws a polygon and then uses its geometry to post a query request to a REST ...
1
vote
1answer
106 views

Use PyQGIS to import CSV and draw points using different color

A CSV file contains columns latitude, longitude and color. uri = "file:///C:/data/balls.csv?type=csv&xField=longitude&yField=latitude&spatialIndex=no&subsetIndex=no&watchFile=no" ...
2
votes
0answers
34 views

A list of layer names that you want to be turned off when Layers name are in Right to Left Such as persian

When I ran this code I got "UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal" error I don't know why I tried many way but I ...
0
votes
1answer
73 views

gdalnumeric in python virtualenv

I'm having a problem importing gdalnumeric when working on virtualenvs. I'm getting the following error: from osgeo import gdalnumeric Traceback (most recent call last): File "<stdin>", line 1, ...
0
votes
1answer
111 views

Copying XY to clipboard using Python Add-In (ArcMap)

I am trying to create a simple tool to copy XY from where i click the mouse button. What i have done already is: create add-in files using Python Add-In Wizard create toolbar and tool inside it in ...