Skip to main content
13 votes
Accepted

What is the difference between sample, sampleRegions, and stratifiedSample in Google Earth Engine?

sample() uses 1 region (either points or polygons) and does exhaustive sampling in that region (all pixels) unless you specify a smaller number of points. But the random sampling it does isn't ...
Noel Gorelick's user avatar
8 votes

Randomly sample from geopandas DataFrame in Python

Here's another way to do it: import geopandas as gpd import numpy as np # load an example polygons geodataframe gdf_polys = gpd.read_file(gpd.datasets.get_path('nybb')) It looks like the following: ...
steven's user avatar
  • 348
7 votes
Accepted

Randomly sample from geopandas DataFrame in Python

GeoPandas uses Shapely geometries. As far as a know, there is no a function which gets random points within a polygon. So, you must write any like below. Add this script to yours. from shapely....
Kadir ┼×ahbaz's user avatar
6 votes
Accepted

Risk of generating sampling points from Pseudo-Mercator projection

"No issue?" Hardly. Any time you generate random data you should do a chi-squared test to verify the randomness of your generator. Your distribution will be skewed toward the north or south poles, ...
Vince's user avatar
  • 20.1k
6 votes
Accepted

Generate random points within a polygon with minimum distances in QGIS 2.14

You can use Random points inside polygons (fixed) from Processing Toolbox. If you don't see Processing Toolbox panel, activate it from menu Processing --> Toolbox. For distances in meters you have ...
Oto Kaláb's user avatar
  • 6,915
6 votes

Randomly sample from geopandas DataFrame in Python

Here's a solution that takes advantage of MultiPoint and MultiPolygon to avoid loops. import numpy as np import geopandas as gpd import shapely.geometry def sample_geoseries(geoseries, size, ...
Scott Gigante's user avatar
5 votes

ArcGIS Random Point generator producing same points every iteration

The tool will always return the same results unless you set the Random Generator environment value. Click the Environments... button at the bottom of the tool and select the Random Numbers section. ...
Bjorn's user avatar
  • 2,609
5 votes
Accepted

How much do leaves on/off affect the number of LiDAR ground returns?

How much do leaves on/off affect the number of LiDAR ground returns? It does affect significantly. Take a look at Wasser et al. (2013)'s figure 4 (adapted) and see how the frequency of returns are ...
Andre Silva's user avatar
  • 10.3k
4 votes

Deciding how many random sampling points needed for specific area?

Do you have a specific hypothesis? What type of analysis or statistical model are you intending? The number and spatial distribution of sample points is completely dependent on these considerations. ...
Jeffrey Evans's user avatar
4 votes
Accepted

Plugin not available : point sampling tool

If you can't connect to the online repository, download the plugin manually: Access the Point sampling tool plugin from the repository. Click the version required: Click the Download button: ...
Joseph's user avatar
  • 75.9k
4 votes
Accepted

Export pixel neighborhood in Google Earth Engine

