Skip to main content

New answers tagged

1 vote

"builtins.ValueError: year 0 is out of range" error while iterating through features in layer with Fiona

You can skip it with the ignore_fields argument or only include fields you want with the include_fields argument, e.g: import fiona fc_path = "test.shp" lyr=fiona.open(fc_path, 'r', ...
user2856's user avatar
  • 74.9k
0 votes

Extract point cloud data from shapefile with Python

You can clip with pdals filters.crop: The crop filter removes points that fall outside or inside a cropping bounding box (2D or 3D), polygon, or point+distance. I read the shapefile and convert the ...
Bera's user avatar
  • 82.5k
1 vote

Converting UN locations `coordinates` to lat and lng

You can use Haskell like this $ cabal repl -b geodetics ghci> :m +Geodetics.Geodetic ghci> showGeodeticSignedDecimal <$> readGroundPosition WGS84 "423000.00N,013100.00E" Just &...
Janus Troelsen's user avatar
0 votes

New Features not snappable

Had a similar issue today in QGIS 3.40. In my case it was caused by the new feature triggering an update on the underlying databse, which QGIS did not get notified about. Interestingly the feature was ...
MakePeaceGreatAgain's user avatar
0 votes
Accepted

Unable to download MODIS emissivity through pystac

As Son of a Beach mentioned in his answer, MODIS data is probably not available anymore through planetary_computer. Based on that answer to another issue (with some minor corrections), I managed to ...
ArMoraer's user avatar
  • 5,779
1 vote

Unable to download MODIS emissivity through pystac

I did a bit of research and found this NASA news article which states: These datasets will be available via their current URLs and workflows until June 26, 2025. After that date, the legacy HTTPS ...
Son of a Beach's user avatar
0 votes

Uploading style (SLD) to GeoServer using REST API not working - for empty workspaces

To temporarily resolve the issue, I created a function that first creates the SLD, then immediately updates it—using the same SLD content. Since this is for internal use, I will continue with this ...
GforGIS's user avatar
  • 3,415
0 votes

Natural Breaks (Jenks) classification using Python

A web search suggests mapclassify. Have you tired that? import mapclassify import numpy as np data = np.array([1, 2, 3, 7, 8, 9, 15, 16, 17, 20]) n_classes = 3 classifier = ...
GBG's user avatar
  • 11k
1 vote

AttributeError: 'DataFrame' object has no attribute 'to_file'. Did you mean: 'to_pickle'?

With @Bera's answare, i found the problem. Adding some debbug in the layer_mapper() method, I found this: def layer_mapper(gdb_path: str, layers: list[str], substation_cod_id_filter: str | None = None,...
Eric Verschoor's user avatar
3 votes
Accepted

AttributeError: 'DataFrame' object has no attribute 'to_file'. Did you mean: 'to_pickle'?

Yes, you can convert the dataframe to a geodataframe even though it doesnt have a geometry, then use .to_file: import os import geopandas as gpd out_gpkg = r"C:\GIS\GIStest\abababa\out.gpkg"...
Bera's user avatar
  • 82.5k
2 votes

Why does gdal.Warp create a black region on the sides of some rasters when it reprojects and cuts them?

I think it's something to do with the curve that should be introduced when the the cutline poly is internally reprojected to 3857 during the clip. If you reproject the poly manually, you will see that ...
user2856's user avatar
  • 74.9k
3 votes
Accepted

Landsat Imagery comes up all white inside ROI

It's the scaling factor. You used a scaling factor of 0.0001, which is correct for Sentinel 2 but not for Landsat. For optical (RGB) bands in Landsat 9 images you have a different scaling factor and ...
Oliver Lopez's user avatar
  • 1,427
1 vote

Extracting specific lat and long values in GeoTIFF file using Python

You can use rasterio's sample_gen(): import rasterio from rasterio.sample import sample_gen raster = r"C:\Users\bera\Desktop\gistest\abc\dem.tif" coords = [[15.5673178 , 57.38489456], ...
Bera's user avatar
  • 82.5k
0 votes

Couldn't load qgis.user

For those finding this post later, this is fixed in FSLogix 25.09.
Stacker's user avatar
0 votes
Accepted

Getting rid off black/RGB pixels on edges caused by during reprojection with Python

Nodata does not really work with lossy compression methods. I believe you have two options: Don't use "ADD_ALPHA=NO", use "ADD_ALPHA=YES" Or continue without alpha but use a ...
user30184's user avatar
  • 71.9k
1 vote

Dividing Geographical region into equal sized grid and retrieving indexing position

import geopandas as gpd from shapely.geometry import box import numpy as np #Create a GeoSeries with the extent rectangle ymin, xmin = 39.77750000, 116.17944444 ymax, xmax = 40.04722222, 116.58888889 ...
Bera's user avatar
  • 82.5k
4 votes
Accepted

Truncate layer in ArcGIS Online using arcgis.gis

Perhaps, the Esri community is a bit more comprehensive, where one can find more details when working with the ArcGIS API for Python. In one of the threads i.e. "How to access layer using feature ...
Taras's user avatar
  • 36k

Top 50 recent answers are included