Questions tagged [spatial]
Spatial data types store geometric data, that is data related to an object's position in space.
3,331
questions
0
votes
0
answers
9
views
How can I plot irregular spatial data with interpolation between points?
I have a data frame with 3 columns: x, y, and z. In this dataset, x and y represent coordinate locations, and z represents a response variable of interest. However, the data is irregular; it ...
0
votes
0
answers
14
views
How to extract values from a multipolygon that are inside another polygon
I have a shapefile with many (quadratic) polygons with values in them.
shape
class : SpatVector
geometry : polygons
dimensions : 3582951, 5 (geometries, attributes)
extent : ...
0
votes
2
answers
22
views
Is there an R function (in terra?) that takes a raster (representing a map) and returns a raster of the areas of the patch to which each cell belongs?
I've written an R function that takes a raster-based map, and counts the area and perimeter of patches of a given habitat type. However, it's vectorised, hence painfully slow on large maps. I need ...
0
votes
1
answer
63
views
R filling in a matrix with values from spatial data
I have a matrix in R called “habitat” with latitude as the rownames and longitude as the column names. The cells are filled with NA right now. My end goal is to have the whole matrix filled with ...
-1
votes
1
answer
42
views
How can I add arrows in maps using geopandas and matplotlib with the arrows having color gradients?
I want to show trade flow between countries in a map.
For this, I want to add 1 or 2 arrows to and from country as shown below.
The arrow should have color gradients, which represent certain numeric ...
0
votes
1
answer
41
views
Converting USNG or MGRS to Latitude/Longitude in R
Is there a way to interpret (using sp, sf, etc.) grid locations expressed using the U.S. National Grid in R?
This is an example of a vector I would want to transform:
locations <- c("17T PH ...
0
votes
0
answers
43
views
Unable to load layers in Lizmap web client geoviewer v.3.6.6 installed in Windows 11 (Workstation)
After following the installation procedure outlined in the following link: https://github.com/NaturalGIS/qgis_server_and_lizmap_on_windows, everything seemed to work correctly. Both Apache, PHP and ...
0
votes
1
answer
55
views
How to calculate duration of the animal inside the buffer zone
I have tracking data of birds and I have set a buffer zone. What I am trying to do is to find the duration between the first point inside the buffer zone and the first point outside the buffer zone ...
0
votes
1
answer
25
views
remove spatial points outside of polyton
I am trying to remove data points from outside of a pre-defined polygon using the code below.
However, when I plot what was removed vs retained, there are a few spots that look like some points were ...
-1
votes
1
answer
36
views
Intersects geoDataFrames
I learned solution from question [https://stackoverflow.com/questions/45287150/identify-intersecting-polygons-in-single-geojson-file-with-geopandas][1]
i got a geoDataFrame of zid which intersect, but,...
0
votes
1
answer
29
views
ELSA package (spatial association): My categorical raster data do not behave as intended
I've started working with the elsa package (https://cran.r-project.org/web/packages/elsa/vignettes/elsa.html) to measure entropy-based spatial association for categorical data, but it revolves a lot ...
0
votes
0
answers
12
views
I am looking for a way to cluster spatial data in a balanced way
My input data is 1000 points, each of which has a profit column and a longitude and latitude column. I want to do clustering in such a way that it takes almost the same time to travel the distance ...
0
votes
0
answers
17
views
Method to calculate ionospheric error, SNR, tropospheric error from RINEX files with Python
I'm looking to calculate atmospheric error, SNR, MP, CNR from a batch of RINEX files (2.11). I'd like to then write the output to an array for spatial and statistical analysis.
Are there any Python ...
0
votes
0
answers
16
views
How to spatially join a csv database with a polygon shape file based on lon lat fields using ogr2ogr
I have multiple databases in csv files (e.g. data.csv) with the following columns :
id, lon, lat, val1, val2, val3, val4, val5, val6
I want to spatially join all the fields of data.csv with a grid ...
0
votes
1
answer
68
views
ggplot of raster maps: Horizontal / vertical grid cells distortion
I am plotting multiple projected raster objects (SpatRaster or raster stack; equal area projection; EPSG:3035), all having the same extent. Example map
However, the mapped grid cells are distorted, ...
1
vote
0
answers
25
views
Does Postgis's ST_Within and Mongodb's $geoWithin perform the same way and should return the same result?
I have been trying to compare the Geospatial query function of two well-known database engine, Mongod and Postgis to see which one would suit my work the most.
I prepared mock data for my database, ...
0
votes
1
answer
33
views
R terra direction - can I do it in only one direction?
terra::direction() returns values for every single cell in the raster. I have a raster with ~50% of cells value NA, and the rest with a value. What I want is direction() but only for the NA cells, ...
0
votes
0
answers
15
views
Rebuild Spatial Index After Massive Changes
I have a question about spatial index.
I'm using sqlite with VirtualSpatialIndex.
The quesion is :
I have a main table that contains millions of polygons.
Let's say every 4 months I have to get a ...
0
votes
0
answers
30
views
Spatial autocorrelation in residuals of spaMM model after controlling for it
I am trying to control for spatial variation which I suspect to be strong in my dataset. I am comparing a linear model from lme4 with 3 explanatory variables - 1 continuous fixed effect, 1 discrete ...
-2
votes
1
answer
61
views
What units does the Google Maps API's event.overlay.getRadius return value use? [duplicate]
I am using the below code:
google.maps.event.addListener(drawingManager, "overlaycomplete", function(event) {
if(event.type == 'circle') {
$('#radius').val(event.overlay.getRadius())...
0
votes
1
answer
22
views
Calculate spatial data
I have below code.
$zone = RestaurantZones::whereRaw( "ST_Distance(circle_coordinates, ?) <= radius", [$point] )->pluck( 'id' );
I am getting the below error.
Illuminate\Database\...
0
votes
0
answers
24
views
Trying to get which points of a sf object are within another sf object with sf_within
I have a sf dataframe looking with boat track points that looks like this:
sf_object<-c("Time"="13:05, 16:04, 15:16, "geometry"="POINT(-125.25 48.3), POINT(-125.13 48....
0
votes
0
answers
5
views
Finding which points falls within a specific polygon
I have a dataframe from boat track GPS that looks like this:
> df <- data.frame(
> Lat = c(48.83, 48.84, 48.63),
> Long = c(-125.02, -125.05, -125.035)
> Time = c(13:02, 13:...
-2
votes
0
answers
34
views
Fetch spatial point data using Laravel
I am storing a coordinate in MySql Table using Laravel like below.
$coordinates = explode(',',substr($request->coordinates, 1, -1));
$zone = new RestaurantZones();
$zone->...
0
votes
1
answer
24
views
geom_sf missing geometry with SpatialPolygonsDataFrame
I'm working with some GPS collared animals and using LoCoH.a function in the adehabitatHR package to generate a SpatialPolygonsDataFrame.
library(tidyverse)
library(lubridate)
library(adehabitatHR)
...
0
votes
0
answers
19
views
STdeconvolve Top 1000 Overdispersed Genes Error
I am working with some spatial transcriptomic data (10x genomics visium) using the STdeconvolve R package. I am able to see the package through, however, I do get an error when attempting to narrow ...
0
votes
2
answers
41
views
How to make a composite index in Postgres including a POINT?
With this table:
CREATE TABLE bins (
id SERIAL PRIMARY KEY,
start TIMESTAMP NOT NULL,
bits BIT(16) NOT NULL,
topleft POINT, -- (x,y) in web mercator projection
count INTEGER
);
...
0
votes
1
answer
49
views
How to transform a sf table to a stars cube with stars::st_as_stars function?
I want to transform a sf data.frame into a stars cube, and choose the dimensions.
But I don't succeed in using the function stars::st_as_stars properly and get what I want.
Why do I want to transform ...
2
votes
0
answers
48
views
Minimum area between target linestring and a collection of other linestrings?
I have a problem wherein I want to extract two scores for a set of target linestrings, T: 1. The Euclidean distances of T, 2. the average "closeness" to a second set of static linestring ...
0
votes
0
answers
25
views
Extracting data using bounding box coordinates from netcdf files?
I am new to using netcdf files. I have downloaded netcdf files related to SST (sea surface temperature) from the Copernicus interface (https://cds.climate.copernicus.eu/cdsapp#!/dataset/satellite-sea-...
1
vote
1
answer
95
views
Convert a vector grid created with sf::st_make_grid into a raster stack
I have a vector grid created with sf::st_make_grid() with several columns of
values. I would like to convert it to a raster stack, with each column of values becoming
a layer of the raster stack.
I ...
0
votes
0
answers
26
views
sp::SpatialPolygonsDataFrame(sp, d) : Object length mismatch:
I have 2 shapefiles both have different number of rows and polygons mentioned below :-
nrow(shape1)
[1] 84172
nrow(shape2)
[1] 35283
i am doing terra::erase or raster::erase on that . but i am ...
1
vote
0
answers
22
views
Signed Distance Function (or alternative to GLM/GAM) in R for sf geometries?
I have a set of sf geometries (LINESTRINGS, but equally useful to know a general solution for POLYGON, POINT etc.). These represent roads and, at the moment, I have a function which weights potential &...
0
votes
2
answers
32
views
Is there an alternative function to get a world map in R
I'm currently using countriesSP <- getMap(resolution='low') from rworldmap but this package has now been depreciated. Is there a new way to get a spatial polygon map from a different package. ...
0
votes
0
answers
15
views
Aggregate and count the status in field using FME Workbench
I have two layers point and a polygon, I wanted to have the aggregate of a column name "Progress" with its respective polygon name and polygon id. The progress field in the point layer has ...
0
votes
2
answers
90
views
Convert degrees-minutes-seconds coordinates to decimal degrees with untidy data
I have the following dataset with untidy degrees-minutes-seconds coordinates in an Excel. I want to change them to decimal degrees coordinates.
Latitude Longitude
40 39' 05''N ...
0
votes
0
answers
59
views
Uploading Spatial 10x data into seurat
I am trying to upload my 10X Visium data into R so that I can create a Seurat object but for some reason by data has not been able to be uploaded. I am using the code from the Satija lab to load the ...
0
votes
1
answer
49
views
Create line shapefile that starts at a given point(lat,lon), has a specific angle/slope and truncate it when it overlaps a polygon shapefile
###---------- UPDATED ------------###
I need to create a line shapefile with a specific length, that starts at the specified point and makes a certain angle. Then, truncate it when it intersects a ...
0
votes
0
answers
29
views
Can I still use SDLfilter after the retirement of maptools?
I am working on animal tracking data and I wanted to use SDLfilter to clean the data. However, since the retirement of maptools, when I try to load SDLfilter I get the following:
> library(...
0
votes
1
answer
32
views
Interpolate values (e.g. for temperature) in a 3D space in R - not by selecting nearest neighbour but by calculation
I need to calculate values that are dependent on other values in their vicinity. Their location is known. In the given case the values are temepratures.
Consider a standup freezer (aproximately 1m x ...
2
votes
1
answer
39
views
Calculate overlapping track segments
My goal is to achieve something similiar to the Strava Global Heatmap Feature. So basically calculating heatmaps for tracks coming from GPX sources.
Lets say i have two GPX Files. I managed to import ...
0
votes
0
answers
22
views
Using the dpik function from the KernSmooth Package to solve for bandwidth
I have bivariate collar data from 1997-2021 of a caribou herd. I am trying to calculate the bandwidth (using the plug-in method from Wand and Jones) for each year using the dpik function. It seems to ...
1
vote
1
answer
81
views
Cannot convert GEOMETRY to GEOGRAPHY in SQL Server
I have 1000s of GEOMETRY shapes in SQL and I want to convert them to GEOGRAPHY on the fly, but I am struggling to do this. Tried this code so far with this example polygon and it won't convert, can ...
1
vote
1
answer
35
views
using terra::focal() with even sided weight matrix
i want to use the terra::focal() with an even sided matrix (e.g. to apply "Roberts cross" edge detection; https://en.wikipedia.org/wiki/Roberts_cross).
However, focal() only accepts windows ...
0
votes
0
answers
24
views
How to Convert MySQL Query with Function and View into HQL for Hibernate?
I have a working MySQL query that uses a custom function and a view to perform a spatial calculation. The function vParameterFunction() returns a point, and the view vTestView calculates the distance ...
0
votes
1
answer
36
views
Two similiar SPATIAL columns with the same INDEX working differently
I'm working in simplifying zip codes polygons in a MYSQL database (v 8.0), I'm reducing the number of coordinates for each polygon.
So, I have a table named zip_city, which contains a column named ...
1
vote
0
answers
57
views
Updating properties of points within polygons based on a spatial setting
Assume I have polygons and points that look like this:
library(sf)
library(sp)
####Create minimum working example data####
n_rows <- 10 # Number of rows of rectangles
n_cols <- 10 # Number of ...
1
vote
3
answers
104
views
Giving a Spatial GEOGPOINT in BigQuery, How can we plot X points surrounded equally from the center point
In BigQuery assume I have a GEOPOINT Datatype. Say for eg ST_GEOGPOINT(-122, 37) How can I find say 10 GEOGPOINTS that make the Outer Circle with the radius as 100 km.
The requirement is for a Looker ...
0
votes
0
answers
45
views
R terra weighted kernel density estimate of a spatRaster
In library terra, the kernel density estimate of values in a spatRaster x can be calculated using:
library(terra)
x <- rast(matrix(rnorm(100,10,1), nr = 10, nc = 10))
density(x, plot = F)
But ...
2
votes
1
answer
90
views
How does the tolerance argument for sf::st_snap work in R?
I am trying to snap spatial points to a street network. However, the output of sf::st_snap, specifically the way the tolerance works, confuses me.
At certain values for the tolerance, I get the ...