Microsoft SQL spatial database

learn more… | top users | synonyms (2)

3
votes
1answer
49 views

How to cast geometry to varbinary in PostGIS / PostgreSQL

In MSSQL Server, casting geometry to varbinary(max) produces a string that looks like this: 0x3D0B0000010CA0F3BE3B5CE9474100EC414E3AF93941 When you insert that string into a geometry column, a ...
3
votes
1answer
56 views

SQL Spatial select record where intersects another record

I have two tables - 'Tree' (point) and 'ServiceArea' (polygon) in the GIS database. Trying to select all Tree records that intersect a ServiceArea where the value in Tree.ServiceAreaNumber field ...
0
votes
0answers
17 views

How to find Nearest point on line from a point cordinate in SQL server

I want to find out the nearest point on my road network which is a multiline string from a point with lat lon value. The below code I have tried for finding buffer distance line from a point. ...
0
votes
1answer
37 views

How do you filter a layer on a joined table in QGIS?

I am attempting to do a join in QGIS between a SQL Server Spatial table and a non-spatial table (on a single integer field). I was able to add both successfully and make the join, but the query ...
1
vote
1answer
63 views

Should the QGIS “DB Manager” have Microsoft SQL Server as an option?

I was looking for interactive query options for SQL Server (similar to SQL Server Management Studio). The "DB Manager" works great for Postgres and I'm primarily using the Load as new layer as I build ...
1
vote
0answers
46 views

How to return GeoJson from a SQL Server Query using GeoJson.Net in ASP.NET MVC

I have a Spatial Table in SQL Server, I want to map using either OpenLayers or Leaflet. My problem is I can't figure out how to convert the returned results from my query to geojson. My Linq Query ...
1
vote
0answers
11 views

Using gdal_rasterize with a MSSQL Connection, possible?

I'm a bit new to gdal, I mostly use ogr2ogr for data imports to MS SQL Server -- so I'm a bit out of my tree on gdal_rasterize My goal is to create png raster files 200x200 from a geometry column. I ...
0
votes
0answers
18 views

Querying geom from MS SQL 2014 in PHP/PDO returns empty array

I'm using the following php code: $query = $dbconn->prepare("SELECT [geom].ToString() as geom FROM [the_table_im_using]"); $query->execute(); if($query->errorCode() != 0) { die("Query ...
2
votes
1answer
40 views

Cannot see created SQL Server tables in ArcGIS

I have a MSSQL 2012 database that I can connect to from ArcGIS using 'Add Database Connection'. In this database I have a spatial table that I can see and open in ArcGIS, however when I create a table ...
0
votes
0answers
33 views

Z and M values get lost when extending MS SQL geography Linestring by .STUnion

I'm trying to add new geography points with Z and M values to a geography linestring. This has to be SQL 2008 R2 compatible. I've found some references to .STUnion() and tried that. The linestrings ...
1
vote
0answers
28 views

Offsetting points from lines using SQL Server Spatial?

I'm new with SQL spatial data processing, so I'm not sure how to solve my task. I have two tables - table with lines and table with points that are located on lines. Lines and points are related by ID ...
1
vote
3answers
201 views

How do I find points that are NOT within a list of polygons using MS SQL?

I have a table of points, and and a table of polygons. I have managed to build queries (MS SQL) to get the containing polygon for a given point, as well as listing all the points within a specified ...
1
vote
0answers
90 views

What if 'geometry_columns' already exists in MSSQL Server Database?

When trying to load a .SHP into MSSQLSpatial using OGR2OGR, I get the following error: ERROR 1: Error initializing the metadata tables : [Microsoft][ODBC SQL Server Dr iver][SQL Server]There is ...
0
votes
1answer
98 views

Converting coordinates into decimal using SQL Server Spatial?

