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
2
votes
1answer
39 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 ...
0
votes
0answers
9 views

Programmatically remove default shortcut of Locator

Using Python, how may I go about changing or removing the default shortcut of the Locator? I have a list of desired_shortcuts that I leverage as a comparison point against QGIS defaults to remove ...
0
votes
0answers
9 views

AttributeError: module 'gdal2tiles' has no attribute 'generate_tiles'

I'm trying to use gdal2tiles inside a python script and I'm following this example. Then I've writed my custom script and I've started my custom conda environment: options = { 'zoom': (12, 22), ...
1
vote
0answers
9 views

Problem in distributing GDAL in stand alone application

I'm desperate with the distributing problem of gis packages each time. It is the third day that I'm desperately trying to make an .exe using Pyinstaller to a small application I developed using GDAL ...
0
votes
0answers
8 views

Linear projection going astray

I have developed a tool that tries to find a path connecting a set of telecommunication network equipment along a given road network. Since the equipment is located at various distance from the road ...
1
vote
0answers
39 views

Load layers for viewing in QGIS 3 from delimited text

I am trying to use part of a script to add points from a delimited text file, however, when I use it the layers are not loaded on the screen and not saved in the path indicated as .shp import os ...
1
vote
1answer
62 views

Create an ESRI Shapefile from WKT with OGR

I want to create an ESRI Shapefile layer from a CSV file. In my CSV I have several attributes (text, numeric) and geometry in WKT style. I have a problem with the geometry field wich is truncated to a ...
1
vote
0answers
31 views

Exception for error produced while running arcpy.MakeXYEventLayer_management method

I am using Python 3.6.8 to make an XY Event layer. I first use the arcpy.MakeXYEventLayer_management(inputCSV, "Longitude", "Latitude", TempFeatureLayer, WGS84, "") where TempFeatureLayer is defined ...
2
votes
1answer
112 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 ...
1
vote
1answer
68 views

Can one use ArcPy with Python 3.7 instead of default Python 2.7 that comes with ArcMap 10.6.1?

I want to use arcpy with Python 3.7. I tried setting the paths to arcpy but Python 3.7 doesn't import arcpy properly. Is it possible to use a Python version outside of default version that ships with ...
2
votes
1answer
69 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 (...
1
vote
1answer
115 views

Transform geospatial data from decimal degrees to x,y coordinates using pyproj in Python

I have the following dataframe latitude longitude xx yy 0 37.75153 -122.39447 553343.041098 4.178420e+06 1 37.75149 -122.39447 553343.069815 4.178415e+06 2 37.75149 -...
3
votes
0answers
133 views

OSError - cannot import geopandas

While trying to import geopandas error occurs: Exception has occurred: OSError Could not find lib geos_c.dll or load any of its variants []. I downloaded GDAL and fiona for Python 3.7 from this ...
1
vote
0answers
43 views

Merge two maps only at the boundaries with python code

I have two maps one is normal cluster map and other is a grid map. I want that only at the boundaries the cluster map should follow grid map. Refer to the image, map in violet is my cluster map and ...
0
votes
0answers
34 views

Using qgis.core in anaconda environment

I am trying to use qgis.core in a Conda Environment with qgis, PyQGIS and Python 3.7 installed. I get over an over the next error: File "C:\Users\dg\.conda\envs\env_p3\Library\python\qgis\core\...
2
votes
1answer
238 views

Merging a geodataframe and pandas dataframe based on a column

I have a simple geopandas dataframe that includes geometry and a column called 'MUKEY': merged_spatial_df.head() I want to merge it to a tabular (.csv) pandas dataframe (which also has a column ...
1
vote
0answers
22 views

Generate tiles when creating tile Layer on ArcGIS Enterprise Portal

I have a raster (TIFF) that I want to publish on my ArcGIS Enterprise Portal. To reach that aim, I followed these steps : 1) Create SDDraft from TIFF in ArcGIS Pro project 2) Create SD file from ...
4
votes
1answer
176 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
78 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 ...
2
votes
0answers
41 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
28 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
1answer
104 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
4answers
899 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 -...
2
votes
1answer
71 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
0answers
41 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....
1
vote
0answers
68 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
245 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
93 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
60 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
39 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
37 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 ...
1
vote
0answers
27 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 ...
3
votes
1answer
94 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
108 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
197 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
26 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
157 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
2k 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
206 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
250 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
50 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....
2
votes
1answer
351 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
78 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( ...
3
votes
0answers
28 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
69 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
1answer
87 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
125 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 ...
2
votes
1answer
441 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
51 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
388 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
2 3 4 5