Questions tagged [spatial]

Spatial data types store geometric data, that is data related to an object's position in space.

Spatial data types store an object's position in space, colloquially these types are "geometric" or "geographic", and operating on them will make use of geodesic or Cartesian calculations. The applied field devoted to spatial data is Geographic Information Systems (GIS); the GIS Stack Exchange should be considered for questions with this tag.

Many popular databases engines now include support of spatial data types, including:

3312 questions
105
votes
11 answers

What's the best way to store co-ordinates (longitude/latitude, from Google Maps) in SQL Server?

I'm designing a table in SQL Server 2008 that will store a list of users and a Google Maps co-ordinate (longitude & latitude). Will I need two fields, or can it be done with 1? What's the best (or most common) data-type to use for storing this kind…
Jonathan
  • 32,202
  • 38
  • 137
  • 208
94
votes
2 answers

Criteria SpatialRestrictions.IsWithinDistance NHibernate.Spatial

Has anyone implemented this, or know if it would be difficult to implement this/have any pointers? public static SpatialRelationCriterion IsWithinDistance(string propertyName, object anotherGeometry, double distance) { // TODO: Implement …
Ian
  • 1,619
  • 1
  • 14
  • 23
79
votes
5 answers

Simple way to subset SpatialPolygonsDataFrame (i.e. delete polygons) by attribute in R

I would like simply delete some polygons from a SpatialPolygonsDataFrame object based on corresponding attribute values in the @data data frame so that I can plot a simplified/subsetted shapefile. So far I haven't found a way to do this. For…
baha-kev
  • 3,029
  • 9
  • 33
  • 31
49
votes
2 answers

What is ST in PostGIS?

Almost all the functions in PostGIS start with ST. e.g. ST_Distance_Sphere, ST_GeomFromText, ST_Intersection, etc. What does ST mean? http://www.postgis.org/documentation/manual-svn/PostGIS_Special_Functions_Index.html
hekevintran
  • 22,822
  • 32
  • 111
  • 180
49
votes
3 answers

Inverse Distance Weighted (IDW) Interpolation with Python

The Question: What is the best way to calculate inverse distance weighted (IDW) interpolation in Python, for point locations? Some Background: Currently I'm using RPy2 to interface with R and its gstat module. Unfortunately, the gstat module…
Michael Allan Jackson
  • 4,217
  • 3
  • 35
  • 45
39
votes
7 answers

NoSQL and spatial data

Has any of you had any experience with using NoSQL (non-relational) databases to store spatial data? Are there any potential benefits (speed, space, ...) of using such databases to hold data for, say, a desktop application (compared to using…
Igor Brejc
  • 18,714
  • 13
  • 76
  • 95
38
votes
6 answers

How to attach a simple data.frame to a SpatialPolygonDataFrame in R?

I have (again) a problem with combining data frames in R. But this time, one is a SpatialPolygonDataFrame (SPDF) and the other one is usual data.frame (DF). The SPDF has around 1000 rows the DF only 400. Both have a common column, QDGC Now, I tried…
Jens
  • 2,363
  • 3
  • 28
  • 44
33
votes
1 answer

Spatial Data in PostgreSQL

PostgreSQL supports a variety of geometric types out of the box, along with lots of geometric operators and GiST indexes which seem to offer spatial indexing of data. And then there's also PostGIS, which is an extension to PG. What is the difference…
Assaf Lavie
  • 73,079
  • 34
  • 148
  • 203
32
votes
1 answer

System.Data.Spatial DbGeography.Distance units?

When measuring the distance between two locations using the DbGeography.Distance(otherLocation) what is the unit of the distance? Even the msdn information and the intellisense fails to specify the unit of the distance. Anyone knows? [edit] I'm…
Roger Johansson
  • 22,764
  • 18
  • 97
  • 193
30
votes
5 answers

SQL Server 2008 Spatial: find a point in polygon

I am using SQL Server 2008 spatial data types. I have a table with all States (as polygons) as data type GEOMETRY. Now I want to check if a point's coordinates (latitudes, longitudes) as data type GEOGRAPHY, is inside that State or not. I could not…
Farhan
  • 2,535
  • 4
  • 32
  • 54
29
votes
5 answers

find the nearest location by latitude and longitude in postgresql

Hi i'm trying find the nearest location by latitude and longitude in postgresql database.But when i run the below query it showing column distance does not exists. ERROR: column "distance" does not exist LINE 1: ... ) ) ) AS distance FROM…
boycod3
  • 5,033
  • 11
  • 58
  • 87
28
votes
4 answers

Crop for SpatialPolygonsDataFrame

I have two SpatialPolygonsDataFrame files: dat1, dat2 extent(dat1) class : Extent xmin : -180 xmax : 180 ymin : -90 ymax : 90 extent(dat2) class : Extent xmin : -120.0014 xmax :…
Jian Zhang
  • 1,173
  • 5
  • 15
  • 20
27
votes
4 answers

Adding scale bar to ggplot map

I've produced this map in ggplot2: library(maptools); library(ggplot2) data(wrld_simpl) world <- fortify(wrld_simpl) worldUk <- subset(world, id=="GBR") ggplot() + geom_path(aes(long, lat, group=group), data=worldUk, color="black", fill=NA) + …
luciano
  • 13,158
  • 36
  • 90
  • 130
25
votes
4 answers

Python: find contour lines from matplotlib.pyplot.contour()

I'm trying to find (but not draw!) contour lines for some data: from pprint import pprint import matplotlib.pyplot z = [[0.350087, 0.0590954, 0.002165], [0.144522, 0.885409, 0.378515], [0.027956, 0.777996, 0.602663], [0.138367, 0.182499,…
Barry Carter
  • 456
  • 1
  • 4
  • 9
24
votes
1 answer

How to convert a spatial dataframe back to normal dataframe?

This is a basic question but unfortunately I could not find the relevant command elsewhere. Is there a way i can convert a Spatial Points Dataframe to an ordinary dataframe in R. e.g. if the ordinary dataframe is df with Lat, Lon as location…
user2760
  • 2,273
  • 7
  • 25
  • 34
1
2 3
99 100