Stack Exchange Network

Stack Exchange network consists of 174 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.

0
votes
0answers
6 views

Change an existing QGIS v2.18 print composer extent to create atlas series focused on one location

I have a QGIS v2.18 project that includes a print composer layout. In the print composer I can alter the exent to match the canvas extent using the Set to Map Canvas extent button. I would like to ...
0
votes
0answers
8 views

QGIS 3 Python terminate mapTool

Using QGIS 3 I am calling a mapTool to get the coordinates of a user input on the canvas. The function is called by a button in the toolbar. Before the mapTool is loaded a UI is opened to insert ...
4
votes
2answers
50 views

QGIS 3 Get coordinates from mouse click

I am working on a small QGIS Python plugin and want to get the X/Y coordinates from a user click on the canvas. I have a small UI called from button in a toolbar. After filling the UI with information ...
0
votes
0answers
13 views

ZeroDivisionError: float division by zero when using rasterio zonal_stats and geopandas?

What I am trying to here is extract out different area totals for various land cover types given a vector (US census data) and raster (image of mMassachusetts) file of Massachusetts. But every time I ...
2
votes
0answers
21 views

WhiteboxTools returns nan rasters when lee filtering large radarsat images

I am attempting to run the following code from WhiteboxTools: .\whitebox_tools.exe --run="LeeFilter" --input='imagery_HV_orig.tif' --output='imagery_HV_filtr.tif' --filterx=5 --filtery=5 --sigma=10.0 ...
0
votes
1answer
10 views

cartopy and xarray issues

I'm beginning to use netCDF4 data and therefore I have downloaded xarray and also cartopy (with pip). I have downloaded data from the climate data store and want to plot these data. I have a ...
4
votes
0answers
28 views

Coarse Woody Debris extraction

I created very high dense point cloud of some forest plots using terrestrial laser scanner. Then removed points above 1.3 meter to see the coarse woody debris (Fallen dead trees). Attached is the ...
0
votes
0answers
12 views

Transform TIFF file to be able to use Pydem

Using Anaconda Python 2.7 juypter gdal pydem in Windows I wanted to learn to do basic slope calculation. I was given a TIFF that was UTM zone 55, it covers a small area in Qld Australia. Planning ...
0
votes
0answers
16 views

Open Pan Sharpened satellite images in Python?

I recently downloaded the SpaceNet Off Nadir dataset for work but found that the Pan-Sharpened images can't be opened in Python. I think it's probably due to the colour bands being undefined but I'm ...
0
votes
0answers
15 views

GeoDjango show only one map of all geofields

I've got this model: location = models.PointField( verbose_name=_("Location"), help_text=_("Standar location"), srid=4326, blank=True, null=True ) area_poly = models....
0
votes
1answer
28 views

Loading all rasters in a directory and naming the variables iteratively

Hi I'm working with prism data and I already have clipped (masked) rasters (*.bil files) of a specific area for each day of a year. I'd like to open all these rasters with rasterio, convert them into ...
3
votes
3answers
140 views

Merge all shp files in a folder into one with a new field populated with the source filename

