Questions tagged [python-3]

Use this tag when Python 3 (or any of its dot releases) is the version you are using.

Filter by
Sorted by
Tagged with
4 votes
4 answers
166 views

Dropping nearly-identical point locations with GeoPandas

I have a GeoDataFrame (gdf) of several thousand point locations. I want to drop duplicate records from the gdf - that is, records with the same attribute information and the same location. However, ...
neirbom9's user avatar
  • 165
1 vote
0 answers
28 views

How to use pyproj to convert between ITRF2014 2023.9 to ITRF2014 2017.0

I am trying to convert a current observation from 2023.9 to a ITRF2014 2017.0 epoch. The Longitude Latitude is: -83.9851111, 43.9823026, 191.101. I Used pyproj to convert to ITRF2014 and then convert ...
Cary H's user avatar
  • 964
0 votes
0 answers
88 views

Streamlit/leafmap not showing my color maps in app

I am trying to add some local .tif files to a Streamlit app, but when I assign the color bars my app in my local server is still in black and white. This is what my code looks like: import streamlit ...
Stefano Potter's user avatar
2 votes
2 answers
102 views

Cannot import QgsVectorLayer from osgeo.ogr

I am trying to write a simple script to convert an ESRI geodatabase to a geopackage using gdal/ogr. Here's the example I was using: from osgeo import ogr fgdb = r"C:\GIS\data\somefilegeodatabase....
gwydion93's user avatar
  • 1,903
0 votes
0 answers
61 views

GDAL warp removing half of the map

I am using gdal warp to transform a geotiff between espg:4326 to epsg:3857, I have successfully done this previously on similar images but with the current geotiff it doesn't seem to be working. I am ...
james hall's user avatar
3 votes
1 answer
200 views

Esri Data Loading Tools don't generate data loading workspace

Recently, I deployed the Esri Data Loading Tools Python package into my cloned environment within ArcGIS Pro 3.0.3. With the process pretty fool-proof, given Esri's package manager interface, I was ...
Austin Averill's user avatar
1 vote
1 answer
728 views

shapely | Binary mask of Polygons' intersection

Goal: Create a binary 2d-array, that represents Points of intersection of a square Polygon with a MultiPolygon. from typing import List, Tuple import numpy.typing as npt from shapely.geometry import ...
StressedBoi_69420's user avatar
1 vote
1 answer
1k views

Shapely Polygons | Calculate Intersection of Union

Goal: Calculate 8 different Intersection of Union area numbers, each concerning the intersection of 3 MultiPolygons. There are 3 sources, each representing the same 8 groups of shapes. Mathematically, ...
StressedBoi_69420's user avatar
0 votes
0 answers
176 views

Managing style file in ArcPy using ArcGIS Pro

I am trying to update a geoprocessing service that was in ArcMap to ArcGIS Pro. The geoprocessing services use a style file for its legend and I want to update certain legends but I have no idea how. ...
Shraddha Sharma's user avatar
0 votes
1 answer
990 views

Folium TimeSliderChoropleth with tooltip?

I have followed an online example of using Folium to create a choropleth map with a timeslider, similar to what Aoife Currano has done in this magnificent post on mapping the spread of COVID back in ...
Will's user avatar
  • 414
0 votes
2 answers
390 views

Lon and Lat flipped when converting MODIS to Lat Lon

I found a code online that plots MCD19A2 tiles correctly, but I need to make manipulations to the data, and not just plot directly so I am making my own code for that. I basically copied the code I ...
M.O.'s user avatar
  • 189
0 votes
0 answers
879 views

How to add a tooltip to a Folium TimeSliderChoropleth map?

I have created a choropleth map in the Python library Folium using a TimeSlider plugin, and to this map I am trying to add a tooltip so that a user can interact dynamically with underlying data. I've ...
Will's user avatar
  • 414
2 votes
0 answers
488 views

Why will Geopandas not read geopackage into dataframe? [closed]

