Stack Exchange Network

Stack Exchange network consists of 175 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-3]

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

0
votes
1answer
29 views

Print elevation of different coordinates from .hgt file

I am trying iterate through the data(elevation) from .hgt file. I have attached the codes which i used to get the elevation from the file. from gmalthgtparser import HgtParser hgt_file='N09E076....
0
votes
0answers
14 views

Install GDAL for Mac

In this discussion: https://gis.stackexchange.com/a/281671/136706 Cheng recommends to "NOT use the 1 install GDAL Complete.pkg to install GDAL. Try use pip to get GDAL from PyPi instead." So after ...
0
votes
1answer
31 views

How would I have an improper DMS value input return a message to the user in a Python 3 function? [on hold]

My question is about input functions in python 3 specifically for a latitude conversion function from dms to dd. I'm new to python3 and having some trouble understanding how I would allow a user to ...
2
votes
1answer
28 views

How to move a layer position on the layers order

I am looking for a way of moving a layer to the top of the layer order once another layer is loaded. Using the following code extracted from this answer I get the error: AttributeError: '...
1
vote
1answer
51 views

Question about running python in QGIS3

I have 5 python scripts in the following folders : .\Signal_Slot_Example\main.py .\Signal_Slot_Example\ProgressDialog\init.py .\Signal_Slot_Example\ProgressDialog\Progress.py .\Signal_Slot_Example\...
0
votes
0answers
49 views

Smoothing shapefiles using Python

The purple is the original polygon to be smoothed and I would like to smooth the polygons as the red line using Python. I tried simplify but looks like I need a buffer and simplify the buffer. But I ...
0
votes
0answers
13 views

Writing and testing python code using existing OSGeo4W Python3 install?

Looking for a development environment, like idle, for Python 3.6.1 that I can install and use with my existing python3 installation from the OSGeo4W. I am trying to learn python for use with QGIS and ...
0
votes
0answers
19 views

gdalinfo --formats return different values in python3 than in OSGeo4W

I am working whit geopdf to obtain the layers. When I use driver = ogr.GetDriverByName('PDF') it return None, and obviously I can't open it. I have checked with the command gdalinfo --formats and it ...
0
votes
0answers
41 views

How to preserve the Multiploygons using Python?

I converted my input file with geometry Polygon 25D to an output file with geometry Polygon using the below code. As you can see the below image. Problem is that the holes in the polygon is vanished ...
5
votes
2answers
76 views

MessageLevel in QGIS3

I am trying to migrate a plugin to QGIS3 from QGIS2 and I am having issues with an API. The original python has QgsMessageBar.MessageLevel but https://qgis.org/api/api_break.html says it has been ...
1
vote
1answer
58 views

Open Data Cube how to continue after the creation of the database?

I have some questions about using Open Data Cube. First of all I have successfully installed the virtual environment with miconda and the database with PostgreSQLPortable-10.1.1. Now I have already ...
1
vote
1answer
29 views

Automating calculation of NDVI with rasterio?

I want to automate this code below for other 99 images, the problem that I have is that each image is in its specific folder as it's mentioned in the picture below. the images are very big and I want ...
1
vote
2answers
46 views

Add Path to JPGs in Attribute Table based on Unique ID

I've been tasked with updating attribute table fields with file paths to image files in a folder based on a unique ID. I'm having trouble thinking up a script that will do this? I'm working on a ...
0
votes
1answer
40 views

How can I run an ArcPy Python Toolbox from Python3-shell?

I am trying to port an arcpy python toolbox from ArcMap to ArcGIS Pro. In ArcMap I had to use the 64-Bit-geoprocessing tool because of the size of the datasets, so I wrote a wrapper-Script for the ...
0
votes
0answers
10 views

How to read ALOS PALSAR data using gdal

I have downloaded ALOS-1 PALSAR level 1.0 data from data archive from Alaska Satellite Facility. After unzipping files ,I am getting image files,Leader Files,Trailer File and Volume File. All the ...
1
vote
0answers
22 views

pyqgis 3:how to identify partial intersections between a buffer (polygon) layer and pipe (line) layer?

I have a drains layer (polygon) around which I have created buffers of varying distances. I want to find the intersection between the different buffer layers and pipes (line) layer and accordingly ...
0
votes
0answers
133 views

