FAQ Database Discussion Community


Are intermittent long CLR waits to be expected when updating geography columns in SQL AZURE?

c#,sql-server,sql-azure,spatial
I have a table with 14 records and the following query running through Entity Framework using "ExecuteSqlCommandAsync" UPDATE [par].[UserActivity] SET Position = {0} WHERE [email protected] This query typically executes in about 2 to 10 ms.. But once or twice an hour it takes anywhere from 10 to 30 seconds.. Position...

get an empty SpatialPolygonsDataFrame via subset?

r,spatial,maptools,sp
I'm looking to subset a SpatialPolygonsDataFrame by an attribute, but I want to allow it to return an empty SpatialPolygonsDataFrame. If we are to treat objects of type SpatialPolygonsDataFrame like data.frames, as discussed here, we should be able to get and work with empty objects. I'm interested because I want...

Oracle spatial functions without Oracle spatial extensions

oracle,plsql,spatial,oracle-spatial
I need to save the GPS coordinates in an Oracle database on which are not installed spatial extension. There is software pl/sql that emulates the main functions of Oracle Spatial (obviously no use its datatype) in the same way to make a "wrap" of JSON functionality of Oracle 11 exists...

Select / subset spatial data in R

r,dictionary,spatial
I am working on a large data set with spatial data (lat/long). My data set contains some positions that I donĀ“t want in my analysis (it makes the files to heavy to process in ArcMap- many Go of data). This is why I want to subset the relevant data for...

mapping all of Latin America with rworldmap

r,maps,geospatial,spatial
I am trying to plot some data for different countries in Latin America using the rworldmaps package. When including mapRegion='latin america', Mexico is cut off...is there any way to include Mexico other than by overriding using ylim and xlim? Thanks. library(rworldmap) df <- NULL df$country <- c("Brazil","Mexico","Argentina") df$code<-c("BRA", "MEX", "ARG")...

how do I join against a geographic point and a geometry polygon

sql-server,spatial,spatial-query
I have a sql server 2008 engine. In my database I have two tables. Table A has a PK1 column, and a geography data type used for a POINT value. Table B has a PK2 column with a geometric data type used for a POLYGON value. I need to output...

Django and GeoDjango database backend

mysql,django,spatial,geodjango
I am using a Django app with MySQL database backend and I want to implement GeoDjango I have to change backend to: django.contrib.gis.db.backends.mysql I don't know if that is simple as it?...

GDAL show me a possible path error

python,django,postgresql,geospatial,spatial
I installed PostGIS on my Open SUSE distribution to make preparations for a project that should include a spatial database, so i heard to do that i need PostGIS libs for "spatial capabilities". I wanna deploy an open source app that was done in django and I'm getting a: OSError:...

Count number of buffers that touch a (polygon) feature

