37 votes

Creating polygon grid using GeoPandas

Previous answer gives correct result, but I allowed myself to improve the code, to avoid many unnecessary lines, as well as iterating on indexes instead of values on the list. import geopandas as gpd ...
Mativane's user avatar
  • 629
26 votes
Accepted

Creating polygon grid using GeoPandas

There are many solutions. One of them import geopandas as gpd from shapely.geometry import Polygon import numpy as np points = gpd.read_file('points.shp') xmin,ymin,xmax,ymax = points....
gene's user avatar
  • 54.7k
21 votes

Creating regular polygon grid in PostGIS

You can create a regular grid simply by vectorising an empty raster: SELECT (ST_PixelAsPolygons(ST_AddBand(ST_MakeEmptyRaster(100, 100, 1.1, 1.1, 1.0), '8BSI'::text, 1, 0), 1, false)).geom
Pierre Racine's user avatar
17 votes

Create spatial polygon grid from spatial points in R

here is a solution using sf and sf::st_make_grid: library(raster) library(sf) e <- as(raster::extent(-125, -65, 25, 49), "SpatialPolygons") %>% st_as_sf() grd_lrg <- st_make_grid(e, ...
sebdalgarno's user avatar
  • 1,713
15 votes

Creating nested grid in QGIS

This answer was given to the original question prior the edit: Here is a graphical model you can use: So basically, you first need to create your parent grid as rectangles and order them with an SQL ...
MrXsquared's user avatar
  • 33.9k
13 votes

Overlaying spatial polygon with grid and checking in which grid element specific coordinates are located using R

The New York dataset provided in the question is no longer available for download. I use the nc dataset from sf package to demonstrate a solution using sf package: library(sf) library(ggplot2) # ...
sebdalgarno's user avatar
  • 1,713
12 votes
Accepted

Creating grid with PyQGIS

You use wrong TYPE code. You have to use 2 for rectangular grid. 3 means diamond. params = {'TYPE':2, ...} # 2: rectangle For more details about the algorithm try import processing processing....
Kadir Şahbaz's user avatar
12 votes
Accepted

Importing grid layer from CSV in QGIS

If you import your CSV as a delimited text layer, you could use the "Geometry by Expression" tool on the layer to construct the polygons with this expression: make_rectangle_3points( ...
Matt's user avatar
  • 16.3k
11 votes

Creating regular polygon grid in PostGIS

Here is an optimized and efficient algorithm to create fishnet, regular grid, polygon grid, rectangular grid inside any envelope, polygon, or multipolygons. almost handle any SRID; GitHub Repo: https:/...
Muhammad Imran Siddique's user avatar
11 votes

Creating regular polygon grid in PostGIS

I've created a variant of @Alexander's function that doesn't require that we transform to another SRID. This avoids the issue of having to find a projection that uses meters as units for a particular ...
Matt's user avatar
  • 402
11 votes
Accepted

Turning vector grid into individual shapefiles using QGIS?

You need to use Split Vector Layer from processing toolbox. You can find the tool from Processing toolbox -> QGIS geoalgorithms -> Vector general tools -> Split Vector Layer Select the input ...
ahmadhanb's user avatar
  • 40.7k
11 votes
Accepted

Vector grid in QGIS3 - Can I change the order of row number?

You can create a new layer with the re-ordered ID Run the grid tool as you currently do. Go the the menu layer / add layer / add-edit virtual layer and enter the following query. select *, ...
JGH's user avatar
  • 41.6k
10 votes
Accepted

Create spatial polygon grid from spatial points in R

You can make a long/lat raster and transform library(raster) r <- raster(ext = extent(-125, -65, 25, 49), res=c(5,2)) values(r) <- 1:ncell(r) rA <- projectRaster(r, crs="+proj=aea +lat_1=29....
Robert Hijmans's user avatar
10 votes

Sorting grid cells in fishnet grid by location and number using QGIS?

You can use pyqgis. Script will: List all centroids x, y coordiantes with each features id Sort list by x and y The ids are now in correct order - create a dictionary of id and sequential number ...
BERA's user avatar
  • 71.4k
10 votes

Creating 100m^2 grid automatically using QGIS?

You have two options here. First one will create a new vector layer with a grid and the second one will just display a grid as overlay. What you are looking for is the first option. However, in case ...
MrXsquared's user avatar
  • 33.9k
10 votes

Creating grid in QGIS 'anchored' to specific point

You can use GRASS v.mkgrid tool in Processing Toolbox > GRASS > Vector.
Kadir Şahbaz's user avatar
10 votes

Importing grid layer from CSV in QGIS

A PyQGIS solution. Proceed with Plugins > Python Console > Show Editor and paste the script below: # imports from csv import reader from ast import literal_eval from os.path import normpath from ...
Taras's user avatar
  • 32.8k
9 votes
Accepted

Sum line lengths for each grid cell in QGIS

Create a polygon grid using the Vector Grid tool instead of lines. Make sure to check the polygon output. Once you have a polygon grid (also known as fishnet), you can use the Sum line length tool ...
HDunn's user avatar
  • 8,616
9 votes

Building a grid of equal square polygons in ArcGIS 10?

You can do this with both the Create Fishnet tool or the Grid Index Features tool. Create Fishnet is a bit more configurable, and can output either polygon or polyline. Both will allow you to set a ...
Midavalo's user avatar
  • 29.7k
9 votes
Accepted

Create Fishnet option

Instead of looking for the Create Fishnet (or any other) tool in ArcToolbox, I recommend using the Search window to search for and open it. If you are curious to know which toolset it is located in ...
PolyGeo's user avatar
  • 65.1k
8 votes
Accepted

How to select specific rows of polygons from a grid in QGIS?

You can use the floor function in your expression, like this: floor($id /24) IN (1,3,5,7,9,11,13,15,17,19,21) On a sample grid I've obtained this result with my own numbers (my grid has 13 columns ...
Germán Carrillo's user avatar
8 votes
Accepted

Creating grid following points in QGIS?

This is a bit of a workaround in QGIS 3.8 and requires that the points are separated by a uniform distance (bit it looks like it from your screenshots). Create a grid with the same spacing and ...
miln40's user avatar
  • 1,111
8 votes
Accepted

Using ST_SquareGrid to create grids

If you want a 1 degree grid, make your reference system by geographic (eg 4326) and then make a 1 unit grid, with your shape providing the bounds. with grid as ( select (st_squaregrid(1, ...
Paul Ramsey's user avatar
  • 19.8k
8 votes

Placing point over pixel with maximum value falling in grid overlay using QGIS

First, sample your raster values via "Raster pixels to points" from Processing Toolbox. It will create a point on each pixel of your raster, containing the rastervalue. Now join your points ...
MrXsquared's user avatar
  • 33.9k
8 votes

Measured grid in Mapbox

If MapBox uses EPSG:3857 any grid will become distorted as you move away from the equator. If you want an undistorted lat/lon grid try using EPSG:4326 (Plate Carree) - technically the grid is still ...
Ian Turton's user avatar
  • 81.1k
8 votes

Importing grid layer from CSV in QGIS

If you can generate additional columns in your .csv you can generate a WKT string (POLYGON) column directly in the .csv: POLYGON(left bottom, left top, right top, right bottom, left bottom) and then ...
Kasper's user avatar
  • 3,182
7 votes
Accepted

Generate rectangular fishnet or vector (grid cells) shapefile in R?

Your raster-sp workflow worked fine for me, not sure how you got 19 columns either. If it wasn't a typo, it might have been an rgdal bug on write; that's the only related package that I can see a ...
obrl_soil's user avatar
  • 3,732
7 votes
Accepted

Expanding a grid/fishnet in QGIS

You can expand the grid, but you would have to do it manually, and that would be time consuming and prone to error. This is how I would approach what you need. This is going to be long winded with a ...
jbgramm's user avatar
  • 1,347
7 votes

Uncertainty of a line between two coordinates with uncertainties in QGIS

That was a fun problem! I solved it using QGIS 2.18 but I don't think the tools have drastically changed in 3.0. 1. Generate the lines I won't give much details here since you already have the lines ...
ArMoraer's user avatar
  • 5,629
7 votes

Creating GRID with customized labels in QGIS

You can generate these IDs using a virtual layer Run the grid tool as you currently do. Go the the menu layer / add layer / add-edit virtual layer and enter the following query. select *, char(r+64)...
JGH's user avatar
  • 41.6k

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