I think what you need is ee.Image.neighborhoodToArray. I give an example: var i = ee.Image.random().addBands(ee.Image.random(1)).clip(geometry) Map.addLayer(i) var neig = i.neighborhoodToArray(ee....
Rodrigo E. Principe's user avatar
4 votes
Accepted

Generating sampling points - making series of points in the horizontal centre of a long polygon, equidistant spacing on vertical axis

We will create an equally spaced grid, intersect it's horizontal lines with the beach and calculate centroids of each intersection. Steps Use a projected coordinates system (such as UTM). Vector > ...
StefanBrand_EOX's user avatar
4 votes

Randomly sample features from polygon layer with the condition that sampled features will be non-adjacent

I'd use 'weeding' procedure explained in Location optimization post to create subset, where polygons do not share boundaries. Or even simpler 'Graph Coloring' algorithm available in networkx module:
FelixIP's user avatar
  • 23k
4 votes
Accepted

How to auto-update field on geometryChanged() signal?

This is a simplified example. You can of course add the QMessageBox functionality back in, if you wish. p = QgsProject.instance() lyr = p.mapLayersByName('points')[0] # change for the name ...
Matt's user avatar
  • 17.2k
4 votes

How to auto-update field on geometryChanged() signal?

As much as I love using pyqgis, here is another option. You can set a default value for your Z field, and use the raster_value function in an expression to sample the elevation from the DEM raster. ...
Ben W's user avatar
  • 21.7k
3 votes
Accepted

Stratified sampling with a point and polygon layer

Use the Random selection within subsets tool which allows you to select the ID field (containing the unique values for your electoral area) and the number of points:
Joseph's user avatar
  • 75.9k
3 votes
Accepted

Sample points based on multiple conditions

In QGIS: Use the Raster Calculator to create a raster that is equal to 1 anywhere the population density > 1000 condition is satisfied and where the altitude raster's condition (< 1000) is also ...
wfgeo's user avatar
  • 3,588
3 votes
Accepted

QGIS point sampling tool error in extracting values

Problem is in the CRS. Layers geometry must be in same CRS (like in other overlay analysis). OTF (on the fly) transformation doesn't matter since it not change the gometry in the layer file. You ...
Oto Kaláb's user avatar
  • 6,915
3 votes

What are the benefits of hexagonal sampling polygons?

As a climate change researcher, my biggest take on hexagon grid system is mainly two benefits: It represents connectivity in an uniform way, which is very important for Earth Science modeling. For ...
Chang's user avatar
  • 300
3 votes

Point Sampling Tool pyQGIS

In QGIS >= 3.4 you can use the "qgis:rastersampling" algorithm.
ndawson's user avatar
  • 27.6k
3 votes

Understanding spsample in R?

Yes, gstat::idw can predict at any x,y location, but if you want to show that as a continuous map then you need a raster. The example does: # Interpolate the grid cells using a power value of 2 (idp=...
Spacedman's user avatar
  • 64.3k
3 votes
Accepted

Create point clusters based on grid

Given you already have your RED 6km span points which I am referring to red_points, you can do something like this to obtain your 3X3 200m grey_points. (please, adjust the sign (+/-) as you wish to ...
umbe1987's user avatar
  • 3,785
3 votes
Accepted

Exporting dataframe - used reduceRegion to sample an image in Google Earth Engine

Based on Justin's comment above and the part of the debugging guide he directed me to, I tried the following: var sampledPoints = points.map(function(feature) { return feature.set(gfc2014....
C. Ashley's user avatar
  • 405
3 votes
Accepted

How to solve "Collection query aborted after accumulating over 5000 elements"?

The collection you pass to ui.Chart.feature.byFeature() cannot contain more than 5000 features. In your case, your sample collection contains way more than 5000. pairedImage.sampleRegions(geometry, ...
Daniel Wiell's user avatar
  • 14.2k
3 votes
Accepted

Getting properties of random points in Google Earth Engine

Use sampleRegions to add the image bands as properties to the collection of random points. var randompoints = ee.FeatureCollection.randomPoints(peru.geometry(), 1000); var samples = IMAGE....
Kevin Reid's user avatar
  • 10.4k
3 votes
Accepted

Randomly select non adjacent polygons in vector layer (QGIS)

You might try using something like topological coloring from the Processing toolbox to assign colors to your polygons, then pick one of the colors and use one of the random selection methods from the ...
Llaves's user avatar
  • 5,973
2 votes

Zonal Statistics for multiple rasters

For mean only use os.chdir(rasterfolder) for lyr in glob.glob("*.tif") : qgis.analysis.QgsZonalStatistics(vector, lyr, attributePrefix=lyr, rasterBand=1, stats=QgsZonalStatistics.Statistics(...
Christina Kallimani's user avatar
2 votes

Zonal Statistics for multiple rasters

I have something fairly close, although it only currently works for average and rejects max and min. Save all your raster layers in one folder with the same extension (e.g. .tif) Load shapefile (...
Joseph P's user avatar
  • 113
2 votes
Accepted

Create random sampling point in each grid's cell

If you write Random in the Processing toolbox, you will find that there are many Random Points inside polygon tools exist in QGIS as you can see below: You can test which one will fit your needs ...
ahmadhanb's user avatar
  • 40.9k
2 votes

Field sampling design: stratified random or transect?

I would recommend using the Stratified Random approach for your study: Stratified random sampling is a method of sampling that involves the division of a population into smaller groups known as ...
whyzar's user avatar
  • 12.1k

Only top scored, non community-wiki answers of a minimum length are eligible