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
2
votes
1answer
160 views

Algorithm “qgis:difference” doesn't work in pyQGIS 3

I try to use native algorithm difference of QGIS. But it seams it doesn't work like the others : parameters = {'INPUT': polygons['OUTPUT'], #from temporary layer created before 'OVERLAY'...
0
votes
2answers
199 views

Error converting Json file to a feature class

I want to convert some json data being returned from a request to a feature class, but I keep getting a RuntimeError: Object: Error in executing tool. I made a test gdb in a folder 'C:/Workspace/...
3
votes
0answers
200 views

Model in QGIS 3 (.model3) to Python 3? [duplicate]

I try to export a QGIS 3 model (.model3) to Python but the functionality that was available in QGIS 2 doesn't exist anymore. Is there a way to export it ?
0
votes
1answer
1k views

Problem converting qrc file into py one by PyQt5 [duplicate]

I am in my first steps in PyQt5. I intend to create a plugin within QGis 3.0. I would like to convert the file resources.qrc into py file, by running windows shell commands with python. However, when ...
0
votes
0answers
159 views

Debugging Error: Algorithm gdal:dissolve not found in PyQGIS?

I have difficulties with the processing package. I try to run a simple QGIS dissolve in pyQGIS 3. When I run the line : from qgis.core import QgsVectorLayer import processing from processing.core....
0
votes
1answer
263 views

Using the ArcGIS API for Python with a REST service to search content

I have a public REST service that has several layers and feature classes that I want to access. According to the documentation. Once I have the arcgis package imported, I can inject my outside REST ...
1
vote
1answer
544 views

Compiling QGIS 3.x (master) on Ubuntu 16.04 with Python3.6 and the latest Qt 5 and PyQt5 familiy modules (PyQt5, sip, qscintilla, pyqtchart)

The problem: Now that the compilation issue is over (Unable to compile QGIS 3.x (master) on Ubuntu 16.04: PyQt5.pyqtconfig module does not exist), QGIS 3 (master) refuses to load Python at startup. I ...
1
vote
1answer
334 views

Installing Anaconda for Python 3.6 without wrecking Python 2.7

I have both Python 2.7 with ArcGIS 10.5 Desktop and Python 3.6 with ArcGIS Pro. A few weeks back, I tried to install Anaconda (w/ Conda, Spyder, Jupyter, etc..) and it somehow overwrote my system ...
1
vote
1answer
238 views

Error: Algorithm not found with correct processing use

I try to run a simple dissolve algorithm in a standalone Python 3 script. My code is following : from qgis.core import QgsVectorLayer import processing from processing.core.Processing import ...
2
votes
2answers
3k views

Visualizing GPS points on interactive map [closed]

I am using version 3.0 of python, I want to visualize GPS points in my dataset on interactive map. Is there any python library that can help me to visualize my data on maps. Reference of any tutorial ...
1
vote
0answers
159 views

use python3 with osgeo4w shell and missing py3_env [duplicate]

I'm trying to migrate my qgis plugin from qgis 2.18 to 3.2. I try to use qgis2to3 for the migration but I'm having some problems. First qgis2to3 require python 3.3 and my osgeo4w shell install is ...
0
votes
0answers
186 views

Raster color after crop image by mask with rasterio

I have stacked 4 bands of Sentinel which have 10 meter of spatial resution. I I did it with command above: command = 'gdal_translate SENTINEL2_L1C:{scene_file_name}.SAFE/' \ 'MTD_MSIL1C....
0
votes
1answer
46 views

Problem reading shapefile with Python ogr-module

Trying to read naturalearthdatas shapefile vers. 4 "ne_110m_admin_0_countries.shp" with the python-ogr.modul I encounter a problem. inspecting the file with the following code-snippet: counter = 0 ...
3
votes
2answers
365 views

PyQGIS standalone script using QGIS 3.2

I want to work with PyQGIS Python 3 using QGIS 3.2 standalone install. I created a simple batch file to work with PyQGIS but I have some errors. Here's the batch file: @echo off SET OSGEO4W_ROOT=C:\...
2
votes
1answer
276 views

QGIS 3 - Python : QgsVectorLayerJoinInfo issue

I'm trying to use Python to join a table to a vector layer within QGIS (v. 3.2.0) Here is the script I use : >>>root = QgsProject.instance().layerTreeRoot() >>>ids = root....
1
vote
1answer
41 views

Cannot find feature class after adding new field in ArcPy?