buffer,polygon,geospatial,spatial,arcgis
I'm facing the following task in ArcGIS - I'm using ArcMap 10.2 I have a polygon shapefile with counties of (say) a state in US. From this shapefile, I create a layer which marks all counties in which there is at least 1 city of more than 50000 inhabitants (I...

Find out image tiles falling under bounding box efficiently

java,performance,spatial
I am working in Java. I have a large image made up of randomly sized rectangular tiles. I want to store the information about these tiles such a way in my program that, given a rectangle bounding box, I can quickly find out which tiles will fall inside this rectangle....

How to compute greatest distance between polygon centroid and edge

r,geospatial,spatial,sp
I have a SpatialPolygons(DataFrame) object, e.g. SpP library(sp) Sr1 = Polygon(cbind(c(2,4,4,1,2),c(2,3,5,4,2))) Sr2 = Polygon(cbind(c(5,4,2,5),c(2,3,2,2))) Sr3 = Polygon(cbind(c(4,4,5,10,4),c(5,3,2,5,5))) Sr4 = Polygon(cbind(c(5,6,6,5,5),c(4,4,3,3,4)), hole = TRUE) Srs1 = Polygons(list(Sr1), "s1") Srs2 = Polygons(list(Sr2), "s2") Srs3 = Polygons(list(Sr3, Sr4), "s3/4") SpP = SpatialPolygons(list(Srs1,Srs2,Srs3), 1:3) I would like to, for each polygon, calculate the greatest...

Spatial data in R: plot decision regions of multi-class SVM

r,polygon,spatial
I've got a data.frame with x and y columns, and a class column that gives the classification of each point under an existing multi-class SVM model. Here's some example code: library(rgdal) library(rgeos) library(e1071) # for svm() library(sp) library(raster) library(maptools) library(plyr) ## Create a mask of the data region, as a...

Compatibility neo4j-spatial with spring-data-neo4j-rest and neo4j CE 2.2.1 server mode?

neo4j,spatial,spring-data-neo4j
I'm trying to make neo4j-spatial version 0.14-neo4j-2.2.0, works with spring-data-neo4j-rest version 3.3.0.RELEASE with neo4j CE 2.2.1 in server mode. It looks like they are not compatible. Trying to create new instance of class EditableLayer throws NoSuchMethod exception. For instance: EditableLayer layer = (EditableLayer) spatialDb.getOrCreateLayer( "layer",SimplePointEncoder.class, EditableLayerImpl.class); I get the exception:...

Extract xy coordinates from raster using buffer function

r,buffer,extract,spatial,raster
I have some xy coordinates as a SpatialPoints (points) object and have used them to extract temperature values at these locations from a RasterLayer (raster): extract = extract(raster, points) However several of the points are falling outside of the raster layer (i.e. not plotting on land) and I want to...

MapBox ESRI Data Layer

json,gis,spatial,mapbox,esri
I have a mapbox, and want to display a layer of esri data onto it. The data I'm getting is being pulled in from this json file: https://gis.usps.com/arcgis/rest/services/EDDM/selectZIP/GPServer/routes/execute?f=json&env%3AoutSR=102100&ZIP=93003&Rte_Box=R&UserName=EDDM The data['results'][0]['value']['features'] array looks something like this: [{'attributes': {'key':'value'}},{'geometry':{'paths':[[-13273770,4064608],[-13273762,4064613],....]}}, {'attributes':...

Sort by distance in Lucene.net Spatial 3.0.3

c#,sorting,lucene.net,spatial
I have a application in which I need to search by geo coordinates. My index is building fine, I am using the PointVectorStragegy. I am able to search within a circle Point p = spatialContext.MakePoint(latitude, longitude); var circle = spatialContext.MakeCircle(latitude, longitude, DistanceUtils.Dist2Degrees(distance, DistanceUtils.EARTH_EQUATORIAL_RADIUS_MI)); var args = new SpatialArgs(SpatialOperation.IsWithin, circle); var...

2D perspective transform in JavaScript

javascript,geometry,2d,spatial,perspective
Looking for a code example of how to calculate (accurately) the dimensions of a rectangle from a top down view (90 degrees) at a particular angle. e.g. I have a rectangle of 1200mm x 2000mm How would i determine the new perspective measurements of the rectangle if it was angled...

spatial clustering in R (simple example)

r,geospatial,spatial,hierarchical-clustering
I have this simple data.frame lat<-c(1,2,3,10,11,12,20,21,22,23) lon<-c(5,6,7,30,31,32,50,51,52,53) data=data.frame(lat,lon) The idea is to find the spatial clusters based on the distance First, I plot the map (lon,lat) : plot(data$lon,data$lat) so clearly I have three clusters based in the distance between the position of points. For this aim, I've tried this code...

Interpolating Gridded 3D Data to a finer scale

r,interpolation,spatial,grid-layout,netcdf
I have a NetCDF file of a probability surface. It's a 30x30 grid of 0.25 degree lat/lon intervals with a probability surface described in the z dimension. I can easily import this into Panoply, a NetCDF viewer: And it's then a breeze (checking one box) to interpolate/smooth the raw data...

Converting coordinate units to meters

c#,.net,spatial,spatialite
public double CalculateDistance( Coordinate c, Coordinate a, Coordinate b, LineMode mode) Parameters: c Type: SpatialLite.Core.API.Coordinate The coordinate to compute the distance for. a Type: SpatialLite.Core.API.Coordinate One point of the line. b Type: SpatialLite.Core.API.Coordinate Another point of the line. mode Type: SpatialLite.Core.Algorithms.LineMode LineMode value that specifies whether AB should be treated...

How to save levelplot() with like cells merged

r,graphics,spatial,heatmap,levelplot
Say I have a heatmap with contours like so: set.seed(1) X <- matrix(runif(100*200),nrow=100) X <- apply(X,1,sort) #png("Surface.png",width=800,height=400) lattice::levelplot(t(X),contour=TRUE) #dev.off() getwd() it looks like this: There are many ways to make variants of this in R (fields::image.plot(), image(), and so forth. If I save this filled contour plot as a pdf,...

EF LINQ spatial query times out using Contains() method in SQL Server

c#,sql-server,linq,spatial
I have a spatial query (SQL Server 2012) using LINQ (lambda syntax) that times out after approximately 30secs, and I cannot work out why. I have checked indexes, and run the Tuning Advisor but indexing all appears to be in order. I am just trying to get the polygon that...

Assign rows to a group based on spatial neighborhood and temporal criteria in R

r,for-loop,group,spatial,temporal-database
I have an issue that I just cannot seem to sort out. I have a dataset that was derived from a raster in arcgis. The dataset represents every fire occurrence during a 10-year period. Some raster cells had multiple fires within that time period (and, thus, will have multiple rows...

Create Ellipse Geography Representation

sql,tsql,sql-server-2008-r2,spatial,sqlgeography
I wish to create a spatial object representing an ellipse in SQL Server 2008 R2. I have the point coordinates, and min and major axis values. The closest built in function I can find, which doesn't get me all the way there, is STBuffer - which creates a buffered radius...

PL/pgSQL trigger to stop a river crossing another river

sql,postgresql,postgis,plpgsql,spatial
I have to write a trigger to stop a river crossing another river. I'm really struggling with it and any help would be appreciated. myriver is the table containing all the information on the rivers. So upon insert of a new river if it crosses an existing river, I should...

dplyr - error message after applying function

r,apply,spatial,dplyr
I am trying to apply a IDW (inverse distance weighting) to different groups in a database. I am trying to use dplyr to apply this function to each group, but i am making a mistake in the Split-Apply-Combine. The current function returns 10 values for each group of 10 observations,...

Finding shortest distance between two polygons(SqlGeography c# )

c#,sql,sql-server,spatial
I want to find the shortest distance between two SqlGeography polygon. I know there is a method ShortestLineTo (https://msdn.microsoft.com/en-us/library/ff929252.aspx) but it gives empty string while doing so. Can anyone suggest me some alternate way to do so?