Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [sql-server-spatial]

Microsoft SQL spatial database

0
votes
0answers
43 views

SQL server seems to refuse to build Point at specific coordinate [closed]

I have a very odd problem here. At some time I was able to construct a Point in Java with the SQL server jdbc driver and insert it into a SQL server table. The WKT of the point should be: POINT (-...
0
votes
0answers
30 views

Connect to MSSQL from QGIS on Mac

I tried to connect to MSSQL from QGIS and I couldn't find any solution to my problem. I install MSSQL on my Mac with Docker and try to connect QGIS with localhost(host=localhost) and left the DSN ...
0
votes
0answers
18 views

Can QGIS use MS SQL Server 2016

Does anyone know if there are any issues for QGIS in accessing MS SQL Server 2016? I am currently using 2008, but there are a number of new functions within 2016 that are attractive for the upgrade.
0
votes
0answers
23 views

Connect Mapnik to MSSQL

I want to connect Mapnik to MSSQL Spatial SDE, but I don't know how to do this. import mapnik m = mapnik.Map(256,256) mapnik.load_map(m, "test.xml") m.zoom_all() mapnik.render_to_file(m, "2.png") ...
1
vote
0answers
42 views

How to deal with decimal separator when uploading geometries to MSSQL server using shape2sql.exe?

I'm using Shape2Sql.exe to upload .shp shapefile to MSSQL server 13.0.4502.0 on a Win10 64bit laptop. I've added Shape2Sql.exe.config <?xml version="1.0" encoding="utf-8"?> <configuration>...
0
votes
0answers
37 views

MS SQL Server STEnvelope() performance

Using MS SQL Server 2012, when we write a query with select GEOM.STEnvelope() from table where table holds approx. 4000 native SQL Server line geometries of type geometry, with 2/6/180 points min/...
3
votes
1answer
123 views

Using new Australian Datum GDA2020 in SQL Server 2016?

We have several hundred datasets/spatial layers within SQL Server 2016 which has the geometry datum/projection of GDA1994 Zone 54 (EPSG:28354) and we wish to reproject/shift the spatial locations to ...
1
vote
0answers
69 views

Importing SHP to MSSQL using OGR2OGR?

I am trying to import a Shapefile which is in EPSG:4326 coordinates to MSSQL Database but its failing. I am following the below command: ogr2ogr -f MSSQLSpatial -overwrite "MSSQL:server=...
0
votes
0answers
146 views

Parsing Geometry to Latitude, Longitude is failing

I have a table 'geocodes_raw' of locations with Latitude and Longitude values. Loc_Nm || geocode_latitude || geocode_longitude A || 43.43044 || -80.0910793 W || 43.9114523 ...
1
vote
0answers
158 views

Pulling Spatial Data in Geography Format From MS SQL Server 2008 Using ogr2ogr

Can the MSSQLSpatial driver support geography fields queried from MS SQL Server 2008 as spatial data? Background I have been using unixODBC on an Ubuntu 16.04 machine with ODBC Driver 17 for SQL ...
3
votes
1answer
244 views

SQL WKT draws well with geometry, but not with geography data type

I have a following piece of code DECLARE @g geometry; DECLARE @borders geography; SET @g = geometry::STGeomFromText('SOME WKT', 0); SET @borders = GEOGRAPHY::STGeomFromText(@g.MakeValid()....
2
votes
1answer
126 views

Query MSSQL geography data type against a bounding box

I'm currently storing geographic locations as data type geography in my MSSQL database and performing radius queries against it without issue. Is it possible to query against it using a polygon ...
4
votes
0answers
493 views

When does WKT orientation matter for polygon and multipolygon in geography spatial (left/right hand rule, counter-clockwise, clockwise)

I've decide to use sql server on Azure for my gis database. I'll be dealing with spatial Geography not Geometry. While inserting some country boundaries using the spatial data in SQL Server, some ...
1
vote
0answers
35 views

SQL Server Routing or options

We are looking for a way using SQL Server spatial queries (or spatial library if needed) to do the following: We have our own set of spatial data for custom roads (single line) and many point along ...
1
vote
1answer
197 views

Converting SQL geometry data queries into R spatial dataframes

I'm interested in querying data with a geometry field from SQL server and using it in R as a spatialPolygonsDataFrame. I've seen plenty of examples of using rgdal to import a shapefile, but ...
3
votes
0answers
83 views

Using SQL intersect query?

I am trying to find the length of a polyline inside a polygon using this query: declare @p geometry, @l geometry; select @l = SHAPE FROM [Vz_DSM_Stationing].[dbo].[Route_Sections] where OBJECTID = 3;...
0
votes
0answers
29 views

Choosing table structure for MSSQL Server to render GeoSpatial Data on OpenLayers Map?

I have billions of public data sets. I created MSSQL Database with the following table Structure: ID:nvarchar, Name:nvarchar, Latitude:nvarchar, Longitude:nvarchar, Geometry:geometry To represent on ...
0
votes
0answers
449 views

How to Cast geometry to Geography in SQL script in MS SQL Server?

I have a Table with some spatial Data in MS SQL Server. The datatype of the spatial column is geometry. I'm trying to get the closest data from an input file using the following query: DECLARE @g ...
2
votes
1answer
24 views

Why does the SRID of an ogr2ogr-imported MSSQLSpatial table change when using UID/PWD vs. trusted_connection?

I'm using python to run ogr2ogr commands to load SHP to MSSQLSpatial. The command works fine when using trusted_connection, but when I use UID and PWD, the SRID is randomly changed to SRID:846 (while ...
1
vote
0answers
49 views

Reduce coordinate precision in MSSQL WKT

When you use the AsText() function on geometry objects in MSSQL Server 2008+ you get something like this: "LINESTRING (8.8446177236171337 47.721989356913951, 8.844617919281065 47.721977134398223, 8....
0
votes
2answers
37 views

Add column to show intersection with another layer

I have a table containing a list of properties. I have a successful query to return only those that intersect another layer. However i want to return all the properties now and instead return a new ...
0
votes
0answers
77 views

ArcGIS Server and Microsoft SQL Server database connection

I have an ArcGIS Server and I need to register a Microsoft SQL Server database as a data storage. When I connect to database directly from ArcMap everything is fine, but when i'm trying to register a ...
5
votes
1answer
391 views

STContains always returns 0 when i query from table. But same data works when I manually create a polygon geometry object and select

I'm new to sql geometry. I've a table that stores polygon or multipolygon in a column. Below given a sample stringified row. Latitude, longitude, geom columns respectively 36.846642 -119.613123 ...
1
vote
1answer
44 views

Where do spatial indexes look for SRIDs?

I'm looking into optimizing the spatial indexes on some of our tables (stored in SQL Server 2008 R2), so I ran exec sp_help_spatial_geometry_index @tabname='myTable', @indexname='...
2
votes
0answers
243 views

OGR2OGR EPSG:27700 Shapefile To EPSG:4326 MSSQL Table With Geography

I have been messing around with OGR2OGR for a while now trying to import a shapefile data into an MSSQL table. I am using the OGR2OGR executable that comes packaged with QGIS Wien (GDAL version 1.11.2)...
4
votes
3answers
493 views

How to create autoincrementing primary key with dynamic writer in FME

I'm writing 3 shapefiles to an MSSQL Spatial database with FME. I'm using a writer with dynamic settings to simplify future updates of the input files. In order to create a spatial index with the ...
3
votes
0answers
349 views

Calculate lat/long as percentage distance between two points (MSSQL)

I've loaded the US road shapes into MSSQL. I've determined the query to locate the segment of road for a specific address. The segment contains a "linestring" from a series of points. I'm trying to ...
2
votes
0answers
297 views

Import to PostGIS from QGIS (database sync)

I'm trying to write a simple Python script to load data stored in MSSQL to PostGIS. Idea is to load processing in QGIS and then run "importintopostgis" geoalgorithm : "Import into Postgis" from ...
2
votes
3answers
291 views

ogr2ogr mssqlspatial string imports as a single special character

When importing a shapefile (in this case a public census tract shapefile) into SQL Server 2016 using ogr2ogr, the string fields are set to a single special character. The geography and integer fields ...
0
votes
0answers
56 views

ArcGIS Server - Query the related table

I have a feature layer with related table that is published on ArcGIS Server. When I query the related table based on the feature layer, both ArcMap online and JS REST API gave me the same error: ...
1
vote
1answer
249 views

MSSQL Geography column - Sweref99

I have a table containing a LocationEast and LocationNorth columns(int). LocationEast and LocationNorth are coordinates that follows the SWEREF99 standard. According to this page, http://www.epsg-...
1
vote
0answers
68 views

QGIS 2.14.10 MS SQL Server 2008 Primary Key Issue

I've just spent the last hour wrestling with a spatial selection problem on an MS SQL Server layer in QGIS 2.14.10. The layer is a point layer and each time I click on a point every point in the layer ...
1
vote
0answers
289 views

How to use ogr2ogr to only add new features to an existing layer?

It seems like the correct usage is as follows: ogr2ogr -update -append -lco SCHEMA=mySchema -f MSSQLSpatial "MSSQL:server=myServer;database=myDb;trusted_connection=yes;" "myShapeFile.shp" But it is ...
1
vote
0answers
49 views

SQL Spatial Feature export

I managed to successfully import the spatial features from the MSSQL into QGIS and would like to know if the following is possible and how would I go about doing it: Edit the attributes (without ...
1
vote
1answer
901 views

How to assign a schema to ogr2ogr?

According to http://www.gdal.org/drv_mssqlspatial.html I should be able to add a SCHEMA to my connection string to override the default "dbo" schema: SCHEMA: Set name of schema for new table. If ...
0
votes
0answers
121 views

ArcGIS Server JS API query performance?

I am following the example code available at https://geonet.esri.com/thread/162053 to implement the scenario to filter down till parcel level. I have 50 districts, 100 sub districts, 10000 villages ...
1
vote
1answer
56 views

SQL Server ArcSDE ST_Raster Installation and Configuration Error “.dll”

I have successfully installed ST_Raster Library in SQL Server machine following this tutorial http://desktop.arcgis.com/en/arcmap/10.4/manage-data/using-sql-with-gdbs/install-st-raster-oracle.htm I ...
1
vote
0answers
276 views

Spatial Data Cluster in sql-server ? ( like ST_ClusterWithin in Postgis )

Postgres 9.5 providing ST_ClusterWithin for Cluster the spatial data in DB level. Is there any available solution for data clustering in MS SQL (NOT SERVER CLUSTER) OR Is there Any Function ( like ...
0
votes
1answer
151 views

Geoserver support for WKB spatialdata

I use SQL Server (2012 sp3) DB with Geoserver and i noticed that Geoserver likes to call SQL like SELECT ... geom.STAsBinary() FROM (geoserver sql view) WHERE geom.filter(...) In my test case ....
1
vote
1answer
76 views

Unable to select SQL Spatial table line feature

I have a table in a SQL database that has been spatially enabled with a geography column. In ArcGIS it is a line feature and can be viewed in ArcMap with no issues and even published as a map service ...
2
votes
1answer
119 views

Modify a polygon that WKT is POLYGON EMPTY

First of all, I'm not a GIS professional, just a developer using SQL spatial tools. I am inserting data in to ArcGIS feature class to be modified by users within ArcGIS desktop. For most cases, ...
2
votes
0answers
144 views

ERROR 1: Error initializing the metadata tables :

I use ogr2ogr (bundled with QGIS 2.14.3) on Windows to convert an ArcSDE MS SQL Server 2012 database with SQL Geometry to PostGIS (2.1.8). I use the following syntax: ogr2ogr --config ...
1
vote
1answer
258 views

Dealing with different MSSQL geometry types in ArcGIS for Desktop?

I have a Microsoft SQL Server 2008 spatial database holding both point and polygon geometry data types. Displaying the data with the software which captures the data is not a problem, but ArcGIS 10.3....
3
votes
2answers
5k views

Inserting lat/long data into geography column of SQL Server 2012?

is it possible to insert lat/long data into geography column just by typing the coordinates lat/long as a double or string: INSERT INTO LOT_EXPLOITATION_LOT VALUES (3621,'oui','Forêt Boréale',560000,'...
0
votes
1answer
715 views

MSSQL - Cast Lat/Long As A Native Geometry Type Into a New Column

I have two separate Columns, one for Lat and one for Long. What I need to do is to cast both into a third column that I have called Shape and is of type Geometry. I was able to find the below as to ...
0
votes
2answers
309 views

Read MS SQL Spatial with GDAL Library

I'm trying use the GDAL library in C++ to read a MSSQL spatial database file (*.mdf). I see there is a driver for MSSQL Spatial, but there is very limited documentation on how to connect and read ...
1
vote
1answer
190 views

ogr2og2 fails with memory allocation error post v2.0 for MSSQLSpatial

There are a few of us encountering "Memory allocation" errors when using ogr2ogr to import spatial (shp/gpx) data into a MSSQLSpatial databse. According to this post: Writing shapefile to SQL Server ...
0
votes
1answer
77 views

Comparing overlap with different SRIDs in MSSQL [duplicate]

I am sourcing our GIS data (ESRI ArcGIS) into a data warehouse for reporting. I am trying to join our sites in Table_A (with a point geometry column) to our markets in Table_B (with a polygon geometry ...
0
votes
0answers
438 views

ogr2ogr: Unable to open datasource 'MSSQLSpatial' with the following drivers

I'm trying to import a shapefile to MSSQLServer 2014 using the ogr2ogr command on OSGeo4W but I keep getting the error in the title no matter how many ways I try it. My code is as follows: ogr2ogr -f ...
0
votes
1answer
490 views

Geometry data in MSSQL - Bing Maps

I am pretty new to GIS/Mapping apps. I have obtained some parcel data/tax data and imported it into SQL using Shape2SQL. The values that I have in the DB are based of the following projection ...