I am looking to convert a pair of coordinates to decimal, and am unsure how to go about doing it. The following script select Centroid.STY as Longitude, Centroid.STX as Latidude from ( select ...
1
vote
0answers
46 views

Difference between adding spatial layer from MSSQL through “browser” and “add MSSQL table”

So I am trying to pinpoint the difference of adding layers from MSSQL Database that contains spatial layers like geography and geometry. I have noticed that when adding from the browser it retains it ...
1
vote
1answer
59 views

Does SQL Server Data Need to be Spatial

In reference to my previous question. I am looking for the benefits of telling SQL Server your data is spatial. For instance, I have a duplicate of that table generated by the Shape2SQL tool (see ...
0
votes
1answer
441 views

SQL Server Spatial Querying

I am looking for ways to learn querying for SQL Server Spatial (2008/2012). I have a table created from Shape2SQL and have been trying to run a simple intersection query to get results from that ...
0
votes
1answer
300 views

SQL Server geometry vs. geography in Esri map service

We have a SQL Server 2008R2 database where point coordinates are stored as decimal degrees. I want to create an Esri map service which shows those points. As the point data is dynamic I decided to ...
2
votes
1answer
133 views

convert ordnance survey easting and northing data to WGS84 latitude longitude values

The C# code published here is not very accurate as also mentioned by tanoshimi. I think this has to do with the lack of 'approximate Helmurt transformation'. Just curious is anyone aware of some ...
0
votes
0answers
59 views

ArcGIS Data Interopabality Extension and Exporting from Mapcom M4

I am exporting from Mapcom's M4 database into Geodatabase or Shapefile. I have the ArcGIS Data Interopability extension and I was able to connect and export the Lines, Points, polys, etc. When I ...
0
votes
0answers
84 views

SQL Spatial Tools package - linear referencing

The SQLSpatialTools package website seems to be temporarily down, so I cannot access the article on linear referencing tool posted there at the moment. Is it possible, by any other means, to obtain a ...
0
votes
1answer
33 views

Geog vs. Geom - not same results [duplicate]

I have these two SQL Server 2008 R2 queries: SELECT COUNT(*) FROM OIS_NOA_Buffers WHERE geog.STIntersects(geography::Point(35.25934, -120.64432, 4326))=1; SELECT COUNT(*) FROM OIS_NOA_Buffers WHERE ...
2
votes
3answers
388 views

How to use STUnion with GroupBy

I'm using SQL Server 2008 R2 to store Geometry data types. I have a bunch of lines as individual features, that share common names ('NAME' field). I would like to create a view that Groups By 'NAME' ...
0
votes
1answer
166 views

SRID, Shape2SQL and SQL Server 2008r2 query

I'm using Shape2SQL to load the Ordinance Survey's Meridian 2 map into SQL Server 2008r2 (which is working very smoothly and painlessly). According to this page ...
5
votes
2answers
507 views

Optimizing Geometry.STIntersect Query

I am attempting to move simple Geoprocessing routines from ESRI based processes to SQL Server. My assumption is that it will be far more efficient. For my initial test I am working on an intersection ...
0
votes
0answers
18 views

send attribute from 75,000 object polygon to 20Mil point database

I have sql server 2008 r2. I have two tables: PropertyParameters and REF_GEOID. Property Parameters has four columns: PropertyID, ParcelID, Lat, Long. REF_GEOID has two: GEOID and GEOM. GEOM is a ...
0
votes
1answer
107 views

How to speed up SQL spatial query (spatial index error)

I am trying to split polylines by points which have a small buffer around them. Currently I have over 370,000 lines and 320,000 nodes and the query is running really slowly (I've left it for 3 days ...
4
votes
5answers
264 views

How do you generate WKT from a graphic drawn on a map?

All, In order to do some quick analysis using SQL spatial, I'd like to generate spatial objects using the STGeomFromText / ST_GeomFromText function. With point data, I can do this by geocoding an ...
1
vote
3answers
176 views

ST spatial queries to select multi-level location

I'm trying to write a query in SQL Server using 1 set of points and 2 sets of polygons. The polygons overlap, and I only want to select the points that fall inside of 1 polygon but not the other. I ...
1
vote
0answers
127 views

Creating Irregular ellipses using SQL Spatial 2012 Geometry

I have stumbled across a problem in SQL Server 2012 - whereby I need to create different shape ellipses from the following data points: centre_x | centre_y | max_x | max_y | min_x | min_y I have ...
1
vote
1answer
2k views

accurately find the bounding box of geography polygons

Im displaying polygons on a map and have had issues with the spatial index where the index performs well only for certain data sets (large areas with low density / high density small map areas). I've ...
0
votes
1answer
205 views

How to union polygons and add attribute values of combined output features

I have a layer containing 10 polygons all overlapping at various locations. Each polygon has a value of '1' in a column called "value" How do I Union the polygons (rows) together such that the ...
4
votes
1answer
220 views

How to migrate spatial tables from MSSQL to PostGIS

I'd like to migrate my spatial data from MS SQL Server to PostGIS. Originaly the data was stored with SDE under MS SQL. Then I migrated with an ArcGIS tool. That created a spatial data column with ...
4
votes
2answers
375 views

Storing SRID:4326 data as Geometry or Geography?

I used OGR2OGR to import SRID 4326 point data into MSSQL Server. Didn't realize that it defaults to creating a geometry column instead of detecting the data as 4326 and creating a geography column. ...
0
votes
1answer
819 views

SQL Geometry Query similar to Select by Centroid

Does anyone know if it's possible to query SQL geometry by something like 'centroid of polygon'...similar to ArcMap's select by location? I'm using SQL Server 2008 R2 as the DBMS. I have two polygon ...
3
votes
4answers
311 views

How to assign geometry to records in a table that contain an ID of a geometry point?

We are looking to map out 'incidents' at schools, but the incident table, which contains a few thousand records, only has a school number (plus the incident data). The table format is an Excel ...
1
vote
2answers
221 views

How to count points once with overlappying polygons?

All, We're using parcel data (polygon) to count student locations (point) based on parcel type. We're doing this using SQL and the ST_Intersects function. It works great, except the City and County ...
1
vote
1answer
264 views

MSSQL server 2008 dissolve sql query

I have a set of spatial objects in a MSSQL server 2008 R2 trying to dissolve adjoining objects where one of the attributes are equal. The table below is somewhat representative to my original table: ...
2
votes
1answer
263 views

Delete duplicate spatial point/points in mssql from a perticular location

I am working with a Spatial data which has a street intersection points.... I get the intersection points from spatial query on street/roads datain MMSQL . but in my case some streets/roads are multi ...
1
vote
0answers
356 views

How to add a MSSQL spatial layer using Python?

I'm having difficulty adding a MSSQL spatial data layer using Python. The database is password protected, and I can add the layer without any problems using the built in feature, but I can't make it ...
2
votes
2answers
230 views

Issues with Selection and Viewing of Attribute Table using QGIS and SQL Server Express 2008 R2

I am having issues with Selection using QGIS 2.0.1. Dufour. When I select one point, all of the points get highlighted. Attribute Table dialog shows Errors for all of the attributes. It indicates that ...
0
votes
1answer
61 views

Can distance be calculated to a destination feature based on an attribute in the source?

All, Is it possible to specify which destination point to calculate distance to based on an attribute in the source? STDistance will give me the distance each student (point) is to their closest ...
2
votes
1answer
429 views

How can I create geometry in SQL2012 with custom SRID?

I want to create geometry using EPSG 2039 in mssql 2012. This srid doesn't exist in sys.spatial_reference_systems any idea how I can do it ?
1
vote
1answer
460 views

What is required to get OGR to work with SQL Server?

All, I've been having heaps of trouble getting OGR to connect to our SQL Server development environment. (read about it here and here) SQL Versions: 2008, 2012 OS's: Windows 7, Ubuntu 12.04 My ...
2
votes
0answers
63 views

What is the MS SQL Spatial syntax for counting points within polygons? [duplicate]

All, What I'm trying to do is this: Count points within polygons There are thousands of points and maybe 2 dozen polygons Get a list back of the 2 dozen polygons by name and the count of points ...
3
votes
1answer
1k views

Why does ogr2ogr SHP import error out trying to create a database?

All, Can anyone tell me what the error is with OGR2OGR when trying to import a .SHP into MSSQLSPATIAL? ERROR 1: MSSQL Spatial driver doesn't currently support database creation. Please create ...
7
votes
2answers
2k views

Change polygon “handedness” for SQL 2008

I have a few hundred shapes (polygons and multipolygons) each consisting of tens of thousands of points that I am trying to get into SQL 2008. Unfortunately, the shapes I have tried to import are ...
3
votes
2answers
505 views

WMS layers don't draw in QGIS or ArcMap but do in OpenLayers [closed]

WMS Map was published by myself in AutoDesk Infrastructure Map Server 2013. I can connect and load detials (properties / metadata) in QGIS Browser, ArcCatelog. I can load the wms into QGIS desktop and ...
2
votes
0answers
208 views

How to do Spatial Tools Projections between different projection types

I am working with the SQL Spatial Tools from http://sqlspatialtools.codeplex.com/ And a variety of data sets, primarily from LINZ and Google. These involve working with projections for 4326 (WGS84?) ...
3
votes
3answers
1k views

SQL Spatial view using a Query Layer in ArcMap 10 is SLOW

We have a number of SQL Spatial views each made up of approximately 10 tables (so relatively complex views) and each including a table with a SQL Geometry column. A view could return up to 300-400 ...