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
4
votes
1answer
74 views

Differences between OSGEO GDAL and GDAL python bindings?

Question I'm trying to figure what are the differences, and of course, what is the best solution to use, between two python3 bindings: GDAL, imported as import gdal OSGEO.GDAL, imported as ...
1
vote
1answer
59 views

Python user defined function written for ArcGIS Pro returns None when it should return an address?

I am rewriting a 2.7 Python script for compatibility with ArcGIS Pro and organizing it with user defined functions so that I can debug portions of the script as I go. I am new to the process, but I ...
1
vote
0answers
21 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 (...
0
votes
1answer
23 views

Copy FGDB from folder to another folder in Python 3 without ArcPy? [closed]

I found this code here. first time I ran it, it copied my file to another folder but for second time nothing happened. Even I didn't get error in Jupyter Notebook. #Move GDB to G: for your project's ...
0
votes
0answers
27 views

GDAL & Python 3 environment variable

Newbie here. I've just loaded OSX Catalina on my iMac. I've installed GDAL 2.4 complete from the Kyngchaos site. The install works great for all GDAL commands except for the python ones (...
0
votes
2answers
444 views

QGIS “python3.exe: No module named gdal_merge”

I just would like to merge several raster of GeoTIFF but after the QGIS update from 3.3 to 3.4, even this simple tool can´t be used for the same raster anymore. GDAL command:python3 -m gdal_merge -...
1
vote
1answer
31 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 ...
1
vote
0answers
21 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....
0
votes
0answers
20 views

GeoPandas drops .prj file

I'm trying to create a df through a GeoJSON url, merge it with a df created out of a SQL query, and create a shapefile/GeoJSON from the output. The output has everything put the .prj file (in the ...
0
votes
1answer
61 views

Grid polygon generation by converting meter to degree using Python

When given a shapefile as below as an Input, I would like to generate a 100x100 meter polygon grid using python. I went through Creating a regular polygon grid over a spatial extent, rotated by a ...
1
vote
0answers
35 views

Alternative to Rasterio Mask module for clipping a raster using masked geojson

I am clipping a raster (.tif file) using a mask vector (.geojson) file. with rasterio.open(url) as src: out_image, out_transform = rasterio.mask.mask(src, shapes, crop=True) But, this ...
1
vote
0answers
29 views

Find GRASS GIS path on Ubuntu

I want to use algorithms from GRASS GIS in R. One essential step is already providing some serious problems. I managed in some way to install GRASS on Ubuntu 18.04, but now I need to provide the path ...
1
vote
0answers
32 views

Point style with Python MapScript does not work

Software details: CentOS 7, Python 3.6, MapServer v 7.2.1 is compiled from source. I use Python MapScript to build WMS, it works well for styling Lines and Polygons, but not for Points. For example,...
2
votes
0answers
25 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 ...
0
votes
0answers
24 views

Accessing ArcSDE delta tables through Python?

I would like to access delta tables through ArcPy for a QC script that I am improving. Read-only. How could I output a Python dictionary that contains all the rows that were added/deleted/modified ...
2
votes
1answer
31 views

pyqgis create layer from a list of points

I am working with pyqgis in QGIS3 and i want to create a point layer from an intersection beetween a point and a polygon layer. I can identify wich points intersects my polygon layer but i can't use ...
0
votes
0answers
47 views

Completing network edges through an area using osmnx

Context I want to plot a network (i.e. a graph, topologically connected where routing algorithms can be used) from openstreetmap data (this is linked with the python code snippet presented here: ...
3
votes
1answer
50 views

Creating a Line feature in PyQGIS QGIS 3.x

In QGIS GUI, a line feature is created from this icon 1.jpg How to Create a line with a fixed distance from a vector layer in python console. This my example: from qgis.core import * from qgis....
1
vote
0answers
22 views

Pathfinding in mixed network

I have three geopandas GeoDataFrame representing a road network, telecommunication wires and a set of network devices to be connected to the network. They are respectively depicted as yellow lines, ...
0
votes
0answers
65 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
847 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
81 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
103 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 ...
3
votes
1answer
41 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
146 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
52 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
20 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
41 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
53 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
65 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
173 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
38 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
223 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
40 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
116 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
30 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
632 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
98 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
324 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
312 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
181 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
322 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
68 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
48 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
345 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
302 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
331 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
240 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
154 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
55 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....