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
3
votes
0answers
247 views

LatLon Package python 3.4

Does anybody know a package who work in python 3.4 as "LatLon" Package ? https://pypi.python.org/pypi/LatLon/1.0.1#downloads
3
votes
0answers
1k views

Can't install pyspatialite with python3 and sqlite3 [closed]

I can't install pyspatialite. When I try it gives me this error: pip install pyspatialite Downloading/unpacking pyspatialite Could not find a version that satisfies the requirement pyspatialite (from ...
2
votes
2answers
5k 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. ...
2
votes
2answers
6k 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. The input dataset in ...
2
votes
1answer
58 views

How can I launch a QWidget after pressing a submenu (QAction) in QGis3.4?

I need your help I am developing a dialog box (which I will call toolraster) in QGis to interact with raster layers. I want it to display when I click on a menu I insert in the QGis interface. I ...
2
votes
1answer
603 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 ...
2
votes
3answers
5k 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 = ...
2
votes
1answer
186 views

Geopandas (points) to Numpy Array

I have a geopackage with a point feature. Which contains points along 19 lines. So, the number of points per line is exactly the same. Therefore, I could see it as a matrix in numpy. Moreover, each ...
2
votes
1answer
521 views

Polygon from QgsPoints - QGIS 3.8 python

I'm trying to create a polygon layer from 4 points that I have already defined. There issue here is that I'm always getting the following error: AttributeError: type object 'QgsGeometry' has no ...
2
votes
2answers
303 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':...
2
votes
1answer
315 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: '...
2
votes
1answer
93 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
2answers
1k 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: ...
2
votes
2answers
4k 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 ...
2
votes
1answer
5k views

Zonal Statistics of a polygon and assigning mean value to the polygon [closed]

I have a large shapefile filled with polygons, and a raster of that same area. I need to use Zonal statistics to find the mean value of the area under each polygon and then assign that value to the ...
2
votes
1answer
94 views

Using shapely interpolate to evenly re-sample points on a linestring geodataframe at specified interval

I have a GeoPandas LineString GeoDataFrame. I am trying to evenly interpolate the spacing of the nodes that make up each line, with a couple constraints: keep endpoints unchanged, and specify maximum ...
2
votes
1answer
46 views

Check if polygons of a GeoJSON file are included in polygons of another

I have two GeoJSON files. A province.geojson file and a constituencies.geojson file and I would like to know for each district polygon which province it belongs to. That is to say, for each polygon in ...
2
votes
1answer
572 views

No module named 'arcgis' for import GIS

I have ArcGIS API for Python installed and when I use below line, am getting error as ModuleNotFoundError: No module named arcgis from arcgis.gis import GIS Please refer to Image
2
votes
1answer
316 views

QGIS 3 move layer to group

In the layer tree, I want to move a few layers at root level to a group also at root level. From what I have gathered so far, I have to clone the layer first, add it to the group and then delete the ...
2
votes
1answer
580 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 ...
2
votes
1answer
566 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 ...
2
votes
1answer
685 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 ...
2
votes
1answer
158 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 ...
2
votes
1answer
204 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 ...
2
votes
1answer
993 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
1answer
152 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:\...
2
votes
1answer
417 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....
2
votes
1answer
406 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() ...
2
votes
1answer
459 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
1answer
95 views

Python clipping large shapefile by radius [closed]

I cannot find any real answer so I'd like to ask how to crop shapefile with roads in Python. The goal is to leave roads (nodes) in black circle only, then output that to dataframe in geopandas (...
2
votes
1answer
89 views

ArcPy UpdateCursor: How to find specific row index of dictionary key/value difference?

I have a Python script that hits a REST API and grabs attribute data for rooms in buildings from an IBM Tririga DB. I have an Enterprise geodatabase rooms feature class populated with these same ...
2
votes
1answer
243 views

Transforming geometry points coordinates to WGS84 in geodataframe

I have shapefile that has been brought into my script as a geodataframe. Initially, it shows no crs although the source originally had a datum = NAD83. I want the coordinates for the geometry (the ...
2
votes
2answers
4k 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 ...
2
votes
1answer
514 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
0answers
31 views

Stand-alone PyQGIS (QGIS 3.13) scripts with OSGeo4W and the Orfeo toolbox (OTB 7.1.0) seem to be mutually exclusive

I am changing my python environment from working with ArcGis and Arcpy to working with QGIS and PyQgis. And I also want to use the machinelearning possibilities from the orfeo toolbox. In doing so I ...
2
votes
0answers
51 views

Problem when trying to cut linestring at multiple points after conversion from Multi-linestring

This is my script: def cut_line_at_points(line, points): ''' line is gdf format points are series of points in gdf format ''' # union all geometries - convert the gdf to shpely (...
2
votes
0answers
53 views

OSMNX KeyError when trying to compute edge_centrality on a graph composition

Context: I am trying to merge several different graphs (some sharing nodes with others) downloaded from openstreetmap using omsmx. While storing these different graphs in a list, I use the nx....
2
votes
0answers
42 views

How to change a widget type of a field by using python

I'm working on a plugin for QGIS 3.x and I'm looking for an example how I can change the widget type by using Python code. The change should be applied on fields of a vector layer. At the end it ...
2
votes
0answers
55 views

Resolution for different layers using Python GDAL

I'm extracting data from a GRIB file using GDAL in Python 3 on CentOS. The model is 40 km resolution, and is usually 151x93. When I try to extract data from band 195, I get the following error: ...
2
votes
0answers
382 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 ...
2
votes
0answers
110 views

Identify partial intersections between a polygon layer and a line layer using PyQGIS

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 ...
2
votes
0answers
2k 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 ...
2
votes
0answers
50 views

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

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.
2
votes
0answers
77 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....
2
votes
0answers
128 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
983 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
1answer
261 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 ...
1
vote
1answer
434 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 miniconda and the database with PostgreSQLPortable-10.1.1. Now I have already ...
1
vote
1answer
374 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
2answers
389 views

Terminology for distinguishing ArcPy installed with ArcGIS 10.x for Desktop from that which comes with ArcGIS Pro?

ArcGIS Pro uses Python 3 whereas the other ArcGIS for Desktop applications (ArcMap, ArcCatalog, ArcScene and ArcGlobe) use Python 2 and the changes introduced with ArcGIS Pro were significant ...