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
40 views

Field length in geopandas shapefile output

I am converting an excel sheet to .shp via pandas i.e. I have a dataframe with 150+ columns and ~900 records (increasing by about 50 every day), that I convert to geodataframe and export to shp: ...
2
votes
1answer
38 views

Shapely strange splits when splitting LineString and Polygon

I noticed a strange behavior while splitting a LineString with e Polygon: in the below image I have a Polygon (in green) and two lines. If I split the blue Linestring with the polygon the result of ...
0
votes
1answer
28 views

Regression between reflectance at pixel value vs input daily data over image collection

I have been trying to make a raster of regression values between reflectance value vs input data at each pixel position in a collection (So, for example the R^2 relationship between daily average ...
0
votes
0answers
11 views

CSV with geometry column in JSON format to GeoDataFrame [duplicate]

I have a csv, that I want to open as a GPD, the problem is the geometry column "geo_shape" I want to convert that column to the proper geometry format, could you help me? The link to the ...
0
votes
0answers
33 views

Creating plots for each hour of each day with Python

I am trying to create an animated map (by generating multiple plots) of road traffic throughout a week, where the thickness of roads is represented by the volume of traffic at a specific time of day. ...
0
votes
1answer
26 views

How to plot coordinate system from EPSG 4326 on north pole centered map in Python?

I have the following pandas dataframe (df) which looks like this with column headers and data values, 3 points each: temperature: array([-101.6015625, -100.9296875, -85.4296875]) latitude: array([32....
0
votes
0answers
28 views

Clipping ENVI files loses information in header (.hdr) file

I have created a command-line operated python-script to cut AVIRIS imagery with polygons. I do this by using rasterio to load the imagery and fiona to load the polygon. The AVIRIS imagery comes in two ...
1
vote
2answers
19 views

Geopandas and Matplotlib Plotting error

I am trying to plot a point on top of a shapefile. the Coordinates of the point are accurate. I verified it using the go to XY tool of ArcMap. but when I try to plot overlay using Python the location ...
0
votes
0answers
20 views

Getting a rotated shape when I change projection using GeoPandas

I have a GeoPandas dataframe that I can properly plot f,ax=plt.subplots() myGdf.boundary.plot(ax=ax) If I change projection I get, a rotated geometry of 90 degree. myGdf1 = myGdf.to_crs({'init': '...
1
vote
0answers
18 views

Return Geometry in a Pandas Dataframe Google Earth Engine

I have found some sample code that returns features from a GEE image to a pandas dataframe based on specific points in my feature collection. The challenge is I need the geometry on these points to be ...
1
vote
1answer
69 views

How do I get zipcodes from longitude and latitude on python?

I have a data frame of latitude and longitude coordinates on this CSV file:Longlat. I used this code to try to get the zipcodes: import copy def get_zipcode(df, geolocator, lat_field, lon_field): ...
0
votes
1answer
15 views

Converting 4 Band RGBA to 2 Band LA (Gray + Alpha) mode while keeping georeferenced data in GeoTiff

I created some GOES-16 images where the dark/night side of the visible image is transparent (alpha channel). I used satpy's DayNight Compositor to make the night side of the image transparent, while ...
1
vote
0answers
16 views

Convert transparent black to white with only GDAL

I have an RGBA foo.tif with NoData Value=0 on all 4 bands. Unfortunately values that are transparent black (0 0 0 0), when converting to jpg, become black instead of no data becoming white like I ...
0
votes
0answers
30 views

Create Geotiff from a dataset array in Polar Stereographic projection using gdal python

I have arrays of lat and lon on polar stereographic projection and I want to generate a Geotiff file on stereographic projection PROJECTION["Polar_Stereographic"], PARAMETER["...
1
vote
2answers
33 views

Detecting if a point is inside a polygon with Python 3 and OGR

I am working in Python 3.7 using ogr to check if a point is inside a polygon. Here I put the code. The result in geom is not compatible with the tuple list data type used by the point_inside function. ...
1
vote
1answer
69 views

Getting geo transforms (affine) without a TIFF reference image

I have a binary mask with buildings' footprints. What I have is a latitude and longitude of the center of my image and I want to georeference each polygon first. And here is what I have done before: ...
0
votes
1answer
25 views

Python QGIS, attribute values are saved as NULL using actionAddFeature().trigger()

I am new using python in QGIS. I was trying to create a simple plugin in QGIS to create a new shapefile with a single attribute 'id', start the edition mode, and add new features manually on the ...
0
votes
0answers
18 views

FutureWarning: Sorting because non-concatenation axis is not aligned. Converting a Google Earth Engine Dataset into a Pandas/Geopandas Dataframe

I am trying to get a pandas or geopandas dataframe returned from a Google Earth Engine FeatureCollection for specific point data. Basically like a spatial intersect where all values from the feature ...
0
votes
1answer
32 views

python-qgis was not found while installing QGIS on Linux Mint

I am trying to install QGIS on my Linux Mint 20.1 Cinnamon, using this: https://freegistutorial.com/how-to-install-qgis-on-linux-mint-19/ But when trying to sudo apt-get install qgis python-qgis qgis-...
2
votes
0answers
90 views

Split Raster Missing Data

I have a code that will read a .tif and split the image into a specific number of rows and columns (code 1). I modified it to be able to be able to easily set the wanted image size (by pixels) (code 2)...
0
votes
1answer
56 views

How can I set the CRS of a point with shapely

I am working on a tool, which transfers data, including geometries, from different legacy databases to postgis. Currently this means I have a MS-access Database, which contains point geometries, but ...
0
votes
0answers
26 views

Angle in minimum_rotated_rectangle [duplicate]

I have a simple question, but I can't find the answer I am looking for the principal angle of a minimum_rotated_rectangle polygon in relation to a latitude or a longitude. df4....
0
votes
0answers
20 views

How to work around rasterio installation issue below

I'm trying to install the rasterio python package using the conda package manager. But when I try to do this in a new clean conda environment, I get an "Found conflicts!" error with no ...
0
votes
0answers
14 views

QGIS - Create Garmin Custom Map plugin - Python Error

I am trying to create a KMZ file using the Garmin Custom Map plugin and at times it fails to execute (and I haven't been able to establish a pattern). I get an Python Error, and the map will not be ...
0
votes
0answers
28 views

Weird differences between basemap rotate_vector and Cartopy transform_vectors

I define a Lambert Conical Conformal in both Cartopy and Basemap import numpy as np from mpl_toolkits.basemap import Basemap #Cartopy: lam2 = ccrs.LambertConformal(central_longitude=-2....
1
vote
0answers
41 views

How to download buildings data from OSM with a polygon (shapefile) as the bounding box?

I am struggling to complete this task. I am trying OSMnx which can be used to download data from OSM above however I am getting an error when using its from_polygon feature when trying to download ...
0
votes
0answers
58 views

Installing GeoPandas on Apple M1?

I have the new Macbook Pro M1 with BigSur. I have installed miniforge via new Homebrew (compatible for M1 chips). Then I created a new conda environment and then installed few libraries, one of them ...
1
vote
2answers
44 views

Splitting line GeoDataFrame basing on given lengths

I am trying to split line GeoDataFrame into sections. I have lengths on which splits should be made stored in column. My idea was to generate points along the line using shapely.ops.interpolate and ...
0
votes
1answer
56 views

OSMNX - City Suburbs Polygons

I'd like to extract, given a city name, all suburbs and relative polygon geometries. For instance: https://nominatim.articque.com/details.php?place_id=230259366 So, I run the code: place = 'Torino, ...
1
vote
0answers
30 views

How to merge lines from shapefile using PyShp and Shapely and save them in a new shapefile?

I have files with line segments that cover road network of towns. The issue is that each street with specific name consists of smaller segments that I need to merge into one line covering the whole ...
2
votes
1answer
34 views

Export numpy array as TIFF with rasterio fail with the folder name :No such file or directory

I experienced unexpected behaviour of rasterio and I couldn't understand yet where is my mistake. I have opened rasterio TIFF, did some manipulations on it as numpy array and then export it as TIFF ...
0
votes
0answers
22 views

Update Query on Query layer in ArcGIS Pro

While updating query on query layer in ArcMap is nightmare process, it seems with ArcGIS Pro this could possibly be better thanks to python CIM Access. I have tried following code and it works in the ...
1
vote
1answer
38 views

Batch processing error in QGIS

I get a Python error when I run any plugins as batch processing in QGIS 3.6.3. The problem does not solve if I change layers. Any idea how to solve it? The error I get is: WARNING Traceback (most ...
1
vote
1answer
58 views

Changing number of decimal places of a String variable within a Vector Layer using PyQGIS

I have earthquake data and within the data, there are magnitude, longitude and latitude values. However, these values have around 6/7 decimal places but I would like to only have 2 decimal places for ...
0
votes
1answer
22 views

How to export image collection data with different projection from Google Earth Engine

I am exporting data from Google Earth Engine using Python for a specific region in a given temporal window. This what I am doing: from geetools import batch data = ee.ImageCollection('MODIS/006/...
1
vote
1answer
32 views

GeoPandas reproject shapefile

I have a geotiff image from Paris metropolitan area I have generated from MODIS data in Google Earth Engine with the following projection data_.rio.crs CRS.from_wkt('PROJCS["MODIS Sinusoidal"...
1
vote
0answers
21 views

Access coordinates from a firebase database

I want to access the coordinates from a firebase database in order to add them to my web map. The structure of the data looks like this, and there around 12,000 sets of coordinates. In my python ...
1
vote
1answer
21 views

Opening PDF w/ action based on variable crashes QGIS

I found this script which I modified a bit to open a pdf based on a page number given in the attribute list. Upon trying to execute the action it works just find but QGIS (3.4.15) is crashing! Any ...
1
vote
1answer
43 views

Error while performing actions in GRASS GIS in Python

While performing actions in python console as described in the module of GRASS GIS,am getting following error: import grass.script as gs r.in.gdal -e input="D:...\ASTGTMV003_N19E073_dem" ...
2
votes
1answer
47 views

Iterrtuples + GeoPandas DataFrame + Plotting

I am not well versed in Python (or GeoPandas) and I am currently having a simple issue with plotting. To spot some inconsistencies, I need to individually plot all the geometries in the geodataframe. ...
3
votes
1answer
37 views

Creating map of pacific with cartopy

I'm trying to plot a map of the Pacific with Japan and California in view, but am having some problems. Here's my script: import cartopy.crs as ccrs import cartopy.feature as cfeature import ...
1
vote
1answer
105 views

Creating address for streets based on direction and hierarchy of streets using ArcMap, QGIS or python?

I have a street layer with the correct direction for each line. I want to make a geocoding address based on the direction of lines and hierarchy (highway, main way, alley, etc). For example, in alley ...
2
votes
1answer
41 views

Create a video from a track (GPX / KML) using Google Street View images

I am trying to create a video from a track in GPX or KML format from Google Street view images. If I enter the data of the coordinates of a location, I can generate a JPG with that image. My problem ...
-2
votes
1answer
31 views

Seeking Python solution for point, line, and poly in poly intersections [closed]

I'm just learning Python, and I need a little direction. I've been reading many of the posts on this site, but I haven't found one that puts me on the right path. These operations are trivial in GIS ...
1
vote
0answers
21 views

IndexError: list index out of range - item report ArcGIS API for Python

I'm quite new to Python and ArcGIS API for Python. I'm trying to create a report of all the items owned by one of my ArcGIS online organization user. For each item owned by the user I want to record ...
2
votes
1answer
23 views

Obtain CRS from existing axis with cartopy

Is there a method to get the CRS from a figure created with cartopy? Say for example, I only had access to the ax created here: import cartopy.crs as ccrs import matplotlib.pyplot as plt plt.figure(...
0
votes
0answers
31 views

Python error while executing plugin GFA in QGIS 2.14.22

While processing with plugin GFA still loading 3% and error. anyone have solution for this issue? An error has occurred while executing Python code: KeyError: 7.0 Traceback (most recent call last): ...
0
votes
1answer
31 views

Inserting an URL link in marker's popup in Folium

I want to insert a live url link into my marker's popup in Python Folium but I don't know what class and code I need to use. my code is a simple one: folium.Marker(location[i], popup="www....
2
votes
2answers
115 views

Rasterio and OpenCV reads JPEG differently

I realise a very similar question was asked as Rasterio and OpenCV shows two different pixel arrays for same image. However my situation is slightly different and I only wish to know why this ...
0
votes
1answer
45 views

ArcGIS Pro - Rename attachments in attachment table based on relationship field

I'm looking for a Python 3/Aracade script to field calculate ATT_NAME in an attachment table based off of the REL_GLOBALID. So where REL_GLOBALID is {67CECF26-9BE8-4E37-9408-3BC156DA51C0}, I'd like to ...