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

learn more… | top users | synonyms

0
votes
1answer
51 views

Improving performance of Clip using OGR?

I have a set of points which I am trying to clip to a set of polygons. The files have many features (150,000 polys, 8,000 points). I'd like to automate this process carry it out once a day, hence I am ...
1
vote
0answers
129 views

Boundless OpenGeo Explorer fails with Python errors

I am running this stack on a Windows 2012 R2 Datacenter. PostgreSQL 9.3.10 PostGIS 2.2.0 PGAdmin III 1.18.1 Geoserver 2.7.3 QGIS 2.12.0 Boundless OpenGeo Explorer 0.6.2 Everything runs ...
0
votes
0answers
15 views

ArcGIS AddIn to load qgis symbology

I'm looking to make an add-in for Arc so that I can load symbology created in QGIS. I'm familiar with Arc and the way symbology works in it, but I'm unsure what the best way to tackle QGIS symbology ...
1
vote
0answers
17 views

qgis python map canvas saveimageas save wrong image

I've been trying to write a small python script to output 2 tif's based on given box extents. The script all works, box coordinates convert to project coordinates, zooms to right place (would like ...
6
votes
2answers
415 views

How can I turn a python list into a table?

I am trying to create a table of coded values so each textual description has a numerical attribute. The order of numbers is not important - they just need to be unique. What I have so far is a ...
3
votes
0answers
85 views

Dissolving polygons in a large dataset

I need to dissolve polygons by the ID attribute in a large dataset (+-1gb shapefile). I have been struggling to find an efficient method to do this. I have tried the following methods: Postgis ...
0
votes
0answers
38 views

Using gdal in ironpython

I would like to replicate the following two statements GDAL python has: # project the decimal degrees to Mercator: gdalwarp -s_srs EPSG:4326 -t_srs EPSG:32631 -r cubic original.asc ...
0
votes
0answers
68 views

Cannot read TIFF files produced by ArcGIS in Python

I'm trying to use (1) PyLibTiff package maintained by Pearu Peterson & Joe Jordan and (2) module tifffile.py developed by Christoph Gohlke to read and write TIFF files in Python. I know GDAL can ...
1
vote
0answers
53 views

python - find lat lon in geotiff [closed]

I'm a python newbie. I have a Geotiff file. I need to find coordinates in the Geotiff to find the position of a thermometer within the geotiff (the thermometer has the coordinates ...
1
vote
2answers
72 views

What is the life cycle of arcpy script in arcgis?

In the code below just before the arcpy.AddMessage("Finished!") statement I have used a selection Query. The problem is that the newly created shape file Testing1 in which am firing the query is ...
1
vote
0answers
34 views

Extract raster values to multipoint shapefile and write to new field using gdal/python [duplicate]

I have a raster with one band and I would like to query a set of overlying points (.shp) to determine how many points as well as which points points fall under a range of certain pixel values ...
1
vote
2answers
72 views

Error with my python script

I am trying to write a string that will call for a error log. Here is the error I am getting: Python Exception <IOError>: [Errno 22] invalid mode ('r') or filename: ...
0
votes
0answers
23 views

import qgis works in Qgis desktop but does not work in Python [duplicate]

if i write in python 3.5 or 2.7 import qgis ImportError: No module named 'qgis' if i write the same in Qgis desktop scripting - i get no error. Did search the forum didnt find any answers, btw: ...
0
votes
0answers
94 views

CSV to Polygon.SHP with Python

I'm looking for a way to convert CSV file to polygons shapefile. I need to make polygons with defined size. In the CSV file, The first row is the length of each polygon and the first column is the ...
0
votes
1answer
113 views

Setting CopyFeatures_management output to newly created folder in Python script?

How do I set the output of the copyfeatures_management so that the shapefiles go into the new folder I created? Currently, they are being placed in my set workspace at the beginning of my code. ...
1
vote
0answers
42 views

Activate tracking for ArcGIS Online with python

It is possible to update data in ArcGIS Online by python-script: http://blogs.esri.com/esri/arcgis/2014/01/24/updating-your-hosted-feature-service-for-10-2/ Configuration is done by changing the ...
0
votes
1answer
62 views

'Result' object has no attribute 'GetMessage', ArcGIS Example

i'm using the following ArcGIS example to calculate the surface and volume of a raster. I added the script to my toolbox: ...
1
vote
1answer
43 views

Making lookup table for performing Lookup(inRaster, lookupField)?

I want to replace the Digital number (DN) values in a raster file with some other values which are present in a text file;in the text file, I have a table which it's first column are all possible DN ...
0
votes
0answers
34 views

How to create a geospatial PDF using GDAL (in python)? [duplicate]

Can anyone suggest a way to create a geospatial PDF instead of geoTiff using GDAL in python? Aside, I also tried creating first a geoTiff and then used the 'gdal_transform' command to try and create ...
5
votes
1answer
74 views

Weighted zonal statistics in Python and/or R

I have raster files with precipitation data (4x4 km), monthly, for about 100 years. I have a shapefile for a watershed (which includes several polygons as sub-basins). I need the average precipitation ...
1
vote
1answer
63 views

Spatial join multiple attributes from smaller polygons to the bigger one

I'm trying to join (to the rectangle) values from multiple polygons intersecting for this rectangle. I've tried to use some Reference functions in Field Calculator like geomintersects() but it joins ...
1
vote
2answers
38 views

How to set independent path in QgsOverlayAnalyzer >> intersection statement using Python?

How to set independent path in QgsOverlayAnalyzer >> intersection statement using Python? QgsOverlayAnalyzer.intersection(QgsVectorLayer, QgsVectorLayer, QString, bool onlySelectedFeatures=False, ...
1
vote
1answer
48 views

Reclassify raster pixels underlying certain polygons using Python

I've got a shapefile with many polygons, each of which exactly overlays a contiguous region of raster cells; an example in yellow: For some of these, I want to use the polygon as a sort of analysis ...
0
votes
0answers
16 views

How to ApplySymbologyFromLayer but autogenerate unique color?

I am trying to write a script that will allow me to change all the layers within a selected group layer to a particular symbology. For example, we often want to change our point data to all display ...
2
votes
1answer
203 views

Calculate area of polygons using OGR in python script

I have a shapefile of many thousands of polygons. I'm trying to append an area field to the attribute table and calculate the area of each polygon (in sq. meters) driver = ogr.GetDriverByName("ESRI ...
0
votes
1answer
91 views

Using python and ArcPy to read multiple files, apply a function and write into new a directry

I haven't used python yet; I want to read multiple GeoTiff files and resample them based on another single file, and be able to write all the files in a new directory. I can use R raster package to ...
0
votes
1answer
93 views

Why do pyproj and matplotlib basemap produce different results when they convert my lat-long data into a CRS?

pyproj and matplotlib basemap seem to produce differing x-y values when they convert my lat-long data into the same CRS (such as Albers Equal Area). These x-y values tend to be off by hundreds of ...
1
vote
1answer
44 views

How to use the replace string function with a path with special characters? [closed]

I am trying to replace a string path in a shape by replace function. I have this string: C:\Users\me\Desktop\p1.jpg and I want to replace only thisC:\Users\Desktop\me\Desktop for ...
1
vote
0answers
20 views

Render single band gray raster define gradient and cumulative cut

I want to save an image with these characteristics: gradient: white to black std deviation = 5 Until now I get to apply the gradient but the minimum and maximum values are used instead of ...
2
votes
2answers
86 views

gdal/python: extracting projection info from hdf file

I'm trying to do something fairly simple. Take two subdatasets from an hdf file, read them as an array, do some math and write the new array back to a geotiff, using the same projection as the input ...
1
vote
0answers
30 views

Why doesn't the Undo/Redo History Widget run my custom undo/redo methods?

We're writing a Python plugin for QGIS 2.8.3. I've derived a class from QUndoCommand to contain "undo-able" work. When I push it onto the undo stack, its redo method gets called as expected, but QGIS ...
4
votes
1answer
203 views

Calculate line lengths with Python in QGIS

I found this article which describes the "QGIS GUI way" for calculating the line lengths. http://www.qgistutorials.com/en/docs/calculating_line_lengths.html How can I calculate the length of one line ...
1
vote
1answer
63 views

arcpy and ArcGIS Pro: update Z values of a pointMZ geometry

I am trying to "reverse" the values of Z in a pointMZ geometry with arcpy.da.UpdateCursor. Anyway, I am not able to find a way to achieve this, although my script seems to work (no errors, printing ...
8
votes
3answers
316 views

Performing a Spatial Query in a loop in PyQGIS

What I am trying to do: loop through a point shapefile and select each point that falls into a polygon. The following code is inspired by a spatial query example I found in a book: mitte_path = ...
5
votes
1answer
104 views

How to use qgis:selectbylocation in PyQGIS?

I am trying to use the processing toolbox to perform a spatial query (points in polygon). I am not sure how to use the tool and I keep getting Error: Wrong number of parameters. Here is my script: ...
0
votes
0answers
63 views

“Invalid JSON primitive: geometry” when adding features

I'm trying to use the arcGIS Rest API to add features to a feature layer, but I get an "Invalid JSON primitive: geometry" error. I get the same results if I leave out the spatialReference. The ...
0
votes
1answer
57 views

Add mxd path to csv by Python

I'm trying to write a python script that adds to a csv file the date, time and mxd path. I tried to run the script from the Python IDLE without the mxd path and I succeeded to add the date and the ...
3
votes
1answer
117 views

What is Shapely library alternative in R?

I want to manipulate 2D geospatial geometries in R. I am used to using Shapely in Python but I am a newbie in R. Can you suggest Shapely alternatives for R?
2
votes
1answer
89 views

Loading layer from ComboBox in QGIS?

I made a plugin what has multiple combobox but i have problem with the information load from the second combobox it depends on the combobox 1st. In the first combo box, i can choose layers from the ...
1
vote
2answers
38 views

How to Unselect Features with QGIS tool “selectbyexpression' and the ”>" Operator

First of all I've successfully used the "selectbyexpression" tool to UN-SELECT points by setting its 3rd parameter to "2" in the following script: Input = ...
0
votes
1answer
15 views

Rectifying a Tiff Given One Corner Coordinate

I'm trying to rectify an image that I don't know much about other than the coordinate of the southwest corner, which I was able to pull using ExifTool. Is there any programming solution to ...
1
vote
0answers
24 views

Pass information in external command line software from a python plugin file

it would be quite difficult to explain, I'll do my best.. I'm writing a plugin for QGIS (with the plugin builder, so the folder structure is straightforward). This plugin calls other software (that ...
1
vote
2answers
57 views

Why does openFeatureForm crash QGIS?

I'm working on a Qgis plugin with python, I'm creating a feature and I show a feature form to edit the attributes. But after the openFeatureForm function call the program crash and close line = ...
0
votes
0answers
50 views

Default ArcGIS Python version at Command prompt

My target is being able to access the ArcGIS Default Python installation in the command prompt. I have python 2.7.9 Dec 10 2014 at C:\Program Files\Python27\ArcGIS10.1 I also have python 2.7.4 Apr 6 ...
1
vote
1answer
87 views

Using custom icon markers with Folium?

Given that Folium builds on the Leaflet JS library, I was wondering if it could provide the same functionality as Leaflet for custom icon markers. Scanning through the tutorial here, I'm somewhat ...
1
vote
0answers
40 views

If field is empty in attribute table, programatically populate subsequent field with that data [closed]

I have a CSV communicating directly with a series of points and lines. The CSV is a bit problematic, however. The hardware that provides the data only provides location data every few rows. That is, ...
0
votes
1answer
92 views

How to set parameter dependencies in ArcGIS python toolboxes

I'm trying to build a python-toolbox where the user selects a layer and then specifies a column in that layer. According to the documentation, that is done via the parameterDependencies attribute of ...
0
votes
1answer
45 views

Pyproj transform returning incorrect values (EPSG 3875 to EPSG 4326)

I am trying to convert from EPSG 3875 to EPSG 4326 and have this code: from pyproj import Proj, transform def convert_coordinates(input_format, output_format, x, y): input_format = ...
0
votes
1answer
59 views

Copying content from one Portal for ArcGIS to another using Python?

I am trying to copy content from one portal to another with python only, without using AGO assistant https://ago-assistant.esri.com/, as this doesn't work behind our firewall in our test network. I ...
2
votes
0answers
95 views

Combining custom QWidgets with ui file generated from QGIS plugin builder?

I am having a hard time figuring out how I can include several QWidgets (created in individual scripts) into the QT Designer ui file generated from a QGIS plugin builder. These are custom widgets I ...