Why does the output of gdal.RasterizeLayer differ from gdal_rasterize?

Problem I've recently noticed that the output from the gdal.RasterizeLayer function differs from the result I'm getting using the gdal_rasterize utility. I have geotiff of a SAR product that has ...
0
votes
0answers
27 views

Developing and desirably debugging pygis-3 processing scripts?

The writing of processing scripts in QGIS3 changed substantially. On the basis of many tutorials/blog posts and answers on this site I got a running processing script in QGIS3. But it was, for a lousy ...
1
vote
0answers
42 views

Converting QGIS2 Plugins to QGIS3

I am trying to convert a QGIS2 Plugin to QGIS3; specifically the Quickfinder plugin (I am aware of QGIS3 Locator and no I do not feel it provides the same or similar capability just thought I would ...
2
votes
1answer
42 views

QGIS plugin: set the position of the featureForm

Im developing QGIS plugin (Python3) to open the featureForm (depending on some of my conditions (matching geometries,...))I use this code: layer = self.iface.activeLayer() ...
2
votes
1answer
34 views

Write a Spatial Join output to a CSV?

I am trying this example with different input files. My aim is to merge the country and point tables into one table using sjoin from geopandas and write to a CSV file. I took a look at 1. When I run ...
4
votes
2answers
95 views

Bug using Python 3.7 (from QGIS) and trying to install package with pip

I use QGIS 3.6 and Python 3.7 and I try to install a package with pip in command line tool under Windows 7 but I have the following message : Fatal Python error: initfsencoding: unable to load the ...
0
votes
0answers
92 views

Visualize big data HTML file created with Folium

I have written a Folium map of a French city with the possibility of visualizing attributes informations on click for each of its polygon which makes a huge file after 2 hours of calculation with the ...
0
votes
0answers
28 views

Loading spatialite with python3's module under Windows

I installed spatialite's Python module using pip: pip install spatialite I copied the mod_spatialite.dll found on https://www.gaia-gis.it/gaia-sins/index.html into my windows/system32 folder (I have ...
1
vote
0answers
54 views

QGIS plugin + project: Enter db credentials(password and username) programmatically

I am developing QGIS Python plugin. I have a QGIS project and layers stored in a PostGIS database. I don't want to store the password into the project and I want to avoid that user need to type ...
0
votes
0answers
55 views

How to insert a Polygon into MySQL database Table?

I have shapefiles which I converted to .csv format. I want to insert those into a MySQL Database table. I used ST_PolyFromText according to the MySQL reference manual. ## create table cur.execute("...
0
votes
0answers
43 views

Problems with GeoServer REST API via Python and text encoding

I have checked a few other threads talking about GeoServer REST API and encoding, but nothing seemed to work. I have a dataset already uploaded into GeoServer and now I just want to update some of ...
0
votes
0answers
117 views

How to enable jupyter nbextension for ipyleaflet

I was trying to test out this script https://github.com/tylere/PyDataNYC2017/blob/master/ipynb/satellite_analysis.ipynb but got stuck at the iteractive mapping part. import ipyleaflet map1 = ...
0
votes
1answer
77 views

Search plugin of Folium doesn't appear [closed]

I'm trying to reproduce the following jupyter notebook : https://nbviewer.jupyter.org/github/jtbaker/folium/blob/geojsonmarker/examples/plugin-Search.ipynb But once I'm trying to create the map I ...
0
votes
2answers
122 views

Click event on maps with Folium and information retrieval

I was wondering if there is a way in Folium to get the information on an entity we click on with Folium? I'd like the map to either open a tab with the attribute information or just send back ...
1
vote
1answer
19 views

Can't get the correct geometry values after MySQL querying

I have large points data and also a small bounding boxes. I want all the points present within this bounding boxes. With the extent of the bbox , I want to get all the points within this bbox. With ...
1
vote
1answer
87 views

QGIS 3 - QSettings().value(r“[…]”)[0:2] error - 'NoneType' object is not subscriptable

I'm trying to find a solution to launch a plugin from outside the QGIS console I've succeeded to call the plugin from the python console in the QGIS software but I'm now trying to do it outside of ...
1
vote
0answers
48 views

Launch a QGIS plugin from a batchfile

After having built a QGIS 3 plugin, I'd like to know how could I call my plugin without clicking on the plugin bar of QGIS to launch it. I've tried implement a first batch file for it : REM changer ...
1
vote
0answers
75 views

Shapely : cascaded_union seems to return too many polygons

I'm trying to get the union of around 4,000 polygons using Shapely's cascaded_union function. The output of this function is a multipolygon in my case, which is normal since many input polygons do not ...
1
vote
1answer
58 views

Deprecation warning when importing Processing in pyQGIS 3

I use QGIS 3.4 with Python 3.7 and I have a warning message when importing Processing like this : import processing from processing.core.Processing import Processing Here is the message : Using or ...
1
vote
1answer
31 views

Setting selection border color in red and save the map of the resulting selection

I'm attempting to create a plugin in QGIS 3 in order to zoom on a selected feature and get the map picture exported in .jpg format. I've been able to perform the zoom and selection of my selection, ...
1
vote
2answers
278 views

Create Polygon with Length, Width, and a center coordinate

Using Shapely or like library, How can I create a rectangular polygon with known Length, Width (in meters)(Drawing over EPSG: 3857), and center coordinates (EPSG: 4326)? The output needs to be in ...
1
vote
0answers
25 views

How to set project CRS with plugin (sqlite layer)?

I'm loading a sqlite db into the current project of qgis with a plugin. The standard CRS is EPSG:4326, however i want the canvas to be set at EPSG:3857. When running one of the 2 codes in the console,...
1
vote
0answers
114 views

How to prevent “Type error: unhashable type” while writing properties with Fiona?

Using shapely's dissolve method I created new geometries from two existing shapefiles. Now I would like to save those new geometries and their properties with Fiona. I have tried to write the ...
0
votes
1answer
82 views

QGIS 3.4.4 - Error to zoom : Cannot zoom to selected feature(s) : No extent could be determined

I'm trying to zoom on a specific place of my map using PyQGIS In order to do so I've defined the layer I wanted to get the features : couche_parcelles = QgsProject.instance().mapLayersByName('...
1
vote
1answer
88 views

Getting GRASS 7.4.4 Working in Python 3

I'm trying to get some GRASS functionality in a Python Script, specification r.series, but I'm struggling to import GRASS. I'm trying to uses the method outline on the GRASS Wiki, Working with GRASS ...
1
vote
0answers
86 views

Rasterizing shapefile with rasterio and gdal gives all cells 0 values [closed]

I am trying to rasterize my shapefile (20 polygons) with rasterio and fiona and turn the new raster into a mask for clipping. I need to rasterize my all polygons in my shapefile and turn on mask ...
0
votes
0answers
32 views

Get a column from database and populate the shapefile attributes?

I would like to know how to get copy a specific columns from the database and add that column in a shapefile attribute table? I am open to other better ideas.
2
votes
1answer
50 views

Assigning function to a key in QGIS Plugin

I have trouble assigning function to a hotkey in my plugin. I have a class that does things with a mouse click. I'd like to assign another function to a keyboard key or sequence. I've tried two ...
1
vote
1answer
78 views

Understanding QgsLayoutItemLegend of PyQGIS?

As I get more into QGIS scripting, I refer to the documentation often and usually without success. I have trouble deciphering how to interpret the classes, etc. I found this thread which is really ...
1
vote
1answer
52 views

Plugin that selects closest point features from a mouse click

I'm trying to build a plugin that would select let's say 8 closest points from a mouse click. I've found a working plugin that selects the closest feature from a mouse click here: https://www....
2
votes
1answer
579 views

Getting error while importing GeoPandas in Python console

I have installed GeoPandas and its dependencies using pip install package_name. Here is the pip list output: Package Version attrs 18.2.0 Click 7.0 click-plugins 1....
2
votes
0answers
66 views

Running python code created in QGIS

I'm using QGIS 3.4 and Python 3.7.0 on Windows 7. From the Python console of QGIS, I created a test script ("test.py") which contains the following line: print('Hello) and this is saved in C:\...
1
vote
2answers
410 views

Python shapely intersection with buffer in meter

Having a line and a polygon, I use shapely to determine the intersection between the two with a defined buffer. Both the line and the polygon are in WGS84 coordinates, while the buffer is in meter. ...
0
votes
0answers
21 views

Find diagram for understanding pyqgis

In orther to undestand the api of pyqgis, i'd like to konw where can i find a diagram of pyqgis api ?