Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [python]

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

-1
votes
0answers
16 views

Polygons vector shapefile conversion to xyz format using Python

I have to convert a vector multipolygons shapefile to an xyz file where x and y are the lon and lat of points in the vector file extent, and z is equal to 0 for a point outside polygons, and equals 1 ...
0
votes
0answers
6 views

How to join the Least Cost Path with Optimal Destination?

I have the following problem which can be solved in 2 stages: The first stage is to calculate the least cost path for transporting the produce from a pixel on the field to the edge of the road, for ...
0
votes
0answers
14 views

Converting NETCDF dataset array to GeoTiff using rasterio python

I have read a netcdf file using "from netCDF4 import Dataset" and then read one of its Dataset "Evapotranspiration" into a variable (variable contains array) using the following code. Subsequently now ...
0
votes
0answers
17 views

Python matplotlib not available error with QGIS 3.6 Noosa despite upgrading Python on Mac

While generating contours in QGIS 3.6 Noosa on Mac I get an error saying "python matplotlib not available". I've downloaded the latest Python version but the problem persists.
1
vote
0answers
26 views

Python rasterio for saving GeoTIFF files and read in ArcGIS or QGIS

After following the steps in the tutorial of the Planet website (https://developers.planet.com/tutorials/convert-planetscope-imagery-from-radiance-to-reflectance/), I want to save each individual band ...
0
votes
0answers
23 views

.xyz file(coordinate files) in python [on hold]

I have got a .xyz file (coordinate file which contains coordinates of atoms). Is there a way to convert it to .txt file in python? OR How can I read and write on a .xyz files in python ?
1
vote
1answer
16 views

Parsing an input parameter to gdal:rastercalculator formula in QGIS 3.6 Python script

For training purposes I'm writing a QGIS 3.6 Python script. The script takes as inputs a raster layer and band, and three float numbers (refmult, refadd, sunel) and computes a simple formula: ((layer@...
1
vote
1answer
54 views

Drawing graticule with GDAL/OGR

I'm trying to generate a graticule with user-defined range of latitude, longitude, and interval; however, my code only displays one line of latitude and one line of longitude when loading it in QGIS. ...
0
votes
0answers
17 views

Error with Script Publishing Service from MXD with UNC Paths

I have script that attempts to publish a service which consists of a single tiff. I am using boilerplate ESRI code for this one: # initialize imagery_date = 'some date' folder_name = 'name of ...
0
votes
0answers
24 views

Python rasterio save GeoTIFF files

After following the steps in the tutorial of the Planet website (https://developers.planet.com/tutorials/convert-planetscope-imagery-from-radiance-to-reflectance/), I want to save each individual band ...
2
votes
0answers
39 views

OpenCV Remap image from rectified image coordinates

I have orthorectified a drone image using ground control points. This results in a (4096 x 2160) array of recified X coordinates and a (4096 x 2160) array of Y coordinates. I want to remap the ...
0
votes
0answers
16 views

How convert OSM relation to GeoJSON -based all kind of relation member roles [on hold]

I just want to convert OSM data to GeoJSON where it is pretty simple with node and way tags of OSM data, but relation which is giving complex can't find the logic to convert OSM relation to GeoJSON ...
1
vote
1answer
32 views

Replicate QGIS operations in PyQGIS [on hold]

What is the best practice for calling QGIS/SAGA/GRASS algorithms from pure Python e.g. the command prompt or in PyCharm? I know that from QGIS -> Processing -> History, I can retrieve the code and ...
1
vote
0answers
22 views

Blank MapCanvas Window [on hold]

I am constructing a GUI using PyQT4 and QGis. Rigth now I can open the MapCanvas whith same buttons of Zoom In/Out using this code: from qgis.gui import * from qgis.core import * from qgis.PyQt.QtGui ...
1
vote
1answer
61 views

List of lat-long, need values in a raster

Apologies in advance as I am not a GIS specialist by any means. I have a set of 1 million points and I'm trying to find their values in a geotiff raster. I've tried various versions of this answer ...
1
vote
1answer
22 views

How do I open / move the focus to a layout in ArcGIS Pro using Python?

I have an ArcGIS Pro project which contains multiple layouts. I've got a Python toolbox with a script which, among other things, chooses which of the layouts is appropriate for a specific map. At ...
1
vote
0answers
40 views

Files locked after running a Python script

I can run a Python script that uses qgsVectorLayer, qgsRasterLayer and many functions like processing:runalg("qgis.difference"......) and os.popen("gdalwarp -q -cutline.......) but if I want to run it ...
-1
votes
0answers
19 views

QGIS 3.4 using pygis for deleting columns v2

I have tried now to implement the code from BERA into the code from J. Monticolo. in order to get a script that is able to delete a set of columns from an attribute table. Previos Post. But I am ...
0
votes
1answer
25 views

Create mean raster stack from raster stack

I am trying to create a mean stack image(1 panchromatic layer) from a stacked tiff image(13 panchromatic layers). How do i go about doing this? My code: from osgeo import gdal import numpy as np #...
1
vote
0answers
15 views

Extracting certain landcover type in CONUS with Google Earth Engine?

I am new to Google Earth Engine and I would like to export the pixels with landcover type of deciduous broadleaf forest (MCD12Q1 with LC_Type1 equals to 4) in google earth engine. And the following is ...
0
votes
2answers
115 views

Testing if os.path.exists with ArcPy?

I am having trouble getting the os.path.exists to recognize that a file exists. I keep getting "File does not exist". I reduced the code to the absolute necessary to address my question. I believe ...
0
votes
1answer
29 views

Keep getting “no such file or directory” DriverError in GeoPandas [on hold]

I am new to using GeoPandas and Jupyter Notebook. I am able to define a name, let's say regions as regions = gpd.read_file('FilePathHere.shp') Then I am able to plot the shapefile. When I start a ...
1
vote
1answer
20 views

Is it possible to print a map in PyQgis3 of a database table without rendering the layer in the project gui?

There is a way to print a map using pyqgis3 without rendering the vector layer in the project interface? (by giving just the connection to the table, the map extent and the style )
-1
votes
0answers
36 views

How to georeference image in QGIS using Python code? [closed]

I stitched images from my drone and I have longitude and latitude of centre of image. Also I know that drone was taking images from 50m height and focal length of camera is 35mm. Image is oriented to ...
2
votes
0answers
40 views

Rasterizing polygon grid in Python (geopandas & rasterio)

I am trying to rasterize a custom polygon grid with one or more columns. Preferably I'd like to create multiband rasters from multiple GeoDataFrame columns (in polygon grid), but I have got stuck even ...
-1
votes
1answer
32 views

Classify polygons with Random Forest on Python

I have a segmentation shapefile made with e-cognition containing many polygons of which a part classified for the train file. I would like to classify them by applying labels (e.g. water, vegetation, ...
-1
votes
0answers
24 views

Creating buffer square x kilometers from point using Python? [closed]

I have central lat/long value value.Need to create a sqaure having x distance from the central lat/long value
1
vote
0answers
23 views

Computing GPS points accuracy

I have stand alone GPS points and RTK points collected at the same time and I want to compute the accuracy (1 sigma) of the GPS points. Using the haversine formula, I computed the distance between the ...
-2
votes
1answer
23 views

TypeError: cannot concatenate 'str' and 'list' objects, python [closed]

Can anyone help me with below problem. ['Korea', 'India', 'Japan', 'China'], ['Asia, world'], ['Asia, world'] I want the below function to be called for each entry in first list which is ['Korea'...
-1
votes
0answers
28 views

Save text files in a loop with Python [closed]

I read this question on GIS. But how can I save text file into another folder. Here is the code: import glob import os for file in glob.glob("input/*.jpg"): #iterates over all files in the ...
0
votes
0answers
28 views

Installing third-party Python Packages to Work With ArcPy and ArcGIS Pro?

My employer does not grant me permissions to use Python package managers like pip or conda since the websites that host these data are blocked. In ArcMap 10.x I have been able to install third-party ...
0
votes
0answers
17 views

import qgis.core in Spyder- DLL load failed

First off, I'm working with QGIS 3.4.5, Spyder 3.6 installed through ArcGIS Pro (2.3.2) python package manager on Windows 10. I can't get the qgis.core module to load and I need some help. I'm ...
1
vote
0answers
34 views

Changing CRS of geometry in geopandas dataframe efficiently?

I have a shapefile which I am converting into a geopandas dataframe. The CRS of this shapefile is epsg:4326 and I want to convert this to epsg:3857. import geopandas as gp file_path = 'zip_poly.shp' ...
0
votes
0answers
27 views

Geopandas ImportError: DLL load failed (in pyviz tutorial geographic data examples) win7

I'm trying to run the geographic data examples from pyviz tutorial. I'm getting the error list in modules below. My Geopandas module work fine (and the others dependent modules) with 3.5 python ...
-1
votes
0answers
18 views

Adding canvas in python plugin [closed]

How can I insert QGIS map canvas into python plugin designed by QT designer. UI file is compiled and all the logic is done. Now I only need to add canvas in widget when user click on button. Is it ...
1
vote
0answers
24 views

Extracting values From several raster .tif files to a .csv file using python

I have multiple raster .tif files. I am using Python, and I want to extract cell's attribute values from all rasters based on the latitude and longitude similarity, and saved in a .csv file, the ...
2
votes
1answer
43 views

How to get QGIS canvas in plugin window?

I'm working on project where I need insert QGIS canvas as a widget in QGIS plugin. When user click on button it should be loaded into widget. Something like this, this is example where satellite map ...
1
vote
1answer
37 views

Opening .vrt file with rasterio in Python?

I have 3 raster files (.tiff files) which are geographically 3 consecutive tiles of a particular area. I am trying to make a .vrt file of 2 out of these 3 files using the gdalbuildvrt python command. ...
0
votes
0answers
18 views

Programmatically stop and start ArcGIS Server map services using Python in ArcGIS 10.5? [duplicate]

In his answer to Starting and stopping ArcGIS Server map services using Python? @Jeff Berry posted how can we can programmatically stop and start ArcGIS Server 10.0 map services using Python. How do ...
1
vote
0answers
24 views

Read laz files are stored on IBM COS

I have a problem with reading laz files that are stored at IBM cloud object storage. I have built pywren-ibm library with all PDAL requirements - one of them with docker. I then deploy it to IBM ...
1
vote
1answer
34 views

QGIS 3 PyQGIS Script - Merge Layers and Export to csv with KML geom field

I previously had a script in 2.18 that exported csv files with kml geometry's file by file. I'm now wanting to move to QGIS 3 and do the same process except Merge the point layers then add the ...
1
vote
1answer
36 views

Open .tiff, set projection, then re-save in Python with GDAL

I am trying to set the projections of a .tiff file from another file with GDAL in Python. I successfully set the projections, but how do I re-save the .tiff afterwards? Here is my code: ds = gdal....
0
votes
0answers
35 views

Using low resolution GPS from bikers phones, and mapping to streets?

I am new to GIS. I would like to: map-match GPS points to actual road map The following is for projecting a point to a defined line: # perform interpolation and project point to line pt_interpolate =...
1
vote
1answer
23 views

How to show layout of layout manager from Python console or Python script QGIS 3

How can I show/open layout '2019_A' of Layout Manager from Python console? How show window layout specific? I checked in menu Interface Customization, mActionShowLayoutManager and I do not know how ...
0
votes
0answers
25 views

Plotting Multiple Rasters on Tkinter Canvas?

I have 2 Raster data sets (raster 1, raster 2) which are spatially adjacent to each other. As of now I am able to display individual raster on the tkinter canvas without any issues. What I am looking ...
0
votes
0answers
9 views

Interpolating timestamps for breakpoints for linestrings of GeoJSON

I have a GeoJSON file containing a couple of LineStrings. The properties contain the Departure and Arrival timestamp for each LineString. I would like to interpolate the timestamps for each breakpoint ...
1
vote
1answer
35 views

Distance between two point layers

I have a main addresses point layer and a areas point layer. Both layers have XYZ coordinates in the attribute table. I need to create a table based from the addresses layer which calculates the 3D ...
0
votes
0answers
34 views

Python 3.6 crashes after running QGIS 3.4 qgs.initQgis()

My Python window crashes after running this script. I have tested and it stops specifically at the qgs.initQgis() line. I think that something changed in qgis from QGIS 2.18 to QGIS 3.4 where I need ...
1
vote
0answers
24 views

Publish WMS service from my own image rendering library

I have written a Python package whose main function takes a bounding box as input, reads the according data from a data source of mine and renders it into a png image which is returned to the caller. ...
0
votes
0answers
29 views

Automating GDAL Georeferencer

I'm using the GUI of the GDAL Georeferencer in qGIS for referencing a lot of images. For a single image it is fine to open qGIS, open the referencer and changing the settings and GCPs manually. ...