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

Cannot create geodataframe from feature class due to IndexError: list index out of range

I have a function that helps me read in large feature classes and them create a geodataframe: line_feat = "S_Studies_Ln" cnms_cols = ['REACH_ID', 'STUDY_ID', 'CO_FIPS', 'CID', 'FLD_ZONE', '...
0
votes
1answer
77 views

Why do I get error “Runtime: b'no arguments in initialization list'” when running to_crs?

I have a geopandas dataframe that has POINT geometry in NAD83. I want to use to_crs to change them to espg: 4326. When I first bring in the feature class as a gpd dataframe, it shows no crs, so I use ...
2
votes
1answer
23 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 ...
0
votes
2answers
33 views

Importing ArcPy installed with ArcGIS Pro in PyCharm

I am trying to import arcpy in a script, which is running in a PyCharm environment using the Python 3.6.6 installation that comes bundled with ArcGIS Pro 2.3.2 as the base interpreter. I get the ...
2
votes
1answer
24 views

QGIS 3.8 Python merge files

For a merge operation I need a list of all my layers in the TOC with path and filename. How can I achieve that? layers = QgsProject.instance().mapLayers() # dictionary myLyrList[] for layer in layers....
1
vote
1answer
56 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 ...
0
votes
0answers
23 views

Nest a dictionary in JSON with Python for GeoJSON properties

Using the Python GeoJSON library I am creating a feature collection of MultiPolygons. I cannot find a way to include properties (attributes) in the features. I have tried: features = df.apply( ...
2
votes
0answers
15 views

Preserving provider of original raster layer when it is modified for another resulting raster layer?

A while ago, I asked for a method to assign new QgsRasterBlock objects to a QgsRasterDataProvider objects at Assign new QgsRasterBlock object to a QgsRasterDataProvider object. The reason was for ...
0
votes
0answers
23 views

Can't Open NetCDF file with GDAL module for Sentinel 3 Data

I downloaded a Sentinel 3B SLSTR Sl _L_RBT file and I am trying to open the Band 8 Nadir Thermal Band (S8_BT_in.nc) in NETCdf format. import gdal ds = gdal.Open( 'NETCDF: "/home/aaron/...
0
votes
0answers
47 views

ArcGIS Pro - Python Runtime Error at command prompt

I have been following the example of 'Update Real-Time Data with Python' on https://learn.arcgis.com/en/projects/update-real-time-data-with-python/ but get a runtime error when I run the example from ...
-2
votes
1answer
42 views

Setting up dependencies for PyPi Elevation module?

I am trying to set up pypi's elevation module in Miniconda (Python 3.7.3), but I get the following error when I run the selfcheck: (base) C:\Users\name>eio selfcheck 'GNU Make' not found or not ...
1
vote
1answer
56 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
0answers
26 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: ...
0
votes
1answer
100 views

Getting 'list' object has no attribute using ArcPy for ArcGIS Pro? [duplicate]

I am using ArcGIS Pro with Python 3.6. I'm posting this as a new question because I've made significant headway in narrowing down the problem. I believe the issue is how ArcPy is used with ArcMap ...
1
vote
0answers
29 views

Adding distance when buffering point geometry in a geodataframe?

I have 2 geodataframes that I want to combine. They the same fields/columns but different geometries (one is points, one is polygons).To do this I want to buffer the points slightly (like 10m or ...
3
votes
2answers
73 views

Launch QGIS GUI using batch file and Python 3 - Windows 10

Ultimately I'm attempting to launch the QGIS GUI and run a python script from a batch file. I've reviewed numerous instances referencing similar scenarios on this and other forums but for the life of ...
0
votes
0answers
23 views

QGIS 3 set the active layer [duplicate]

I need to select a specific layer in the layer tree before I run my python script. I have tried Activating layer by its name in PyQGIS? with the code registry = QgsProject.instance() layer = ...
1
vote
2answers
200 views

How to pull values from one geodataframe to populate corresponding column/rows in another geodataframe

I have 2 geodataframes; one made from polygons (bldg_res_df) and one from centroid points (parcel_res_df). I used .concat to combine them into a single geodataframe to do some calculations. df_list = ...
1
vote
1answer
49 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 ...
0
votes
1answer
153 views

Getting latitudes and longitudes in between start and end coordinates and spaced at equal distance

I have a csv file which has the latitude and longitudes values , I need to find the coordinates in between the start and the end latitude and longitude which must be equally spaced at the interval of ...
1
vote
1answer
117 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
129 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
134 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
38 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
1answer
36 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
1answer
32 views

Python3 Replace “/” With “\” [closed]

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 ...
3
votes
1answer
133 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
146 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
113 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
95 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
49 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....
5
votes
1answer
106 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
64 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
54 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
148 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 ...
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
134 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
60 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
86 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
123 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
94 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
83 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
74 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
110 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
122 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
399 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
18 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
35 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
56 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
152 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 ...