spatial
SQL Server 2008 Spatial: find a point in polygon
I think the geography method STIntersects() will do what you want: DECLARE @g geography; DECLARE @h geography; SET @g = geography::STGeomFromText(‘POLYGON((-122.358 47.653, -122.348 47.649, -122.348 47.658, -122.358 47.658, -122.358 47.653))’, 4326); SET @h = geography::Point(47.653, -122.358, 4326) SELECT @g.STIntersects(@h)
.NET 4.5 Beta DbGeography NotImplementedException
DefaultSpatialServices in Entity Framework are using SqlGeography and SqlGeometry types as backing types. These two types live in Microsoft.SqlServer.Types.dll assembly that is not part of the .NET Framework. The exception is thrown when EF cannot find these types (the exception could be more helpful…). When you install Visual Studio it will install localdb on your … Read more
sql geography to dbgeography?
Sorry for the late response – but saw this whilst searching for something else. Simply do the following: SqlGeography theGeography; int srid = 4326; // or alternative DbGeography newGeography = DbGeography.FromText(theGeography.ToString(), srid); To reverse it: DbGeography theGeography; SqlGeography newGeography = SqlGeography.Parse(theGeography.AsText()).MakeValid(); Hope that helps!
Neo4j Spatial ‘WithinDistance’ Cypher query returns empty while REST call returns data
I investigated this, and it is related to an issue we have seen a few times. There is an inconsistency in the design of the spatial library in that there are two ways to add a node to the spatial index. The one is to add it to the Layer (using the addNodeToLayer REST call), … Read more
What’s the best way to store co-ordinates (longitude/latitude, from Google Maps) in SQL Server?
Fair Warning! Before taking the advice to use the GEOGRAPHY type, make sure you are not planning on using Linq or Entity Framework to access the data because it’s not supported (as of November 2010) and you will be sad! Update Jul 2017 For those reading this answer now, it is obsolete as it refers … Read more
Python: find contour lines from matplotlib.pyplot.contour()
You can get the vertices back by looping over collections and paths and using the iter_segments() method of matplotlib.path.Path. Here’s a function that returns the vertices as a set of nested lists of contour lines, contour sections and arrays of x,y vertices: import numpy as np def get_contour_verts(cn): contours = [] # for each contour … Read more
Check if point is in spatial object which consists of multiple polygons/holes
You can do this simply with gContains(…) in the rgeos package. gContains(sp1,sp2) returns a logical depending on whether sp2 is contained within sp1. The only nuance is that sp2 has to be a SpatialPoints object, and it has to have the same projection as sp1. To do that, you would do something like this: point … Read more