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

learn more… | top users | synonyms

3
votes
2answers
74 views

Changing pixel size in 'asc' file using Qgis?

I have soil data and BioClim data from Australia soil data: rows 2200 columns 1400 pixel size 0.0025, -0.0025 255 BioClim data: rows 660 columsn 420 pixel size 0.00833333, -0.00833333 I am ...
2
votes
3answers
65 views

ASCII file with latitude, longitude and data to GeoTiff using Python

I have a .asc file with three columns of data: longitude, latitude and a data value. Each latitude and longitude point represents the location of a centriod of a 1/8 degree unprojected grid. I want ...
2
votes
1answer
77 views

Capturing Output Messages from GRASS when Running Python Scripts

Thanks to the excellent documentation here: https://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly#Python:_GRASS_GIS_7 I've figured out how to access GRASS modules in ...
1
vote
1answer
36 views

fiona ValueError: invalid literal for int() with base 10: 'str'

Why below code does not work- import fiona from fiona.crs import from_epsg my_schema = {'geometry': 'Point', 'properties': {'mean_in': 'str', 'total_h1': 'str', 'total_h2': 'str', 'LOS': 'str', ...
1
vote
0answers
34 views

Geopandas and Zonal Statistic error

I'm trying to use Geopandas and zonal statistic from rasterstats together. I run this code import geopandas as gpd from rasterstats import zonal_stats geodf = gpd.read_file("SHP/shape.shp") ...
1
vote
0answers
24 views

How to access a feature by specific field value using python ogr in an efficient way?

I have one point layer and one polygon layer with a common identifier attribute field called "N", same objects amounts but Feature IDs (FID) are different. I have to iterate on the first one and what ...
1
vote
0answers
44 views

Write stacks of GeoTIFF image to NetCDF by chunk size

I converted GeoTIFF image stacks to NetCDF file with writing data by Index order (layer by layer) (this was a main solution). The problem is, it writes slowly (for 25 images - 1Gb takes 90 seconds). ...
1
vote
1answer
29 views

GRID-file: get max extent for all z-values above given value

I have a GRID-file with a quite large extent. For an automatic workflow I need the maximum extent/bounding-box for all z-values that are over a certain range. For example: Get the maximum extent for ...
1
vote
0answers
24 views

python handling case in address (lowercase,uppercase) [closed]

I'm working on a python QGIS plugin that takes address info from specific parcels and lists it. The data is in various cases and I'm having a hard time figuring out how to handle it. My data looks ...
0
votes
0answers
24 views

Using shapely and geopandas in pyspark

I'm new to geospatial analysis and trying to start the analysis using python. Since the data is too huge we are trying to make use of hadoop and spark to get the analysis done. I would like to use ...
3
votes
1answer
80 views

PyQGIS couldn't import processing with standalone script

I have read post on that problem (How can I access `processing` with Python?). The problem is even with a sys.path.append it couldn't import processing. It's very frustrated. Here the code I used: ...
0
votes
0answers
15 views

Specifying column to use in gdal_translate

I am using gdal_translate to convert a tiff file to ascii. The tiff file is a raster with several columns in the attribute table. How do I specify to gdal_translate, which column to use for creating ...
0
votes
0answers
32 views

How to “INSERT” geotiff raster into postgresql/postgis table using psycopg2

Can someone walk me through how to insert a raster into a prebuilt postgresql table? The table has the postgis extension and I've been able to manually insert a geotiff using raster2pgsql, but I would ...
1
vote
0answers
20 views

Use QgsRasterCalculator inside function

I'm relatively new to PyQGIS and I'm building a plugin to perform some calculations between raster layers. I was seeking to use the QgsRasterCalculator for some operations, however, the function that ...
0
votes
0answers
15 views

Processing toolbox on Google Cloud compute engine

I used to utilize the QGIS python console to do GIS batch operations on my local machine. Computation times are rapidly increasing and I'm switching to a virtual machine solution in the cloud. How ...
2
votes
1answer
53 views

Automatically updating user-edited features in QGIS plugin

I am working on a plugin for QGIS (2.12). It uses data stored in an Spatialite database. When the user creates a new feature, the plugin should: update the feature attribute table (the popup form ...
2
votes
2answers
46 views

How to use a raster dataset to store and retrieve “vectors” using Python?

For a rectangular area of about 10 by 10 km, I have to generate "displacement vectors" with a 1 meter resolution (i.e. a delta-x and delta-y value for every cell of 1 by 1 meter). I will end up with ...
1
vote
1answer
68 views

Problem intersecting shapefiles with OGR in Python

I'm trying to move from ArcPy for geoprocessing. After searching some posts, I found this solution using the GDAL/OGR Python bindings: Intersect Shapefiles using Shapely My code is the following: ...
3
votes
1answer
42 views

Calculate field interactively in ArcGIS ModelBuilder

I'm working on a closest facility analysis using ArcGIS ModelBuilder and want to enable the user to add locations interactively (i.e. typing the coordinates, not using any table or source layer). I ...
1
vote
0answers
14 views

Python error using Vterrain in qgis

Traceback (most recent call last): File "C:/Users/Haimwant/.qgis2/python/plugins\VTerrain\VTerrain.py", line 409, in run os.spawnl(os.P_NOWAIT, directory + "Enviro", ...
1
vote
0answers
28 views

How to transfer SQL variable back into ArcPy script?

I am trying to teach myself to access sql tables from an ArcPy script as part of a larger QC process. I am fairly certain that I have the sql statement correct (it works in SQL Server, albeit ...
2
votes
2answers
105 views

Convert SHP to MIF/MID

I am new to GIS and QGIS software. is there a batch convert function to convert shape files to mif/mid files? I can do this individually but is time consuming? I have seen similar functions on here ...
3
votes
1answer
49 views

What is the real distance between positions?

I'm trying to figure out what gives me the most accurate distance between positions: Measuring distance directly (using Geod.inv)? Measuring distance in 2D (after transforming to a known projected ...
1
vote
1answer
66 views

Unable to delete folder with shutil.rmtree() with ArcPy?

Unable to delete folder with shutil.rmtree() with arcpy: del mxd delete_path_edit = temp_dir_extended delete_path_forward = '/'.join(delete_path_edit.split('\\')) shutil.rmtree(delete_path_forward) ...
3
votes
2answers
162 views

QGIS Real-Time Vector Layer Creation

QGIS is running on my Windows PC. I have a CSV file on my PC that is remotely updated with values of a raspberry pi's GPS position and some wifi-status readings. Is it possible to create a vector ...
4
votes
1answer
60 views

Predict/estimate point values for unsurveyed areas based on vegetation type

I have point data from deer surveys and would like to predict values for areas not surveyed based on vegetation type (Grass, Disturbed, Oak, Pine, Mixed etc.) So far I have dissolved my vegetation ...
0
votes
0answers
30 views

Using ReportLab with Arcpy

I am having some issues creating a geoprocessing service within arcmap using reportlabs pdf toolkit. The script runs fine outside of arcmap, however when i try and run it in arcmap to publish as a ...
0
votes
1answer
45 views

Clip a GeoTIFF with a shapefile

I have a geotiff file that I made in Python. After I created it, I realized it was for all of North America, and I only need the United States. I then got what I assumed was a shapefile of the US ...
1
vote
1answer
26 views

QGis's Geoferencer plugin isn't able to paste text that has been added to clipboard via mac's “pbcopy” terminal command [closed]

I recently wrote a little script that used mac's pbcopy shell command to dump some text into my clipboard for use in the QGis program. For some reason I'm not able to paste stuff that has been ...
1
vote
0answers
43 views

My QGIS keeps me returning “ascii” errors

First, whenever I open QGIS, the extension "Quickmap Services" returns an error with this tracker: Impossible to load the extension quick_map_services because of an error on calling InitGui() method ...
4
votes
1answer
59 views

Troubles Updating Values of Selected Features with PyQGIS

I'm trying to modify the values of some selected features. I have written this small script, but nothing happens when I run it. Is there something that I've missed? Here is my code. lyr = ...
-1
votes
2answers
30 views

applying equation on numpy array [closed]

I have a 3d array: >>> print arr_u_num [[[ nan -3.90149352 -1.21931281 -1.08366785] [ nan -2.07270503 -1.27621887 -0.89320389] [ nan -2.69618795 -1.98927089 ...
1
vote
0answers
14 views

Check if raster (part of) lies within a pixel - python/gdal

I have a list of the corner-coordinates of different grid (c1-c4). First i sorted these coordinates to ensure that c1 is the upper left, c2 is the upper right, c3 is the lower left and c4 is the lower ...
1
vote
0answers
39 views

Using row.setValue() function with arcgisscripting?

I'm trying to set column value NULL. I tried different ways to do that, I used CalculateField_management and UpdateCursor but i did not get success. when i used CalculateField_management. It says ...
3
votes
0answers
50 views

Can qgis_core work with external python distribution (such as Anaconda)

I've built a python application that has its own GUI. I am trying to use qgis.core/pyQgis as map display only. Specifically, i have anaconda 2.3 and its python distribution (2.7.11). After research on ...
3
votes
1answer
77 views

Standalone python app that uses qgis.core without installing qgis

I am building a standalone python application that has its own GUI, i would like to use qgis.core/pyqgis as a map display only. But from my searches on this topic, it seems that the full QGis software ...
0
votes
0answers
24 views

How to run a function in a while loop while an QObject is activated/triggered in PyQgis

Firstly I am new to PyQgis and there might me a lot of basic errors. The aim is that everytime a new vector object is drawn its attribute should automatically update while a QAction I have created ...
1
vote
2answers
58 views

How to define outline color from polygon layer using Python?

I´m using a QGIS 2.8.3 and I want to define a style for the legend of my polygon layer. I was using this code that works perfect: str1= 'C:/Documents/Layer.shp' myVectorLayer = QgsVectorLayer(str1, ...
3
votes
2answers
78 views

How to Check if a Layer is PRESENT or ABSENT in a Project via PyQGIS?

In QGIS, what is the simplest python code (least possible) to verify if a particular layer is PRESENT or ABSENT in the Map Layers list? NOTE: The script shouldn't trip an error IF the layer is ...
1
vote
0answers
41 views

Try/Except Statement gives different Results in QGIS Console vs. QGIS Tool

I want my script to do different things depending on whether a particular layer DOES or DOES NOT exist in the Map Layers list. I thought the try: / except: statements would be the best way to achieve ...
1
vote
1answer
27 views

Render QgsRasterLayer without adding to legend

I am trying to render a number of related QgsRasterLayer objects that are related to eachother (they are slippy-type tiles). Ideally I would like one item in the legend that can have its position ...
0
votes
1answer
29 views

Oracle Procedure Call From ArcToolbox Script - Error processing call -

Background: I have an Oracle package with procedures to randomize and reset passwords for our SDE/GIS schemas. These procedures work perfectly via SQL Plus command line commands. My package looks ...
2
votes
1answer
69 views

geopandas spatial join extremely slow

I am using the code below to find a country (and sometimes state) for millions of GPS points. The code currently takes about one second per point, which is incredibly slow. The shapefile is 6 MB. I ...
3
votes
1answer
67 views

Skipping Non-spatial Data in For Loop

I'm working in ArcMap 10.3, and I have a script that searches through all the folder and files in a directory using arcpy.da.Walk, grabs any file containing a key word, and copies it over to new a gdb ...
2
votes
0answers
52 views

Using Python to convert line shapefile to raster, value=total length of lines within cell

I have already read the similar question Convert line shapefile to raster, value=total length of lines within cell using R. And I want to realize the function using Python. ===== My attempt ==== ...
0
votes
1answer
34 views

Getting a JSON response with requests and ArcGIS REST API

I'm performing a batch download from my AGOL account, and using the ESRI documentation export item I can export content to shapefiles. I would like to then download the newly created shapefiles. In ...
3
votes
0answers
43 views

matplotlib show() suspends ArcGIS

I've written a python script to plot a cross-section from a DEM along a line. Everything works fine except when I Show the plot, ArcGIS hangs and I have to force it to close with Task Manager. I ...
0
votes
1answer
35 views

Determining of vector dataset single files to specify its size on a disk

I wonder how to get size of disk space that a specific vector dataset occupies on a disk. I didn't find any ogr2ogr util or OGR Python method that can return a list of files that belongs to given ...
3
votes
0answers
41 views

SQL SERVER 2012, Python subprocess, OGR

Need help with uploading shapefile with srid 102008 to SQL server 2012. I ran the ogr2ogr script in the ogr shell and it uploaded the shapefile within seconds but when I try using python subprocess to ...
0
votes
0answers
22 views

ApplySymbologyFromLayer does not work in my python code

I have a layer file. I make a button in ArcGIS 10 with .NET. I want to change layer symbology with the layer file. For this purpose, I write python code and execute it from C#. If the following code ...