Questions tagged [python]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
207 views

QGIS 3.4.3 Refactor fields changes symbols in fields (cp1250)

I've been using QGIS Refactor fields to change type, re-order and rename a substantial ammount of columns (statistical data). Most of them hold purely numerical values and are as such not material to ...
0
votes
2answers
31 views

Crop two rasters to common extent where pixelvalues are not nodata

I hope this doesn't get too confusing. I have two raster that overlap in a certain region. Like the following: What I would like to have, are two raster that only have values in the region where ...
1
vote
1answer
18 views

Rasterio creating composite/stack much larger than the individual bands

I am using rasterio to create a stack of eight bands and each individual band is about 1GB, but when it's stacking them the output (with a lzw compression) is a tif that's over 53GB! This seems huge ...
0
votes
1answer
22 views

Movingpandas does not have attribute Trajectory or TrajectoryCollection

I am trying to emulate this tutorial on python lib Moving pandas. However, i am getting the following error while creating trajectory AttributeError: module 'movingpandas' has no attribute '...
2
votes
3answers
3k views

Rasterizing Shapefile with attribute value as pixel value with GDAL in Python

Using suggestions and this question, the code now looks like this: from osgeo import gdal, ogr from sys import getsizeof import os # Define pixel_size and NoData value of new raster pixel_size = 1 ...
1
vote
1answer
37 views

Gram-Schmidt pan-sharpening in open source Python

I am looking to use the Gram-Schmidt pan-sharpening method in Python but I can't find any libraries that have this as an option. I found this, but I don't understand where to even go after reading it ...
0
votes
0answers
8 views

Extract Feature Service ArcGIS API Python

I have a feature service server and map service server and I'd like to export them to shapefiles/geodatabase. Map Service: https://tataruang.jakarta.go.id/server/rest/services/DCKTRP/UDGL/MapServer/...
1
vote
0answers
49 views

Python: How to get x,y coordinates of the highest raster values located in a list of polygons

I would like to extract and convert to a shapefile the coordinates of the highest pixel values located in several polygons. Such treatment was quite straight forward to achieve in R but I'm a newbie ...
0
votes
0answers
7 views

Network Analysis Shortest path with original line segments as output

I've managed to batch run the shortest path algorithm and the shortest route (point to layer) in the output is perfect, except that I really need the individual attribute table of the line segments in ...
1
vote
1answer
65 views

Calculate area of polygons in square meters when CRS is EPSG:25833

I have EPSG:28533 coordinates and would like to calculate its area in square meters and then transform these coordinates to EPSG:3857. I have taken the code from here to calculate the area but it does ...
5
votes
3answers
3k views

Converting NetCDF dataset array to GeoTiff using rasterio Python

I have read a NetCDF file using the netCDF4 library and then read one of its datasets ("Evapotranspiration") into a variable (variable contains array) using the following code. Subsequently now I am ...
2
votes
1answer
110 views

How to set a QgsLayoutItemLabel position by map coordinates in QGIS?

I am making a layout export function and I would like to create a QgsLayoutItemLabel at a given latitude and longitude. But in QgsLayout the position is relative xy (150,100). Is there a way to ...
1
vote
1answer
657 views

PyProj - Transform coordinate in “HK80 grid” to “WGS 84 / UTM zone 49N or 49S”

Am trying to use python pyproj to do the above conversion (convert/transform from Hong Kong GRID to Hong Kong UTM), but am getting different values from the expected result. My expected conversion ...
0
votes
1answer
85 views

Sharing WebMap through Python

I already know how to share a layer, or create a empty webmap (and add layers after its creation) through Python on ArcGIS Pro. However I could not find a way to share a Web Map trough Python. By ...
1
vote
1answer
49 views

Load raster layer from gpkg file

I'm new with PyQGIS. I need to load a raster layer from gpkg file, and i tried this way: gpkg_raster_land_layer = "GPKG:" + path_to_gpkg + ":" + layername r_layer = QgsRasterLayer(...
1
vote
2answers
66 views

Define projection of TIFF file when exporting from Python

I am struggling with getting spatial data into a readable TIFF file with the right projection. As far as I can understand, my problem is that the longitude and latitude is not saved as the projection ...
0
votes
0answers
26 views

Watershed delineation using hydrological Python library

We would like to delineate watershed polygon for a given pour point using hydrological Python library. Until now, we have tried these libraries: pyshed Grass (r.watershed) Whitetoolbox We have ...
1
vote
2answers
28 views

