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
26 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 ...
user avatar
  • 11
1 vote
0 answers
28 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 (...
user avatar
1 vote
1 answer
33 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 ...
user avatar
  • 3,623
1 vote
0 answers
22 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 ...
user avatar
  • 11
1 vote
1 answer
41 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 ...
user avatar
  • 131
7 votes
1 answer
75 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' ...
user avatar
  • 131
1 vote
0 answers
29 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 ...
user avatar
1 vote
2 answers
107 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-...
user avatar
0 votes
1 answer
96 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_)...
user avatar
2 votes
1 answer
249 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....
user avatar
  • 58
1 vote
1 answer
133 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 ...
user avatar
  • 58
0 votes
2 answers
12 views

Removing branches from a multilinestring vector and retain the main centerline

I have a vector file that contains a centerline and multiple branches. I wish to remove these branches.I am unable to come up with a logic to remove these branches. Kindly guide.
user avatar
0 votes
0 answers
196 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 ...
user avatar
1 vote
1 answer
361 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 ...
user avatar
0 votes
0 answers
49 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 ...
user avatar
  • 1
1 vote
1 answer
229 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 ...
user avatar
  • 1,737
0 votes
1 answer
45 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 ...
user avatar
1 vote
1 answer
292 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 ...
user avatar
  • 369
0 votes
1 answer
41 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 ...
user avatar
1 vote
1 answer
59 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 ...
user avatar
  • 881
2 votes
0 answers
107 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 ...
user avatar
  • 369
1 vote
0 answers
54 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 ...
user avatar
5 votes
1 answer
110 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 ...
user avatar
2 votes
0 answers
122 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 ...
user avatar
2 votes
1 answer
292 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 ...
user avatar
  • 305
4 votes
1 answer
130 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 ...
user avatar
0 votes
1 answer
69 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 ...
user avatar
1 vote
1 answer
434 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: ...
user avatar
2 votes
1 answer
293 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, ...
user avatar
  • 23
0 votes
1 answer
429 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 ...
user avatar
0 votes
0 answers
52 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 ...
user avatar
0 votes
2 answers
598 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 ...
user avatar
  • 460
1 vote
0 answers
264 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/...
user avatar
  • 1,267
1 vote
0 answers
84 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 ...
user avatar
  • 12k
3 votes
0 answers
84 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\...
user avatar
2 votes
0 answers
51 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 ...
user avatar
  • 85
1 vote
1 answer
135 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 ...
user avatar
  • 1,545
0 votes
1 answer
296 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 ...
user avatar
  • 335
1 vote
1 answer
544 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. ...
user avatar
  • 7,137
1 vote
1 answer
382 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: (...
user avatar
1 vote
1 answer
216 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 = ...
user avatar
  • 2,104
11 votes
2 answers
2k 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(...
user avatar
1 vote
1 answer
490 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 ...
user avatar
  • 1,649
0 votes
1 answer
77 views

QGIS how to activate the checkboxes of the constractions in the attribute form by Python code and add expressions?

I tried using this type of line for the edit form , but its only for versions 2.8 but I don't know how is for new version 3.0 including "Enforce not null constraint". formConfig = layer....
user avatar
  • 75
3 votes
1 answer
1k views

Adding compression to a NetCDF file using xarray

I have a raster that I am trying to compress and convert to a NetCDF format with compression level = 9 using the xarray package. I assume that the compression is added using the encoding parameter as ...
user avatar
  • 1,649
1 vote
3 answers
123 views

Drawing points in layer given its coordinates using PyQGIS [closed]

I want to draw points in a certain polygon layer. Specifically, I want to display the centroid over each respective feature. All this using PyQGIS. So far, none of the answers I found helped me. I am ...
user avatar
3 votes
0 answers
121 views

Convert .grib2 in triangular grid to regular grid

I have ICON datasets (.grib2.bz2 file format) from Deutscher Wetterdienst (DWD) in triangular grid that I would like to transform to a regular grid. Currently, I run the following statement in my ...
user avatar
0 votes
1 answer
220 views

Using GeoPandas generated .gpkg in ArcMap

I am using GeoPandas to create .gpkg files. Using GeoDataFrame.to_file() When opening the files in ArcMap, it takes a long time updating the file extent. Files already have an spatial index as this is ...
user avatar
2 votes
0 answers
38 views

Polygonize RGB mage considering all 3 bands simultaneously

I'm using the rasterio.features.shapes method to generate GeoJSON information from a PNG file. This answer shows what I'm trying to do, except I need to analyze the RGB bands simultaneously otherwise ...
user avatar
0 votes
0 answers
221 views

ArcGIS Pro Python install causing issues with importing packages

I've looked at several posts and articles and I can't seem to find a solution to this. I need to use jenkspy for a specific task but my Python 3x was installed with a software called ArcGIS Pro that ...
user avatar
  • 1,405

1
2 3 4 5 6