I am trying to read in a geopackage as a dataframe using Geopandas. I am using Python 3.8, Geopandas 0.10.2, and Fiona 1.8.20. The geopackage I was using to test this is publicly available in any of ...
gwydion93's user avatar
  • 1,903
2 votes
2 answers
937 views

Draw a normal from a point to a line

How to draw a normal LineString (AB) to existing LineString (CDEF) from a given Point (A)? Shapely version == 1.5.16
dabajabaza's user avatar
0 votes
1 answer
343 views

How do I open certain window from raster file

I have a geodataframe with some bounds and I'd like to open that specifc box from the raster file. Lets say my raster file is name data.tiff so my current code is like: import rasterio as rio from ...
MesRot's user avatar
  • 1
1 vote
1 answer
2k views

Xarray Dataset to raster - ValueError: failed to prevent overwriting existing key grid_mapping in attrs

I have a netcdf file located here http://thredds.northwestknowledge.net:8080/thredds/catalog/TERRACLIMATE_ALL/data/catalog.html?dataset=TERRACLIMATE_ALL_SCAN/data/TerraClimate_tmin_1958.nc. I am ...
Stefano Potter's user avatar
0 votes
1 answer
355 views

gdal.Warp - set env var

I set up an ubuntu 18.04 EC2 through AWS that "On Start" will run a python script in which will download a .tif from an s3 bucket and project it from EPSG:4326 to EPSG:3857 using gdal.Warp()....
Binx's user avatar
  • 1,350
0 votes
1 answer
265 views

Insert a waypoint into a POSTGIS table with psycopg2 and ST_GeographyFromText