PDAL is mixing Lat and Lon when using tindex

I am trying to extract polygon representing the extent of my .LAS file. I am using tindex to do so. When importing the resulting file, it looks like longitude coordinates are set as latitude and vice ...
-3
votes
0answers
19 views

Obtener atributos entre 2 capas que intersectan espacialmente y autorellenar los atributos al crear un nuevo objeto [closed]

Al crear una vivienda/punto sobre una manzana/poligono , obtener los datos de la manzana y autorellenar en el formulario los datos en los campos de la capa vivienda/punto. Existira un script para ...
0
votes
2answers
34 views

Convert multiple JSON files to a single shapefile or geodatabase feature in ArcGIS or Python

I have been querying one feature in Esri ArcGIS REST Service, but because it is a large data, I had to query it several times (1000 features query limit). This results in many JSON files as parts of ...
1
vote
2answers
701 views

How to run Python script in QGIS via plugin

I am an absolute beginner in QGIS no idea in this field. I just created a Python plugin with pluging builder in QGIS successfully PYTHON_PLUGINS_PATH/ MyPlugin/ ----------------- inside it contain ...
1
vote
1answer
25 views

Test Schema Lock does not catch open feature class from within ArcGIS Pro

I am working on a script tool to be run in ArcGIS Pro (version 2.4.0 with Python 3.6.8) and wish to give the user a warning message and also time to close a feature class so as to avoid the script ...
4
votes
4answers
565 views

How to use create a plugin that contains a set of processing scripts using Qgis Script feature?

I have some script that I would like to share easily. I have read here that its possible to create a plugin using a set of scripts using "Scripts/Tools group in the Processing toolbox, double-click ...
0
votes
2answers
30 views

Loop through Z coordinate of stream and create point where elevation changes by 1ft

Using ArcPy (Python 3), I am trying to create points along a line where the elevation changes by 1 ft. I was successfully able to convert my stream to 3D using a Water Surface Grid and the Interpolate ...
2
votes
1answer
38 views

QgsFillSymbol crashing QGIS [RESOLVED]

I'm trying to customize my layers from a python script. I would like to add several symbol layers to features. # Creating symbol layers symbolLayers = list() lFill = QgsSimpleFillSymbolLayer.create({ ...
3
votes
1answer
123 views

PyQGIS in PyCharm 2020

I know this problem appears over and over again, but maybe someone can help me. I've read many articles on GIS StackExchange on the topic and I'm referring to this post: Why does QGIS 3.2 "...
3
votes
1answer
66 views
+100

Calculate new band for satellite image after predict values with RF

I have satellite image which contains 3 different bands. I'm using Python (jupyter notebook) in order to calculate new band by applying random forest regression. My problem is that after I have ...
-1
votes
0answers
10 views

Contiguity weighting with “touch” predicate in PySAL? [closed]

I want to compute a contiguity weight matrix in PySAL. I've looked at Queen and Rook contiguity, but I realised some of my data share no vertices, they only have touching edges. In order words, I ...
1
vote
1answer
38 views

How do you validate longitude and latitude coordinates in Python?

I am working on a bunch of shapefile data, and I need to process it and after some kind of processing, I need to feed the data to an indexer (in this case ElasticSearch). The problem is I just ...
0
votes
2answers
798 views

Add custom maps in Mapbox as tile layer in Folium

I was trying to create a map in Folium using a custom map built tile layer created with Mapbox Studio (using 3 different datasets and a satellite basemap). I was wondering if there is a simple way to ...
-1
votes
0answers
12 views

Q: Scripting the generation of DEMs from Sentinel-1 imagery? [closed]

I'm interested in ways to automate the generation of DEMs from Sentinel-1 SAR data over a particular region. Is there a way to script the DEM generation, preferably from Python?
3
votes
1answer
98 views

Setting DXF colors via Fiona

One might expect that the "Color" CAD field would control this, but the driver doesn't allow it to be set. schema = {'Layer': 'str', 'Color': 'int'} with fiona.open(path, 'w', 'DXF', schema=schema) ...
-3
votes
0answers
17 views

How do I filter out all unique file names in a Windows 10 folder? [closed]

I have a folder that commonly has files go in and out of it via task scheduler. These files (.docx, .pdf, .png) are added to the folder through another script and are added with a duplicate named file ...
-1
votes
0answers
17 views

I accidentally made the print function into a variable name [closed]

