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.

2
votes
0answers
33 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
25 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
16 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 ?
1
vote
0answers
26 views

Normalizing negative pixel values in a GeoTIFF with GDAL in Python

I have a GeoTIFF pulled from Google Earth Engine. I'm using the following code to see the red values of each pixel: from osgeo import gdal gdal.UseExceptions() ds = gdal.Open(myfile) band = ds....
1
vote
0answers
21 views

How to transliterate in QGIS using Python 3

I am QGIS user but beginner in Python. I figured out how to transliterate Georgian script into Latin using this module (https://pypi.org/project/transliterate/). from transliterate import translit, ...
0
votes
0answers
87 views

Ipyleaflet map object doesn't display in Jupyter Notebook but it gets created

When running the code from the example (https://ipyleaflet.readthedocs.io/en/latest/api_reference/map.html#example), no map get displayed. from ipyleaflet import Map, basemaps, basemap_to_tiles m = ...
4
votes
1answer
101 views

Why does osr.SpatialReference return different values in python2 and 3?

Can somebody explain why the result of osr.SpatialReference() differ between Python 2 and 3? sr = osr.SpatialReference() sr.SetFromUserInput('EPSG:28992') sr.ExportToProj4() In Python 2.7 this gives ...
0
votes
0answers
18 views

Displaying two different folium.map object into same map

I want to show nodes with their avg neigbour attributes and network of these nodes belong. ox.plot_graph_folium returns a folium.map object. "map" is also a folium.map object so when i try to add "...
2
votes
0answers
23 views

Getting Python console in QGIS to do tab completion of file system?

I am trying to have the Python 3 console tab of QGIS 3 complete my file system. I've tried import sys but this does not allow me to do it.
0
votes
0answers
29 views

osmnx using new clean intersection nodes as graph nodes

I want to create a new graph from clean nodes and edges. From that, OSMnx Example #14 Clean Intersection Cluster Nodes, I am able to get the street network and do the processes like shown in the ...
0
votes
1answer
30 views

Getting bounding box from Point type GeoDataFrame to getting data from Osmnx

I've a point geodataframe which has only point features inside of it. fishnet_Id ... geometry 0 0 ... POINT (403486 4540640) 1 ...
0
votes
0answers
41 views

Will Anaconda with Python 3.7 work with Python 3.6.5 environment of ArcGIS Pro?

I just uninstalled my Anaconda with Python 3.6 and need to reinstall, but the current version is now with Python 3.7. Will that work for ArcGIS Pro (Python 3.6.5)? I'll have to copy the ArcGIS Pro ...
0
votes
1answer
33 views

ExecuteError: Failed to execute. Parameters are not valid error when SelectLayerByAttribute run in Python 2.7

I am running a line of code in a Python 2.7 environment using arcpy.SelectLayerByAttribute_management: fl_haz_selects = arcpy.SelectLayerByAttribute_management(S_Fld_Haz_Ar, "NEW_SELECTION", "\"...
0
votes
0answers
23 views

S-52 Symbology in QGIS Standalone script

I have been working with S-57 file and am able to load all layers in a canvas in pyqgis stand alone script driver = ogr.GetDriverByName("S57") dataSource = driver.Open(file[0]) layersList = [] extent ...
0
votes
0answers
14 views

Geoalchmey2 with Flask won't serialize Geometry, tries to serialize “Function”

I'm trying to use GeoAlchemy2 within an Eve/Flask application over Python 3.6.5 and the serialization process fails in an odd manner. Instead of trying to serialize the WKB Element it fails trying to ...
0
votes
1answer
47 views

RuntimeError: Object: Error in executing tool when running Union

I have a list of a 2 layers (nfhl_fld_haz_features, prelim_fld_haz_features) and a feature class (master_merge) that I want to perform a union on: wkflw2_union = arcpy.Union_analysis([master_merge, ...
3
votes
1answer
41 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
51 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
48 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/...
1
vote
1answer
254 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 ...
1
vote
1answer
84 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
27 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
20 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
39 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
52 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
72 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
110 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
506 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 ...
2
votes
2answers
129 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
35 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
129 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
79 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
33 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
354 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
151 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
29 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
96 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
36 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
25 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
35 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
23 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
61 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
46 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
55 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
91 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
190 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
73 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
84 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
78 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
222 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 ...