Stack Exchange Network

Stack Exchange network consists of 174 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
0answers
14 views

Relative file paths for outputs

After looking at several similar questions on making relative file paths, I have some confusion on how to apply a relative file path for the outputs in my script. I have an application folder called "...
3
votes
1answer
26 views

Get xy coordinates of QgsMapCanvas in PyQGIS 3?

I am trying to get the QgsMapCanvas coordinates when they change using PyQt5 and PyQGIS 3. What I have used for that: self.canvas.scaleChanged.connect(lambda: self.showScale(self.canvas.scale())) ...
1
vote
1answer
38 views

S57 Driver doesn't support update Error

I am trying to load S-57 file with pyQGIS with code below self.canvas = QgsMapCanvas() # self.canvas.useImageToRender(False) self.canvas.show() # Lay our widgets out in the main window using a # ...
0
votes
2answers
47 views

Weird cursor issue

Lets say I have a temp layer made out of selected items from another layer and I am trying to look through 2 attributes in that layer with searchCursor: union_test = "C:/Workspace/Sandbox/...
0
votes
0answers
24 views

Querying attribute table in QGIS to return sum of subset?

I am using Jupyter notebook to query a dataset too big to be opened with excel and my pc is too slow to perform calculations directly on QGIS. My logic is as follows, after imported pandas: x = df[(...
1
vote
1answer
26 views

Uninstalling and Reinstalling Anaconda

I had 2 versions of pandas (22 and 23) in my Anaconda environment for Python 3.6. One of the pandas looks like it was installed through Python 2.7 pip. Basically, I am unable to import pandas at all ...
0
votes
0answers
9 views

Finding cities,countries name from the text data [duplicate]

How can I tag cities, countries in my text data which does not start with capital letter. Example: from geotext import GeoText places = GeoText("transaction from kolkata to pune") places....
1
vote
1answer
29 views

Using output statistics in ArcGIS REST API query?

I am using an API to pull in some Web Mapping Service Layer data to my script. The API query has a max count limit of 1000 on returned features per request. There are 2 attributes I am trying to use ...
1
vote
1answer
19 views

RuntimeError: General function failure when running arcpy.da.SearchCursor

I have a script that was previously working but just started throwing an error out of the blue. Here is the traceback: Traceback (most recent call last): File "<ipython-input-68-be384b1c4968>...
0
votes
1answer
19 views

Making the results from function a string [closed]

I am trying to get the features count from feature, then put it in a dictionary that I can call later: ct_dict = dict() ... fipsList = ['13245','06007'] for fip in fipsList: mergedJoinCentroids =...
0
votes
1answer
36 views

Can Python 3.6 Script be turned into tool that will work in ArcGIS Desktop?

I have a Python 3.6 script that I want to turn into a tool for that I can use in ArcMap (10.5). Will that even work or will I strictly have to do it in ArcGIS Pro? I couldn't seem to find any ...
0
votes
1answer
47 views

SearchCursor not reading the last row

Let's say I have a layer made up of pre-selected features from another layer: selects = arcpy.SelectLayerByAttribute_management (S_FIRM_Pan, "NEW_SELECTION", "DFIRM_ID = '{}'".format(fipC)) If I get ...
1
vote
1answer
34 views

Get QgsLayoutItemMap from existing QPT Layout

I created a QPT model with a map inside QGIS. The problem is when I try to select the map under pyQGIS : qpt = QDomDocument() qpt.setContent(content) layout = QgsLayout(QgsProject().instance()) ...
0
votes
0answers
37 views

How to populate a div with hover text in bokeh?

I am developing a geographical dashboard in bokeh. It is fairly easy to use hover tooltip in bokeh, however I want to populate a div when I hover on a field. Python version : 3.5.2 Bokeh ...
0
votes
0answers
158 views

Error in coordinate transformation with Geopandas

I am trying to transform coordinate system of shapefile. %matplotlib inline import matplotlib.pyplot as plt import pandas as pd import geopandas as gpd from geopandas import GeoDataFrame from ...
1
vote
1answer
39 views

Getting a county name using a 5 digit FIPS code

Lets say I have a five digit fips code: '13245'. I have a dictionary to handle know that the 2-digit state part of the code(ex: {'GA':'13', etc...}). But I want to also get the full county name (EX: ...
0
votes
2answers
34 views

Getting dates from an attribute table

I'm using the following to get a list of dates in a field called "EFF_DATE" from an attribute table for some pre-selected features. selectDates = [row[0] for row in arcpy.da.SearchCursor(selects, "...
0
votes
0answers
62 views

Profile FileNotFoundError: [WinError 2]

I've been working with ArcGIS module in python trying to connect to the portal in an intelligent manner. I tried to create a profile so that I wouldn't have to leave my username and password to the ...
1
vote
1answer
75 views

Assigning an ID to each pixel which overlaps with polygon shapefile (Python)

I calculated NDVI values for the last 24 years and created Pandas Dataframe which every cell includes columns with XY coordinates and 24 NDVI values. I have several polygon shapefiles which overlap ...
1
vote
1answer
32 views

Using the results of geoprocess function in another geoprocess function

I have a list to hold the iterated results of running arcpy.MakeFeatureLayer and 'arcpy.CopyFeatures` geoprocesses. selectList = [] fip = '13245' for fc in featureclasses: select = arcpy....
0
votes
1answer
104 views

TypeError: unhashable type: 'dict' when using shapefile with arcpy_metadata module

I am having an issue with the arcpy_metadata module. I have a simple shapefile I am trying to load into the MetadataEditor: import arcpy, os, sys,env import arcpy_metadata as md myfeatures = "C:/...
1
vote
1answer
56 views

Using Python to create xml metadata files for different file types

I have a folder with 3 subfolder, each having a different type of data. Folder_A and Folder_B have standard shapefiles (about 3 shapefiles in each folder). Folder_C has .tif grid files (about 100). I ...
0
votes
0answers
20 views

How to get pixel position of a location, given latitude and longitude, in Python 3? [duplicate]

I have a sentinel-1 GRD product, downloaded from Copernicus. I have used a shapefile created in QGIS and used 'gdalwarp' to crop it. Now, I'd like to open that file in Python using gdal or some other ...
4
votes
1answer
83 views

Weird schema lock issue

I wrote a Python script that produces several output features layers in separate .gdb's. As I am testing and modifying my code, I generally go into arcCatalog, find the .gdb under which the feature ...
0
votes
1answer
28 views

Difficulty using variables as input parameters for arcpy.Intersect_analysis

I have 2 variables created from a previous geoprocesses: fc = arcpy.JSONToFeatures_conversion("cslf.json", os.path.join("cslf.gdb", "cslf")) selectFeatures = arcpy.CopyFeatures_management(select, "C:\...
1
vote
0answers
18 views

How can I install a python 3 module for its use in QGIS3 in Windows?

I've been struggling to install BeautifulSoup4 for a Python script I want to share with Windows users, but I just can't get it installed for its use in QGIS, I've tried pip install BeautifulSoup4 ...
0
votes
1answer
29 views

Dataset '{}' does not exist or is not supported in arcpy

I am trying to insert some variable into a simple arcpy call using .format(var1, var2) as I would in a string. I am new to using Python 3.6, so maybe there's been some change in how this is done. When ...
1
vote
1answer
21 views

Selecting a feature by field value

I have a layer called 'Colorado' that has an attribute 'FIPS_CODE'. The values are numbers as a string. I am trying to use arcpy.SelectLayerByAttribute_management inside my Python script to select the ...
0
votes
0answers
21 views

Getting attribute data from a GeoJSON file

I have a JSON file that I am trying to pull specific attribute data from. Before the data is turned into a file, it is first held in a variable like this: params = {'f': 'json', 'where': '1=1', '...
0
votes
0answers
26 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
30 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
62 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
80 views

Problem converting qrc file into py one by PyQt5

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
34 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....
3
votes
3answers
80 views

SQL Query Syntax Issue

I'm writing a script that will cycle through a shapefile of building footprints for an entire state, create a folder for the individual counties in that state, and then intersect the building ...
0
votes
1answer
43 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
108 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
158 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
67 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 ...
1
vote
2answers
109 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 ...
0
votes
0answers
61 views

use python3 with osgeo4w shell and missing py3_env

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
60 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
33 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 ...
1
vote
1answer
139 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
81 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....
0
votes
1answer
17 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
76 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....
0
votes
0answers
103 views

Time series values extraction from a 3D (lon,lat,time) NetCDF file using Python

I want to extract time series from a netcdf file which contain, Data variables: time_bnds (time, nb2) float64 ... pr (time, lat, lon) float32 ... at specific lon/lat points.The 'pr'[...
0
votes
1answer
95 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
53 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 ...