Silly me.... I accidentally made my print function into a variable name by typing "print = something" in Jupyter notebooks. How can I undo this?
0
votes
2answers
62 views

Python: cfitsio library not loaded when importing OSGeo library or using GDAL on Mac

I am trying to use the OSGeo library and GDAL Python bindings in a script for Python 3.7.7 on MacOS 10.15.4 Catalina. However, when I try to compile the script, I receive the following error as soon ...
2
votes
0answers
26 views

GeoPandas .sjoin polygon in polygon - works fast for some countries, but not for others

I am new to working with geodata. Setup: GeoPandas, Python3.6 I have a dataset of square polygons of 10x10km for countries. However, some of these squares are already completely in a neighboring ...
0
votes
1answer
30 views

pyqgis3 atlas feature scale

i was create a simple export code using pyqgis3 and atlas print composer map layout on QGIS3. my question is about map scale. if i use this line : mapScale = map.scale() i take the scale from map ...
0
votes
1answer
17 views

Computing annual spatial (zonal) statistics of a NetCDF file for polygons in shape-file [closed]

I have a NetCDF-file containing annual GDP data for Africa. I also have a shape-file containing provinces in Africa as polygons. I now want to compute statistics (ie. mean, sum, ...) per polygon ...
0
votes
0answers
18 views

QGIS 3.6 Model works but exported python script gives false results

I would greatly appreciate if somebody can help me out here. As the title says, in QGIS 3.6 i made a model calculating "Forest fire susceptibility index - RC", model works fine and gives correct ...
0
votes
1answer
17 views

ArcMap 10.7 Python Label Expression - compound. expression verified but will not label. Syntax issues

I have road ID labels in a string field that need to be parsed down. I'm using the python advanced label expression. I've removed the preceding '0s' successfully as well as some known text. Issue - ...
2
votes
1answer
27 views

Check Conditions on Geopandas

I have a GeoDataFrame : df gid complement geom 0 0 None POINT (601719.697 6316169.550) 1 1 None POINT (889885.470 6766441.264) 2 2 None POINT (841297.833 6819921.974) 3 3 ...
2
votes
1answer
21 views

Generating sampling points - making a series of points in the horizontal centre of a long polygon, equidistant spacing on vertical axis

I have a polygon showing the extent of a beach. I would like to create a series of sampling points along that beach, that are equally spaced north to south (say at increments of 100m to the northing ...
1
vote
0answers
16 views

Points within “normal bounds” of a linestring in Python

I am working in Python (using Shapely). I have a list of Point(s) (the small circles in the image) and a LineString (the solid line with an arrow). I want to select only the points which are within ...
0
votes
0answers
10 views

sqlite3.OperationError: Module not found when using pylandsat api

I installed pylandsat to download some landsat 8 imagery I need. there is command line interface I was using in the following fashion: pylandsat search --begin 2017-01-01 --end 2017-01-30 --sensors ...
1
vote
1answer
16 views

Merging sets of polygon from adjacent image tiles

I have two geodataframes that describes objects in two adjacent tiles. I would like to merge these two dataframes so that I can obtain a single dataframe that contains all the polygons. Using the ...
2
votes
1answer
57 views

how to remove small water bodies in binary mask array that we get from ndwi values?

I've detected water bodies in satellite images (modis, sentinel, landsat) in special area polygons, by ndwi values and based on special thresholds. area polygons and image tiles are coordinate ...
0
votes
0answers
16 views

When I get the total bounds of a shapefile, which are llcrnrlon, llcrnrlat, urcrnrlon, and urcrnrlat? Need it to use Maptlotlib Basemap

The goal is to use an ESRI webmap as a basemap beneath a shapefile for a script that visualizes earthquakes in the Philippines. But first, I'm practicing in using Basemap in a separate script. ...
2
votes
1answer
34 views

Dealing with NAN values in my training dataset

I am new to remote sensing. I am working on a project where I need to perform land use land cover classification. For such a task I want to use machine learning (python). My features contain 'BANDS' (...
0
votes
0answers
18 views

Buffering multiple features according to an attribute field?

I'm trying to build a buffer tool with Python that will function according to the attribute field that contains varying widths. I am building a inventory of streets and need to add a buffer to the ...
1
vote
0answers
12 views

Rasterio mask removes alpha band

I have a geotiff image that I am clipping to a geojson polygon using rasterio. When I load input the image in QGIS, it has an alpha band (4 bands total). rasterio says it only has 3 bands, which ...

1
2 3 4 5
173