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
0 votes
1 answer
25 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 ...
  • 187
0 votes
0 answers
24 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 ...
  • 374
0 votes
0 answers
20 views

Load GRASS raster layer in QGIS, with Python console

Is there any suitable set of Python commands that I could use to load GRASS raster layer in QGIS Python console? I tried this simple code: from qgis.core import QgsRasterLayer from PyQt5.QtCore import ...
1 vote
0 answers
71 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 ...
  • 1,729
2 votes
2 answers
111 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
0 votes
1 answer
45 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 ...
  • 1
0 votes
1 answer
194 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 ...
0 votes
1 answer
72 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()....
  • 1,057
0 votes
1 answer
48 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 ...
  • 11
1 vote
0 answers
49 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 (...
1 vote
1 answer
131 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 ...
  • 3,813
1 vote
0 answers
52 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 ...
  • 11
1 vote
1 answer
69 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 ...
  • 141
7 votes
1 answer
141 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' ...
  • 141
1 vote
0 answers
70 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 ...
1 vote
2 answers
268 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-...
0 votes
1 answer
183 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_)...
2 votes
1 answer
430 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....
  • 68
1 vote
1 answer
314 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 ...
  • 68
0 votes
0 answers
498 views

GDAL not installing for Python on Windows

I have used pip install GDAL in the command prompt to install the GDAL package in my Python Library (Python 3.6). It has successfully installed - version 3.3.3 However, when I go into Visual Studio ...
1 vote
1 answer
894 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 ...
0 votes
0 answers
69 views

Downloading Sentinel # Level 2 OLCI gives Python SSL certificate verify error

I am trying to automate the download of older Sentinel 3A- OLCI images from the repository of https://codarep.eumetsat.int/. However, every time I try to run the code, I come across a "Python SSL ...
  • 1
1 vote
1 answer
338 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 ...
  • 1,817
0 votes
1 answer
116 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 ...
1 vote
1 answer
491 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 ...
  • 369
0 votes
1 answer
53 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 ...
1 vote
1 answer
86 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 ...
  • 921
2 votes
0 answers
253 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 ...
  • 369
1 vote
0 answers
64 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 ...
5 votes
1 answer
189 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 ...
2 votes
0 answers
157 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 ...
2 votes
1 answer
474 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 ...
  • 315
4 votes
1 answer
161 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 ...
0 votes
1 answer
99 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 ...
1 vote
1 answer
565 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: ...
2 votes
1 answer
360 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, ...
  • 23
1 vote
1 answer
715 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 ...
0 votes
0 answers
59 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 ...
0 votes
2 answers
713 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 ...
  • 490
1 vote
0 answers
337 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/...
  • 1,319
1 vote
0 answers
105 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 ...
  • 12.1k
3 votes
0 answers
98 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\...
2 votes
0 answers
56 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 ...
  • 85
1 vote
1 answer
162 views

Using GRASS i.segment in Python 3 stand alone script on Windows10

I installed GRASS GIS 7.8.1 on Windows 10 using a OSGeo4W. I would like to use in a stand alone Python 3 script the i.segment GRASS tool. I saw some related questions (e.g., Using GRASS GIS in Python ...
  • 1,577
0 votes
1 answer
410 views

Reprojection with gdal.Warp doesn't work

I am trying to reproject a raster. I have tried gdal.Warp and it doesn't work. RuntimeError: Cannot find coordinate operations from 'EPSG:6257' to 'EPSG:6686'. Working in Python 3, Windows 64bit ...
  • 335
1 vote
1 answer
661 views

Can't install Packages with Cloned ArcGIS Pro Python

I have a new installation of ArcGIS Pro 2.6 on a Windows 10 computer. I have successfully cloned Python because I want to install third-party packages to this cloned environment and still use arcpy. ...
  • 7,587
2 votes
1 answer
552 views

Identifying coordinate format from exif data

I am using the Python exif module to extract coordinates from photos. The methods for doing so are: gps_latitude and gps_longitude. The output for latitude is: (32.0, 37.0, 37.15) and longitude is: (...
1 vote
1 answer
269 views

Calculating dates and using arcpy.CalculateField_management(

I am in the process of converting my scripts from python 2.7 to 3.x I am trying to calculate a date field with a datetime object exactScriptTime = datetime.datetime.now() exactScriptTime = ...
  • 2,114
13 votes
2 answers
3k views

What's the difference between QgsPoint, QgsPointXY and QgsGeometry.fromPointXY(QgsPointXY()) in PyQGIS?

I am using PyQGIS. What is the difference between QgsGeometry.fromPointXY(QgsPointXY(x,y)), QgsPointXY(x,y) and QgsPoint(x,y)? When I print these 3 options, I get: print( QgsGeometry.fromPointXY(...
1 vote
1 answer
617 views

How to visualize a NetCDF Dataset

Suppose I have a rather large NetCDF file that I open as a dataset using xarray. import xarray nc_in = r"....\D_P_WGS84_comp.nc" nc_ds = xarray.open_dataset(nc_in) It is composed of ...
  • 1,729

1
2 3 4 5 6