Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 97137

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

0 votes
2 answers
1k views

Sum of values in raster

Upon importing a raster file, how can I get the sum of all values given in the raster file? import rioxarray as rxr raster= rxr.open_rasterio( 'raster.tif', masked=True ).squeeze() raste …
Stücke's user avatar
  • 541
9 votes
1 answer
875 views

Assigning new values to polygon based on overlapping area with other polygons

I have two square polygons df1 and df2. Both polygons are assigned a value of 10 (df1) and 20 (df2) in the "content" column. Let's assume, I have a circle with the midpoint 1.5,1.5 and a radius of 1. …
Stücke's user avatar
  • 541
-1 votes
1 answer
2k views

Convert Esri ASCII grid raster format to GeoJSON

I received data as *.asc file. How can I convert the ASCII data into a *.GeoJson file including polygons and the band data? I've tried various approaches with rasterio and gdal but they always returne …
Stücke's user avatar
  • 541
1 vote
Accepted

Convert Esri ASCII grid raster format to GeoJSON

I am not great with Python so please forgive me the style of code. I am sure, there are nicer way to achieve the same results. …
Stücke's user avatar
  • 541
1 vote
2 answers
10k views

How to apply GDAL polygonize?

To me, the input parameters are cryptic and I failed to figure out the exact commands required for application in Python. ** Edit** With help of Ben's comment I got to this point: from osgeo import gdal … , ogr import sys # this allows GDAL to throw Python Exceptions gdal.UseExceptions() # get raster datasource src_ds = gdal.Open(inputFilename) srcband = src_ds.GetRasterBand(1) # create output datasource …
Stücke's user avatar
  • 541
1 vote
2 answers
2k views

Extract population count from GeoTIFF based on mask layer

I downloaded Population Count data from Gridded Population of the World (GPW), v4 as a *.GeoTIFF file. In a next step, I would like to extract the population count of a given area based on a mask laye …
Stücke's user avatar
  • 541
5 votes
1 answer
648 views

Robinson projection in GeoPandas

How can I apply Robinson projection in a GeoPandas plot? import geopandas as gpd world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres')) world.plot(column='pop_est')
Stücke's user avatar
  • 541