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
1
vote
1answer
16 views

Calculating the Area by Square Feet with Geopandas

I have a geodataframe that has no assigned crs. I want to create a column/field called 'area' that has the area calculated as square feet, not meters or km, using geopandas. Note: this geodataframe ...
2
votes
2answers
21 views

QGIS3 call model from windows path with Python script

I was successful in triggering a model with the Python editor with this one-liner: processing.runAndLoadResults('model:my_model', {'param1':sParam1,'param2': sParam2,'coordinatesystem':...
1
vote
1answer
29 views

Find in between coordinates for the given latitude and longitude from a CSV file

I have a CSV file which has the latitude and longitude values for the start and the end coordinates as follows. In these the first lon and lat values are the start point then the second coordinates ...
1
vote
0answers
26 views

Convert Geo Coordinates System X/Y to lat &lon from netCDF4 file using python 3

I have netcdf4 file with some variables like: Geo Coordinates System X/Y. I need to convert it to lat/lon. How can i do that with python? This information from my netCDF4 file: import numpy as ...
0
votes
0answers
17 views

Assign layer style from qml file

I am adding a number of spatial csv files as layers and want to assign a qml layer style. import processing # User Dialog to pick Import_QGIS folder Folder_Path = QFileDialog.getExistingDirectory(...
0
votes
0answers
16 views

QGIS3x Layer-Import via URI [on hold]

I want to import a spatial csv-file with uri = "file:///C:/users/username/name with spaces.csv?type=csv&delimiter=,&detectTypes=yes&xField=X_Wert_Pos&yField=Y_Wert_Pos&crs=epsg:...
0
votes
1answer
19 views

Python3 Replace “/” With “\” [on hold]

I want to import several spatial csv files (points) into QGIS. The path to the folder, where the csv files are located is stored in the variable "Folder_Path". The file names are stored in a list. It ...
0
votes
0answers
56 views

What is Geopandas' default datum? [closed]

UPDATE : Geopandas does not have a default datum (see comments). Spotted error comes from ArcGIS model (my mistake or the software's mistake) ; executed the program again and obtained the expected ...
3
votes
1answer
69 views

Read numerical value of variable in NetCDF4 using Python

I need to undestand how I can get the numerical value of one channel IR_108 ( variable) in NetCDF4 and some other data: import numpy as np from netCDF4 import Dataset path = '/home/data/...
2
votes
1answer
88 views

Extracting lat , long & numeric value of one pixel for all variables in NetCDF4 file using Python?

I have an application with wxpython in which I can read and show NetCDF4 file and some information like x y coordinates. what I need is the numerical value or pixel value for the variable air dep ...
3
votes
0answers
50 views

Using both QGIS and native processing algorithms in standalone Python script?

I am developing a Python standalone script to process DEM in order to produce slope in vector format. I used PyQt5 to make a GUI to accept input data and parameters from user. My script is like this: ...
1
vote
0answers
38 views

PyCharm and ArcGIS Pro issue: Arcpy Must Run From Inside the Conda Environment,

I am getting the following error when running my python scripts in Pycharm, does anybody know how to fix it? it is very odd, because it was working just fine, then installed some updates on ArcGIS Pro ...
1
vote
1answer
28 views

Setting color of Simple Marker Layer from field using python 3

I'm trying to set up the colour of a QgsSimplerMarkerSymbolerLayer. Here is my code : sites=iface.activeLayer() single_symbol_renderer=sites.renderer() symbol=single_symbol_renderer.symbol() symbol....
4
votes
1answer
57 views

Explaining pyproj to_epsg min_confidence parameter?

Following on from this question How can I get epsg code in pyproj with version==2.1.3, I discovered that sometimes when intialising a pyproj Proj instance with a string ESPG code eventually results in ...
3
votes
1answer
41 views

Setting a Background Color with RVBT field with python

I'm trying to set the color of a background of a layer. To do this i created an attribute "Color" with the RVBT numbers associate to each feature. As in the picture, i want to set the color with those ...
0
votes
0answers
30 views

Set default version of Python in ArcGIS to 64-bit?

This is the output from Python terminal within ArcMap 10.6.1 for Windows 10: >>> import sys, numpy, matplotlib >>> print(sys.version, numpy.__version__, matplotlib.__version__) ('2....
0
votes
0answers
51 views

Setting reference frame for shapefile with pyshp?

I'm using pyshp to create new shapefiles with Python 3. My code runs without errors, but when I open the resulting file in ArcMap I get this error: The following datasource you added is missing ...
1
vote
0answers
19 views

How use IF conditions for choose cmap to plot NetCDF4

I have some variable in my NetCDF4. I have 2 type of variable IR ( infrared) or VIS visible all time when when I choose var to plot in list_ var in index I need to choose cmap : Dor IR the cmap is ...
0
votes
0answers
15 views

Referencing image using GCP-file?

I'm trying to automate the actual geo-referencing in PyQgis/PyQt5. I went manually over the built-in GDAL Georeferencer in QGIS and saved a GCP-file. Also, the actual commands used for the conversion ...
2
votes
0answers
78 views

Python warnings in QGIS 3.4

I just opened the QGIS and this appeared. What does it mean? Is it serious problems? warning:/Applications/QGIS3.6.app/Contents/MacOS/../Resources/python/qgis/utils.py:672: DeprecationWarning: the ...
1
vote
0answers
36 views

Problems with LecoS plugin in QGIS on Mac Mojave

I wanted to install LecoS plugin in Qgis. But first error appears that I have to instal scipy for python in orderd to use plugin. Python was instaled using instructions from Qgis document, version 3....
0
votes
0answers
60 views

GeoPy installation fails via pip3 on Windows / OSGeo4W shell

I have written a little geocoding for PyQgis script on my linux machine, and it runs just fine there. Now I would like to start using this script for PyQgis (Qgis 3.4.1) on Windows 10 as well. The ...
1
vote
1answer
91 views

geoserver.catalog.FailedRequestError: Tried to make a GET request to http://localhost:8080/geoserver/workspaces.xml but got a 404 status code

I'm trying connect to geoserver via rest protocol by gsconfig-py3 in python3 ,I get this error, but when I type "http://localhost:8080/geoserver/rest" in browser I can see these items moreover when I ...
0
votes
1answer
72 views

Print elevation of different coordinates from .hgt file [closed]

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
43 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
40 views

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

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
56 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
87 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
220 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
17 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
27 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
51 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
112 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 ...
2
votes
1answer
156 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
48 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
48 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
76 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
21 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
46 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
1answer
235 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
64 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
68 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
59 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
49 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
277 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
202 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
107 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
83 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
189 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
74 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 ...