Questions tagged [python]

Python is an open source interpreted programming language used in many GIS programs.

Filter by
Sorted by
Tagged with
0
votes
0answers
15 views

Python Error Using qgis2web

I do not know Python, but I am trying to use the qgis2web plugin to create an interactive map. I was following the steps but got this error when following the published steps. WARNING Traceback (...
0
votes
1answer
16 views

Python GDAL: Clip rasterfile with multi-polygon shapefile

I am trying to clip a raster file with a multi-polygon shapefile to get separate clipped-raster file for each polygon with its 'id' as part of the name of clipped-raster file. I tried the following ...
1
vote
1answer
23 views

Nested for: Outer for doesn't iterate

I wrote a code with a for nested inside another for. When I execute the code, the outer for starts with the first feature, runs as expected, then gets in the second for, runs it as expected, but then ...
0
votes
0answers
25 views

Creating shapefile of concentric circles around point on map using Python

I am trying to model sound propagation from a moving sound source. I have a csv file with lat, long of the source with timestamps every 10 seconds. What I'm trying to do is draw concentric circles ...
0
votes
0answers
29 views

Georeferencing PNG image by GDAL in QGIS

I am not familiar with GDAL so far. Thereby I don't know how to start. By knowing the problem from the question below: Georeferencing PNG image in QGIS when the coordinates of image corners are known ...
0
votes
0answers
17 views

Error publishing PostGIS layer to GeoServer using Python gsconfig library

I am unable to publish a PostGIS table as a GeoServer layer using the gsconfig library. I was able to create a workspace, data store but was unable to publish layers in the store. While running the ...
2
votes
1answer
24 views

Checking attribute condition using two unequal dataframes and then applying spatial join

I am having a problem with checking attribute condition whether the attributes match in two separate dataframes and then applying spatial join. Little background: I have two dataframes. DF1 = ...
1
vote
1answer
24 views

Find grid cells which overlaps polygons using GeoPandas

I have two shapefiles: First one is polygons; Second is grid file which divides the territory in equal squares. Each grid cell has its corresponding number. I need to get the shapefile of grid cells ...
2
votes
0answers
27 views

Performance problem with getting average pixel values within buffered circles

I have a EPSG:4326 raster file with pixel size of 15 arcseconds, and a list of longitudes and latitudes. For each pair of coordinate, I want to create a buffered circle of X kilometers surrounding ...
0
votes
0answers
9 views

Can't rename old dataset and import/upload new one with the original name: Skipping Ghost Tables linking

I'm trying to run a script that renames the existing carto dataset to {CARTO_DATASET_NAME}_previous and then uses the import api to upload a file with the original name {CARTO_DATASET_NAME}. The ...
0
votes
1answer
20 views

AttributeError: module 'processing' has no attribute 'runAndLoadResults'

I'm trying to run QGIS standalone app using processing.runAndLoadResults and keep getting this error: AttributeError: module 'processing' has no attribute 'runAndLoadResults' I'm working on MacOS i ...
0
votes
1answer
38 views

Access ArcGIS Python environment, installed via in Anaconda Navigator, from .bat script in normal cmd window?

I'm trying to run a Python script (shapefile_upload.py) which uses ArcGIS libraries. I installed the ArcGIS libraries by following exactly these instructions. The Python script uploads a shapefile to ...
0
votes
0answers
11 views

ETGeoWizards in Python takes no arguments

I have an ETGeoWizards license (11.8) and have created a simple Polyline to Points task in ModelBuilder (it runs in ModelBuilder). When I export to python and run I get the following error: "...
0
votes
0answers
13 views

How to define spatial information on a floοr plan? [closed]

In an interview, I was asked the following question: You have a plan of a building plan with three floors, the dataset doesn't have any any spatial information, but you know the location of the ...
0
votes
0answers
27 views

Python script to turn off a checkbox in all layers in ArcGIS Desktop

I need to remove the check for all the layers on a map that has the "UT Simbology" check. I am not really sure If I could use update layer because this is an extension developed by a GIS ...
1
vote
1answer
31 views

Adding new provider to QgsProviderRegistry.instance().providerList() using PyQGIS

I'm trying to get vector layer from arcgisfeatureserver in a standalone app, didn't work, so I checked what providers I got on PyCharm: ['gdal', 'memory', 'mesh_memory', 'ogr', 'vectortile'] While in ...
1
vote
1answer
25 views

Can GeoPandas accept lists as property values?

Properties in GeoJSON features can be lists (or "arrays" in Javascript). For example, the following GeoJSON feature is formatted correctly, and includes a values property that is a list: { ...
0
votes
1answer
33 views

Adding a custom file type in GeoServer

I am trying to add a non-spatial (user-defined) file type, with a .zzz file extension, into GeoServer. This file type has no spatial content but as per requirements, I need to store as a Geonode layer....
0
votes
0answers
32 views

Unable to perform zonal statistics in Python because of affine error

I have a raster layer and a polygons layer I want to use for zonal statistics, however these two files may be in a completely different projection and CRS. I am trying to use the following python code ...
2
votes
1answer
45 views

Unable to write raster from array using rasterio

I have two raster files, raster1 and raster2. I want to take raster1 and divide it by raster2 and produce an output raster for this calculation. I am using python and the rasterio package. For info on ...
3
votes
0answers
61 views

Decoding polyline in Python

By making Google Maps API call I received a response JSON which contained this polyline: ezdvBcps}Lt@W@F@BVKl@UK]Wc@}@kAOKBEzA{BdA}Ab@s@LBf@RjARZBv@?rAAfBIX?f@FLBf@^b@hATbAF~@BvB?hALjBHpCLjAVdAd@...
-1
votes
0answers
19 views