I am trying to insert a waypoint into a table with 1 foreign key refererance and a geography point in PostGIS. I am having no luck. The table structure is CREATE TABLE route (id serial ...
s h's user avatar
  • 11
1 vote
0 answers
113 views

Visualize transformation when reprojecting from Mercator to equirectangular

I am trying to visualize the map distortion that occurs when reprojecting from Mercator to equirectangular coordinate systems. The actual reprojection is not difficult, but I want to save images (...
EvoBio721's user avatar
1 vote
1 answer
384 views

Trying to use GDAL in Windows Apache WSGI with Python 3.9.5 from OSGeo4W

Not much is missing and I'm going crazy. I'm pulling my hair out to get GDAL running under WSGI in Windows Apache using a Python 3.9.5 Installation from OSGeo4W. I have installed QGIS 3.24.2 with GDAL ...
christoph's user avatar
  • 5,645
1 vote
0 answers
108 views

Fatal error using orfeo toolbox (otb 8.0.0) algorithm Computeconfusionmatrix in QGIS 3.22

I tried to compute a confusion matrix of a raster classification with otb's Computeconfusionmatrix using vector data (polygons) as reference input. When I run the same algorithm in mapla (otb ...
Mirje's user avatar
  • 11
1 vote
1 answer
141 views

Error with new QGIS version no attribute 'isatty'

I have a make QGIS plugin it work on QGIS 3.10 But when I try to make it work on QGIS 3.14 + I dot some error I have install QGIS 3.22.5 and I have see few error: pip install pythonnet have to be ...
Pierre's user avatar
  • 161
7 votes
1 answer
417 views

Add parameter to connect in Python

I have a plugin in QGIS 3.4. I have connected layer.selectionChanged.connect(self.AfterSelection) and I call the selected layer to know which feature is selected, but when I use the 'Clear Selection' ...
Pierre's user avatar
  • 161
1 vote
0 answers
224 views

Is there a rioxarray version of xarray pad

I have a geocoded raster that I'd like to pad with NaNs to 64 x 64 pixels. I've tested rioxarray.DataArray.pad_box(), which does work, but it's a bit complex to calculate new bounding box corners that ...
user8188435's user avatar
1 vote
2 answers
1k views

rio.write_crs() leaves empty crs

I have a dataset ds which looks like this: <xarray.Dataset> Dimensions: (time: 42, long: 1383, lat: 586) Coordinates: * time (time) datetime64[ns] 1979-01-01 1980-01-01 ... 2020-...
Stefano Potter's user avatar
0 votes
1 answer
380 views

Create a function that will return geodataframe

I have created the following function to take Origin = str, Destination = str, line = shapely.geometry.linestring.LineString, node = GeoDataFrame def create_lines_df(Origin, Destination, line_, nodes_)...
Kareem Alaraby's user avatar
3 votes
1 answer
1k views

Converting ArcGIS Spatially Enabled Dataframe to GeoJSON

I've got a spatially enabled dataframe (SEDF) I'm trying to convert to a GeoJSON. Normally I do this as a 2 step process by creating a featureclass then converting that into a GeoJSON with SEDF....
Austin's user avatar
  • 128
1 vote
1 answer
739 views

Changing GeoJSON key name

I have a multi-level GeoJSON file and I need to create a new geometry field within it that is a copy of the old geometry field but with a different key name. The new geometry field would exist in the ...
Austin's user avatar
  • 128
1 vote
1 answer
2k views

Subsetting a Pandas dataframe based on latitude and longitude values and coordinates of a circular boundary in Python

I have a dataset with coordinates (LAT and LON) and boundary coordinates of a circle (shown in the figure below). I want to subset a dataset based on coordinates of this circular boundary for getting ...
Javy Ali's user avatar
1 vote
1 answer
829 views

How can I use the Python osgeo/ogr library to export a feature layer to CSV with geometries coded as WKT?

How can I read in a layer's data using the python osgeo/ogr library and then export the whole attribute table and an extra column with the geometries coded as WKT to a CSV format? I know that this is ...
Felipe D.'s user avatar
  • 2,509
1 vote
1 answer
217 views

Exporting NetCDF file in MODIS sinusoidal grid with xarray

I have 18 TIFF files in the MODIS sinusoidal grid I would like to convert to one file in NetCDF format. I have converted the tifs to an xarray xarray.core.dataset.Dataset format called stacked. At ...
Stefano Potter's user avatar
1 vote
1 answer
920 views

Exporting geodataframe to shapefile to match DBF format of ArcGIS export

I have a shapefile I created with GeoPandas that I am unable to use in a 3rd party application. The problem seems to lie with differences in how integer fields are being interpreted vs a shapefile ...
CreekGeek's user avatar
  • 389
0 votes
1 answer
133 views

Update point fields with fields in intersecting polygon

I get new points (inspections) every day. Each point falls within a polygon (district). I need to update 3 fields (Week, RecycleRt, RecyCollDay) in the point feature class with the district fields. I ...
WorkinProgress's user avatar
1 vote
1 answer
223 views

Error using SQL statement in ogr2ogr with Python string formatter

I am iterating through a list of shapefiles and extracting subsets of each shapefile to save as a KML using ogr2ogr. How can I extract the subset based on multiple conditions while using string ...
a11's user avatar
  • 940
2 votes
1 answer
708 views

Polygon simplification without intersection in GeoPandas/Shapely

Is there an in-the-can solution for simplifying a boundary that won't intersect the original poly? Something like .convex_hull but with a fillet option possibly? For example, .simplify() produces ...
CreekGeek's user avatar
  • 389
1 vote
0 answers
103 views

QGIS 3.20 failed dependency in qgis_core on libQt5Concurrent

I wrote a Python application that successfully uses QGIS on OSX. I now want to 'freeze' it. Building an app after using the kyngchaos packages resulted in all sorts of issues finding components. I ...
David Kovar's user avatar
5 votes
1 answer
500 views

Difference between LINESTRING((x1 x2), (x3 x4), (x5 x6), (x7 x8)) and LineString([(x1,x2), (x3,x4), (x5,x6), (x7,x8)])

I am a little confused about how objects are being defined and represented and mostly because some of the solutions I find for solving issues I have demand that the input data be in an other form than ...
Serge de Gosson de Varennes's user avatar
2 votes
0 answers
255 views

Shapefile topo projections not displaying all data using geopandas, geoplot, and matplotlib

I'm currently trying to display topographic map data for an area. Although the data that is displayed is showing up correctly, there are visible chunks missing from the final projection. I don't have ...
michael2103's user avatar
2 votes
1 answer
1k views

Converting PBF to GeoJSON using python3-gdal module

How can I use the module python3-gdal to convert .pbf into .geojson using Python? I've been exploring ogr in python3-gdal module but I can't figure out how to make it work. I do a request, the ...
Falcoa's user avatar
  • 335
4 votes
1 answer
309 views

Split the column into several and unpivot the columns

I currently have 2 columns NOM_CONCAT and Number of concat(COUNT_RSF_) which is composed of" concat "from 0 to 5 A1, B1, C1 ... A2 A3, B3 . . My goal and to separate the column ...
patrickblancseau's user avatar
1 vote
2 answers
231 views

Does not display Map in Rstudio using Python Package - GEEMAP

I am trying to use the GEEMAP package of Python in RStudio-1.4.1106. After importing the packages and running the code shown below MAP is not displayed rather it displays the MAP attributes in the ...
Shabir A.Bangroo's user avatar
1 vote
1 answer
1k views

Transform Google Earth Engine script to Python with Landsat 8 temporal data

I am doing a study for my work and I need to adapt my Google Earth Engine script in Python, but I am encountering some problems. Here is a Google Earth Engine script: //Importing image and geometry: ...
Lucas Fagundes's user avatar
2 votes
1 answer
610 views

FionaDeprecationWarning: Collection.__next__() is buggy and will be removed in Fiona 2.0. Switch to `next(iter(collection))`. record = next(c)

I have some Python3 code used to import shapefiles using fiona. This is the main set of lines: I created some code (Python3) with these lines: c = fiona.open(dataDir + "/" + sourceFile, ...
ASharma's user avatar
  • 23
3 votes
1 answer
2k views

Extracting only roads through Overpass API query

I am using overpass API and querying the api for ways,as a result it gives points, whereas I need only lines, multiline strings and polygons. But while using the following code, I get a GeoJSON file ...
Shubham_geo's user avatar
0 votes
0 answers
124 views

How to check integrity of Python-processed shapefile

In my QGIS project of American railroads, using USGS Base Topo Layer and shapefiles giving railroad details as of 2015, I have used the Python-3 pyshp library to edit the dbf database, adding some ...
Michiel Rademakers's user avatar
0 votes
2 answers
1k views

Executing QGIS tools in Python from Linux Shell [duplicate]

I would like to execute a Python script which uses QGIS Processing tools. On Ubuntu 20.x I installed qgis, qgis-common, python3-qgis and python3-qgis-common. My objective is to execute the tool Exploe ...
Michael's user avatar
  • 550
2 votes
0 answers
711 views

Deleting GDAL created raster

I am simply trying to delete a TIF that I created with GDAL. I have tried, simply, to use shutil which errors with: NotADirectoryError: [WinError 267] The directory name is invalid: 'T:/p003M01p0001/...
D_C's user avatar
  • 1,359
1 vote
0 answers
331 views

Why does my arcpy script's da.UpdateCursor get slower the longer it runs?

I have a layer containing pedestrian crosswalks (line features), and two layers containing street data: street segments (line features) and street nodes (point features). Every street segment has a ...
Dan C's user avatar
  • 12.2k
3 votes
0 answers
193 views

CalledModuleError: Module run None g.gisenv -n ended with error

I am trying to use r.horizon GRASS module(version GRASS 7.8) in Python script. But I couldn't able to access the grass modules. Everytime, I am getting the following error. File "C:\OSGEO4~1\apps\...
bs karthik reddy's user avatar
2 votes
0 answers
89 views

GRASS GIS: r.out.gdal raises an exception and hangs if it's called multiple consecutive times

I'm using a small python routine (grass.script, pygrass) to handle several operations on sentinel2 imagery. I'm calling r.out.gdal inside the script and a very annoying problem occurs: when it is ...
F.H.'s user avatar
  • 85

1
2 3 4 5 6