Want to merge all shp files in a folder into one with a new field populated with the source filename. Not getting any errors but not getting any outputs. Code originally taken from (How to add field ...
0
votes
0answers
20 views

GeoPandas ParseException: Invalid HEX char error

I am trying to read a geospatial table from a PostGIS database on PostgreSQL. Using the funcion sql = '''SELECT ST_AsText(geom) AS geom FROM my_table;''' df = gpd.GeoDataFrame.from_postgis(sql, ...
0
votes
1answer
23 views

Using GDAL or Python, how can I merge/combine 3 NITF images (RGB) into one image and keep the RPC metadata intact?

I'm looking to merge 3 imagery bands that are saved as separate files. The file format is NITF. The reason they are saved as NITF is because they have RPC metadata embedded into the images. I would ...
0
votes
0answers
26 views

Python QGIS .svg symbol with modifiable color (data defined override)

I can import an .svg format symbol on a vector layer by using QGIS Desktop App and change its color by using data defined override part(case when .. then rgb_color(255,0,0) END ). How can I implement ...
0
votes
0answers
32 views

How to specify bands to process rasters with gdal.Warp in Python?

I use Python to write scripts based on gdal library. I want to specify which bands do I need to process with gdal.Warp and I use gdal.WarpOptions() parameter as mentioned in API. But my PyCharm IDE ...
-2
votes
0answers
15 views

NameError: name 'row' is not defined python selenium [closed]

NameError: name 'row' is not defined
11
votes
3answers
188 views

Is it necessary to delete a cursor used in a comprehension?

If it is best to open cursors using a with statement to ensure it is deleted, like so: with arcpy.da.UpdateCursor(fc,fields) as cursor: Then, if a cursor is used as the iterable in a comprehension ...
0
votes
1answer
67 views

skimulator - Python error message on Windows 10 - load_entry_point

I am running python code called skimulator on Windows 10 to model Arctic ice drift and sea/wave velocities for a satellite mission in 2025. Its installed using Anaconda navigator with a python 3, ...
0
votes
1answer
29 views

Inverting spatial filter

I am trying to match a large set (43M) of small circular polygons to a smaller set of very large polygons. To make this process as fast as possible I've created points from the centers of the small ...
1
vote
0answers
26 views

Is there a way to use the project layout if using a plug in that creates batch maps through QGIS?

There is a plugin for biological records which creates batch maps for each taxon but it bypasses the premade project layout with a legend, picture of a logo and the copyright for each of them. Is ...
2
votes
2answers
35 views

PyQGIS QgsSvgMarkerSymbolLayerV2 setDataDefinedProperty() for color doesnt work

i have a script which works well and changes the symbol QuarterCircle's color and angle : vLayer = QgsVectorLayer(uri, "myData" , "delimitedtext") symbol = QgsSymbolV2.defaultSymbol(vLayer....
0
votes
0answers
29 views

Edit geometries in python: which tool? [closed]

I was asked to create a python script to do a "simple" cut-copy-paste operation on shapefile geometries. I say simple because it takes 3 minutes to do it by manually editing features in Qgis. But it ...
1
vote
1answer
31 views

Comparing pixel values at a given point in two rasters

I have two raster images, one for land use and one for NDVI, i would like to calculate LAI based on land use. So i need to compare the pixel value in the NDVI raster and Land use raster then select ...
1
vote
0answers
19 views

PyQGIS (3.4) and PyQt5 DLL error

I have installed the new version os QGIS(3.4) on my computer. I am working in a standalone application of PyQGIS so I need to load PyQt5 components. As a difference with previous versions when I try ...
1
vote
0answers
43 views

Questionable data on single channel satellite bands vs. RGB composites

I am using Sentinel-2 images for a given region. I have all the separate bands and a merged RGB file, which comes standard with a download from ESA's API. Now I'm running some code where I separate ...
0
votes
0answers
24 views

Select certain rows and columns from a CSV file in Python [closed]

I have been trying to get this to work for a decent amount of time and I finally got it to print out the contents of the file but I can't get it to print out the 5 lines that I need out of a large, ...
0
votes
0answers
19 views

Export image collection Google Earth Engine to Google Cloud Bucket Python API

I have an image collection within GEE's Python API that I want to clip and write to my google cloud bucket. I am working on a Google Cloud VM and have mounted my bucket "gee-bucket22" with gcsfuse. I ...
0
votes
1answer
46 views

Retrieve OSM changeset information (pyosmium)

I would like to ask if there's an easy way to query OSM changesets' information like user, timestamp, comment and hashtags in that changeset. In particular I would like to retrieve all the user names ...
1
vote
1answer
25 views

PyQGIS (3.2) and H5PY DLL problem

I am working in a project in which I need to use PyQGIS and H5PY. The problem comes when I load qgis library and h5py, for example: import qgis import h5py I get this error: from ._conv import ...
0
votes
1answer
32 views

Using an SQL Query to skip or run a code in ArcPy/ Python

Using ArcMap 10.4 and Python I am trying to run a code (arcpy.ExportReport) on a bunch of different frequency tables. Which I have completed the only problem is that if I have a table that does not ...
0
votes
0answers
40 views

Convert pandas DataFrame to geodatabase table in ArcGIS Pro/ArcMap [closed]

I have to create a geodatabase table in ArcGIS Pro/ArcMap from a Pandas Dataframe, in order to be able to make further processes with the table (like making route events etc). I want to avoid this ...
1
vote
1answer
20 views

Getting Layer Properties of QGIS on standalone appliction using PyQGIS API

I am using PyQGIS API for developing the standalone application to load the certain VectorLayers. I used the QgsMapCanvas to load the map and QgsLayerTreeView to show the layer tree view using code ...
-2
votes
0answers
31 views

Which is the best geoprocessing method to predict time of trash collection? [closed]

So I have 100 trash cans and for each one we have an history of trash level measured every 1 hour for 30 Days. I want to predict the best time, on day 31 to collect trash. The trash can should be ...
1
vote
0answers
32 views

Rendering roads given a little bounding box

I have to render a small map (50-200 meter of radius given a GPS coordinate) to an image. I'm using mapnik on Python. Currently, my approach is to download directly from OpenStreetMap the needed .osm ...
0
votes
2answers
34 views

How to convert Zipcode+4 into standard 5 digit zip code using Field Calculator

I have a ZCTA shapefile that I would like to join to a table by the zipcode. My problem is that some of the zip codes in the table have a 5+4 digit format, and the ZCTA shapefile has only the 5 digit ...
0
votes
1answer
33 views

Error message, for “pip install /path/to/the/skimulator/directory” on Windows 10 Anaconda/python

I am trying to install skimulator on my windows 10 system. This is for simulating images of sea ice drift in the Arctic, for 2025 satellite mission. I have installed Anaconda/python and followed the ...
3
votes
1answer
64 views

How to export a layout in standalone script with QGIS 3? [closed]

I'm trying to automate map export from a QGIS project in a standalone python script, without interface. Many of the scripts founds are for QGIS 2. For example the script written by Tim Sutton here. ...
-1
votes
1answer
36 views

Pansharpening many L8 images in folder?

I want to pansharpen several true color and panchromatic Landsat-8 images in a folder using open source tools (GDAL, Python). File names are of format: L8_2018-09-25T18-17-51_TrueColor_ERaymond.tiff ...
1
vote
0answers
42 views

QGIS 3 Python plugin psycopg2 Postgres Notify/Listen Live Connection

I'm developing a plugin for QGIS3 for my company, where my managers can allocate tasks to other users. I have programmed two tables within the python script, witch will be only visible according to ...
2
votes
1answer
28 views

Pyqgis Gdal_translate

I would like to transform tifs in a directory with using python in qgis 3 in order to make tifs with a diffrent crs and adding tfw file. import glob, os from PyQt5.QtCore import QFileInfo from qgis....
0
votes
0answers
35 views

Allow access to PostgreSQL database only through QGIS plugin

I created a Python plugin in QGIS that manage the connection to my PostgreSQL database and loading layers in a specific structure, I've created also some personalized widgets to edit attribute tables ...
1
vote
1answer
48 views

Adding x,y labels in QGraphicsview using pyqt4? [closed]

Here is my sample program. When I need to draw a line for x axis and y label for y axis .so can any one help me how to add a line and labels to scene.i tried different ways but i didn't get the proper ...
0
votes
1answer
27 views

How to convert vector format (geopackage, shapefile) to raster format (geotiff) using rasterio without template raster

I'm looking to create a raster given just a geopackage (or shapefile, or other vector format). I don't have a template raster, and all I wish to do is burn the shapes into a raster using rasterio. ...
0
votes
0answers
11 views

Extracting site location from original MODIS sinusoidal projection from Google Earth Engine?

I'm currently trying to find a way to extract site location data from Google Earth Engine for several MODIS products in its original projection (sinusoidal). Yet I have not managed to receive the ...
1
vote
1answer
31 views

How do I create a binary mask using Pixel values from a Numpy Array over a certain value (i.e. >1000), in Python [closed]

I would like to create a binary mask using the height values from a Digital Elevation Model, and export this out as a tif. For example, generate a mask for areas over 50m My code so far: from osgeo ...
2
votes
1answer
32 views

How to use rasterio transform on all bands

I've imported a 10 band raster tif using rasterio as ds. I'm attempting to pad the image but keep getting errors with the transform. print(ds.transform) pilpadimg = rasterio.pad(ds.read(), transform=...
0
votes
1answer
42 views

Using Python to create a GeoTIFF File

I have data that I would like to create a GeoTIFF file with. I have the GDAL Python package installed. I also have 3 overlapping matrices with intensity values, latitudes, and longitudes. How can I ...
2
votes
1answer
43 views

Can't open specific layers with Qgis nor OGR

I'm working with mutliple sets of layers in order to create a new one. As I need to load them directly from the internet, I use both /vsizip/ and /vsicurl/ But I'm stuck at loading one of them. Here ...
0
votes
0answers
19 views

Python - Merge shapefile polygons based on criteria

I have a shapefile with thousands of polygons and would like to merge (join) adjacent polygons based on a threshold between attributes. I need to use python because I'm not allowed to use ArcGIS. e.g....