I'm struggling with a very basic problem. it seems though, it's a problem with arcpy itself. I'm running the following code and it's give me a problem in the line of: with arcpy.da.UpdateCursor(...
1
vote
1answer
167 views

python's .replace doesn't work in QGIS' python editor

I am trying to compare some files to a datalist. The datalist's names are all in english letters, while the datafiles have the scandinavian "æ" "ø" "å" letters. an example: the file "Kystnære_måger....
1
vote
1answer
238 views

S57/ENC QgsVectorLayer with stand-alone python script

I'm running the OSGeo4W64 Qgis 3.2.0. In the gui I can add a vector-layer using the same data as in the example below without any problems. Adding the layer using the python console works too. When ...
1
vote
0answers
147 views

Show charts and plots in plugin

I'm creating a plugin to guide a user though a GIS analysis process. One of the things the user wants is the ability to display "charts" of the resulting data sets. I'm looking to build simple ...
2
votes
2answers
2k views

Installing PCL module for Python 3.6 in Anaconda

I am using Python 3.6 in Anaconda3 for Windows10(64) and would like to install PCL module. I tried conda install -c sirokujira python-pcl from (https://anaconda.org/sirokujira/python-pcl) and ...
1
vote
0answers
1k views

NameError: name data_all1 is not defined in Python 3.x

I have a standalone script using data opened from a Geopackage with Fiona. When I run this portion of my script: import os import fiona import numpy as np datapath= '/media/sf_SharesShapefiles/' ...
5
votes
1answer
945 views

pyQGIS returns invalid layer with QgsVectorLayer in QGIS 3

I have the following problem : I've installed all pyQGIS environment on Windows 7. I work with 64 bits version of Python 3.6 and QGIS 3.0 and PyQt5. My Windows paths are ok. My objective is to create ...
1
vote
1answer
699 views

qgis plugin problem: Couldn't load plugin due to an error when calling its classFactory() method [closed]

I am not able to install any plugin. Packages qtwebkit and qt5-qtwebkit are installed on my machine. Below is an example for the error ocurring: Couldn't load plugin 'go2streetview' due to an ...
2
votes
0answers
63 views

Pass attribute to python script with QGIS command line launcher

I didn't find the answer to this question : is there a way for passing attributes to python script when you try to run it from QGIS command line launch : os.system('qgis --nologo --project project....
3
votes
1answer
209 views

Joining a shapefile attribute table to a CSV file pyqgis3.0

I would like to join a shapefile to a CSV file in PyQGIS 3.0. So, when I run the following code, it executes without errors but the join action does not succeed. What is wrong with the following code? ...
1
vote
1answer
30 views

“measureLine” not working in pyqgis 3.0

The following code works very well in pyqgis 2.0 with a line shapefile, but when executed with pyqgis 3.0 the instruction measureLine return 0 and with no errors signaled. What is the new instruction ...
5
votes
1answer
1k views

Getting log error about default locale settings when using GRASS with QGIS?

I downloaded python 3.6, installed it, dowloaded QGIS 3.0.2, installed GDAL, then QGIS, then opened QGIS and tried to use GRASS processing tools. Initially I got the following error: env: python3: No ...
5
votes
1answer
3k views

Installing external python packages for QGIS 3?

While there are tools and methods for qgis 2 i cannot figure out for 3 I want to install external python packages such as sqlalchemy etc I tried the following things : Tried to download osgeo4w ...
1
vote
1answer
183 views

ArcPy Calculate Field Management with Variable

I'm trying to calculate multiple fields that all begin with "B01". This calculation consists of multiplying the fields by a field that contains a percentage ("TractPercent") and then dividing the ...
1
vote
0answers
81 views

QGIS 3, iterate shapefiles to export mulitple pdfs from a standalone python script

I would like to load my qgis project, and a template I made into my stand alone script (in pycharm). I have a folder with shapefiles and I would like to iterate over them, plot each one with the ...
1
vote
0answers
169 views

Install of QGIS3.0 on Mac OSX using KyngChaos prebuilt binaries

The installer doesn't work because it requires Python 3.6 to be installed as a framework in /Library/Frameworks (or so I believe). It is insufficient to have Python 3.6 installed by Macports (in /opt/...
1
vote
0answers
325 views

QGIS3 error Python on launch, Ubuntu 16.4

I installed QGIS3 on ubuntu 16.4. When I launch QGIS I get an error: Impossible de charger PyQt. (Can't load PyQt) Le support Python va être désactivé. (Python support will be deactivate) ...
9
votes
3answers
5k views

OSGeo4W shell with python3

I would like to use OSGeo4W shell with Python3 but when typing python3 I get the following error: Fatal Python error: Py_Initialize: unable to load the file system codec File "C:\OSGEO4~1\apps\...
2
votes
0answers
112 views

Python within OSGeo4W installation gives “AttributeError: '_NamespacePath' object has no attribute 'sort'”

I have Python 2.7 and Python 3.6 installed via OSGeo4W64 on a Windows 10 x64 machine. I don't have a standalone installation of Python, but I did previously, which may have something to do with the ...
2
votes
1answer
316 views

Deactivating QgsMapTool after single map click?

I'm trying that to create a class that inherits from QgsMapTool and deactivates itself after a canvasPressEvent is called. I've tried three options (in the code below) but none of them is working. ...
2
votes
1answer
292 views

How to show label according to attribute name?

I try to show label name according to predefined in QGIS 3.0 by using pyqgis. I used that code in QGIS 3.0 but last update broke it down. Here is my code: settings = QgsPalLayerSettings() ...
5
votes
1answer
207 views

Make ST_Polygonize in Postgis return dangles, cuts and invalid rings

Postgis allows using ST_Polygonize() from GEOS to make polygons out of lines. I have seen the same function available in Shapely library for Python, but in Shapely, the other method named ...
1
vote
1answer
70 views

How to get lattitude and longitude of selected pixels from a raster?

I have have a code which will select some pixels from a raster. Further I want to get Latitude and Longitude information of these pixels and save it in .csv format. import gdal import numpy as np np....
2
votes
1answer
393 views

ModuleNotFoundError: No module named 'QgsComposerMap'

I am trying to import QgsComposerMap in my QGIS3 plugin but I always get this error:ModuleNotFoundError: No module named 'QgsComposerMap'. My import looks like this: from qgis.core import QgsRectangle,...
2
votes
0answers
644 views

Run Python 3 scripts on ArcGIS Server 10.5

Is it possible to run Python 3 scripts on our ArcGIS Server 10.5 running windows? Basically, I have a script that I want to publish as a geoprocessing tool that exports an .aprx (ArcGIS Pro) file to a ...
1
vote
2answers
1k views

geopandas can't import

I've installed geopandas on ubuntu 17.10 and can't import geopandas. I can't find this particular error anywhere. from pyproj import _proj ImportError: cannot import name '_proj' I'm using a virtual ...
1
vote
0answers
214 views

NetworkX read_shp works on Python 2.7 but not on Python 3?

I was trying to implement the same code in Python 2.7 and Python 3.0 opening the same file from the same directory using NetworkX's read_shp function. One, using Python 2.7 IDE and the other is ...
1
vote
1answer
2k views

Converting coordinates of a bunch of polygons in a shapefile which are in UTM to latitude and longitude

My exact problem is that I have a file that report vehicular traffic that has 6 columns and two of these columns are latitude and longitude.for example this is the first row and 45. and 9. are ...
1
vote
1answer
227 views

How to normalize the data mapped on a shapefile in GeoPandas when polygons do not have the same size

I have a shapefile containing the map of Milano that contain square polygons with different size, I mean small, medium and big squares and each square has an identifier and I want to fill these ...
0
votes
1answer
941 views

Understanding ValueError from folium?

I was trying the following line of codes in python (that I learnt from a tutorial), import folium import pandas data=pandas.read_csv("Volcanoes.txt") lat = list(data["LAT"]) lon = list(data["LON"]) ...
3
votes
2answers
8k views

Fill color not showing appropriately in folium?

The following code should have shown different colored circles in a map. But my result was circles with no color at all. import folium import pandas data=pandas.read_csv("Volcanoes.txt") lat = list(...
3
votes
0answers
119 views

QGIS Build error : zzz-db_manager-5-depend error - qgis master 2.99

I am compiling QGIS from master in VS 2015 on x64. I am getting error as : Error MSB6006 "cmd.exe" exited with code 1. zzz-db_manager-5-depend 7 C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\...
0
votes
0answers
1k views

GDAL and JP2: Python3 installation through PIP

I have JP2 files, which I have procured from ESA Sentinel 2 website. I am interested in processing them through GDAL and Python3. I have manageed to install Python3 and GDAL. GDAL was installed ...
1
vote
1answer
59 views

GDAL deletes metedata file when creating GTiff

Reposting question explaining it better. I am doing TOA corrections on Landsat8 Images in Python(3.5) by reading all image_bands and after processing them creating new GTiff of those images with GDAL,...
3
votes
1answer
797 views

How to let ogr/gdal CreateLayer() create a `geom` field instead of `wkb_geometry`?

When creating a new table (PostGIS) using OGR/GDAL (2.1+), is there a way to select a specific name for the geometry field (such as geom), rather than using the default name? I created a new table ...