Installation error of Geopandas [duplicate]

How can I install GeoPandas in PyCharm. I tried to install GDAL first and GeoPandas but nothing works. I'm getting installation failed error. The error is 'installation failed, you need Visual Studio ...
0
votes
1answer
27 views

Folium and heatmap is not opening in pycharm

I'm using PyCharm version 3.7. When I tried to open simple folium map I'm not getting any output. I tried something like this import folium import pandas as pd import csv dataframe=pd.read_csv("...
0
votes
0answers
34 views

Unable to divide rasters through gdal_calc.py because of unicode error

I am trying to use python in Jupyter Notebook to divide raster file A by raster file B. I am trying to use the gdal_calc.py program in a Jupyter Notebook cell, and not in the command line, and so I am ...
2
votes
1answer
94 views

Rasterio. Pixel value of a point X km away from current point

I have a EPSG:4326 raster file with pixel size of 15 arcseconds, and the longitude and latitude of a point. dataset = rasterio.open(url) lat = 5.535456 lon = 7.531536 I know I can retrieve the ...
-1
votes
1answer
58 views

Installation error of GeoPandas in PyCharm

How can I install GeoPandas in PyCharm. I tried to install GDAL first and GeoPandas but nothing works I'm getting installation failed error. The error is 'installation failed you need visual studio to ...
0
votes
0answers
40 views

Improve the Python code used to open external files, if any, through the QGIS actions

Working environment : Windows 10 and QGIS 3.10.14 LTR (standalone old repository) Problem : in a shape file of points, representing signals, the column "Code" of the attributes contains the ...
3
votes
1answer
39 views

What are the GeoPackage metadata conventions supported in GeoServer?

I'm trying to find information on how best to write metadata into a multilayer GeoPackage so that it can be read into a GeoServer instance. My chain of treatment would be to: Modify layers in an ...
-1
votes
0answers
28 views

Selection of neighboring buildings of different heights [closed]

I am working on a layer of buildings indicating the height of these. I am looking for a method that would allow me to select only contiguous (or neighboring) buildings of different heights (see 1 and ...
0
votes
1answer
18 views

Run FUSION/LDV programs from Python

I have been working with FUSION/LDV: Software for LIDAR Data Analysis and Visualization for LAS data processing. Particularly I am using such commands as GridSurfaceCreate - to create a gridded ...
0
votes
1answer
31 views

Python Gdal: Count pixels having a specific range of values [closed]

I have few hundred raster files and I want to count the number of pixels having values within a specific range. Following code works well when using == operator e.g., raster_file == 25, but gives ...
0
votes
1answer
19 views

Raster into PolyLine with Python

I have got a binary raster and I want to create a shapefile with PolyLines based on this raster. The only success I achieved is a shapefile with Polygone geometry (below). I did it with rasterio and ...
4
votes
2answers
87 views

Shortest path touching all points

I am looking for a solution to derive the shortest route that touches all the points using Python. Please note that This is not a Travelling salesman problem (TSP), in which the route should end ...
1
vote
1answer
19 views

Most efficient way to merge all .asc files to avoid memoryerror

Most efficient way to merge all .asc files to avoid memoryerror. gpw-v4-population-count-rev11_2020_30_sec_1.asc gpw-v4-population-count-rev11_2020_30_sec_2.asc gpw-v4-population-count-...
0
votes
0answers
14 views

HTTPSConnectionPool(host='api.opencagedata.com', port=443) error

While getting latitude and longitude from opencage.geocoder import OpenCageGeocode I am getting HTTPSConnectionPool(host='api.opencagedata.com', port=443): Max retries exceeded with url: /geocode/v1/...
0
votes
0answers
24 views

Preprocessing protocol to derive wavelength from slanted wave profile [closed]

I am trying to derive a wavelength from sediment wave profiles. In some instances with the data, the sediment waves occur on a slope. This slope can be straight or curved depending on each instance. ...
1
vote
2answers
66 views

Setting CRS/SRID using the to_postgis function with GeoPandas?

So, I'm trying to update a PostGIS table after doing some reverse geocoding and other column manipulation I'm running into the find_srid() - could not find the corresponding SRID error. Based on my ...
2
votes
0answers
16 views

Detect land type and adjust polygon area - Python

In my application, I have some code that draws a circle around a point on map. I am using Mapbox to render the map and a python function that takes a geopandas DataFrame, lat, longs, radius as ...
1
vote
1answer
31 views

How to convert from OGR geometries (with M-values) to shapely geometries (without M-values)?

Main question Suppose I have a few OGR geometries, all of them containing M-values. Is there a generic solution that allows me to translate them to Shapely geometries without M-values? Shapely and M-...
2
votes
1answer
29 views

Why is ImageReducer needed here to extract bands from an image?

I'm using Earth Engine with Python, and while I finally managed to find an answer here that helped me troubleshoot my problem, I am not sure why it worked, and that makes me concerned that I may be ...
2
votes
1answer
34 views

Convert area between LineStrings to Polygon in shapely

I need to create a Polygon from the area enclosed by four LineStrings with real world data in shapely. In this example, I want to polygonize the area between b1, b2, t1 and t2. import shapely.wkt b1 = ...
1
vote
1answer
32 views

Geopandas to_postgis function returning no valid geometries error with table that originated in PostGIS

So, I apologize in advance as there's probably better ways to approach what I'm doing and I'm new to Python. I'm trying to update a PostGIS table with newly appended columns from reverse geocoding and ...
4
votes
2answers
73 views

Running the GRASS algorithm in standalone Python code using the PyQGIS processing module

What is the right way to import GRASS algorithms for a standalone Python script? I tried the solutions (solution1, solution2), but they didn't help me. Here's the code that doesn't import GRASS ...
0
votes
0answers
32 views

Unable to rasterize polygons within for loop in Python

I have a shapefile with many polygons, with three separate attribute value columns as "colors": Blue, Red, and Green. For each color, I want to rasterize each individual polygon with that ...
0
votes
0answers
96 views

Writing to geodatabase as feature layer with GeoPandas

I am using data bricks to write a GeoPandas data frame into geodatabase (PostgreSQL). I like to see the GeoPanda data frame can be present as feature layer. ## So far this one can write to geoDB but ...
0
votes
0answers
22 views

Clockwise sorting segments of a polygons

My polygons are divised into an array of lines features. Each segments have only 2 coordinates. I would like to sort those segments clockwise starting from the top-right (north-east) like in the image ...
1
vote
1answer
22 views

"ValueError: negative dimensions are not allowed" when using raster created from points in CSV

My problem is similar to "ValueError: negative dimensions are not allowed" when using raster created from NetCDF I am working on a raster that I generated from the interpolation of some ...
0
votes
0answers
15 views

GeoPandas: assigning unique colors and labels to entries

I would like to plot a map with colors that depend on a categorical variable, i.e. a column with integer number labels (0, 1, 2, ..., 10 for example). Using gdf.plot(column=categorical_variable) I am ...
0
votes
0answers
33 views

Make request to REST services when HTML services are blocked

Is there a way to request ArcGIS REST services when HTTP access is blocked? error 403 forbidden access I was using Python to get the data from the ArcGIS MapServer but they blocked HTTP access so ...
0
votes
0answers
24 views

Query ASCII Rastor format data data in gpw

I have downloaded this from website gpw-v4-population-count-rev11_2020_30_sec_1.asc gpw-v4-population-count-rev11_2020_30_sec_2.asc gpw-v4-population-count-rev11_2020_30_sec_3.asc gpw-v4-population-...

1
2 3 4 5
212