Questions tagged [sql-server]

Microsoft SQL Server is a relational database server product by Microsoft. Its primary query languages are T-SQL and ANSI SQL.

Filter by
Sorted by
Tagged with
3
votes
2answers
5k views

Geocode US ZIP codes in QGIS

I have a list of zip codes (nearly thousands) which I want to show in qgis. After researching I found that I need to geocode them first into Lat/Long then I can use them to create a layer for qgis. I ...
4
votes
2answers
6k views

Shapefile to MSSQL with ogr2ogr fails to make connection

I am using ogr2ogr from OSGeo4W on my Windows 7 box to import a shapefile into a SQL Server database on one of my servers. I was able to successfully complete the conversion using shp2sqlserver, but I ...
0
votes
0answers
10 views

ArcGIS - SQL Database - .iNumber tables [duplicate]

We have ArcGIS Enterprise in SQL and I see a lot of iNumber tables. I can't find information about what is the purpose, how they got created and do I need to delete them?
1
vote
2answers
32 views

Cannot verify WKT polygon for use with SQL Server geometry

I am trying to create a polygon, with inside cut out, and I have created a dozen of them no problem. However, I cannot get the following point list to verify. POLYGON( (53.890253 -114.150550, 53....
0
votes
1answer
26 views

ogr2ogr cannot import data

I can successfully get a connection to my remote sql server database using: ogrinfo "MSSQL:server=my_server_name;database=my_database;Trusted_Connection=True;" But when I try to import an ...
0
votes
0answers
14 views

Geodatabase doesn't export all features into XML workspace

I try to export the database into XML workspace and when I import the XML into a new geodatabase I find that some features of latest update are missing (at least what I have identified). I'm facing ...
3
votes
3answers
7k views

Import shapefile in SQL Server (OGR2OGR)

I'm importing a shapefile into SQL Server '12 via the OGR2OGR tool and am getting a database connection error. I followed the example from this article. What I ran: ogr2ogr -overwrite -f ESRI ...
1
vote
2answers
379 views

Reducing coordinate decimal places in WKT using C#?

I have imported several shapefiles into a Microsoft SQL Server 2017 database When I use the STAsText() function on geography objects I get the following WKT: SELECT [Adm0GeoBoundaryID] ,[...
5
votes
1answer
4k views

Converting set of points to polygon using C#?

I want to convert a set of gps ponints to polygon.I used a simple loop to convert it to a WKT and than used makevalid() in sql server and save it in a gemetry column in databasae.Is this way right?or ...
0
votes
1answer
842 views

MSSQL performance with Geography (point within polygon)

I have a query, below, that works - however its very slow, looping through roughly 24,000 points per second. This is a rather high end production DB server with MSSQL and SDE, and in other instances a ...
0
votes
1answer
161 views

Setting Up Cesium in wamp64

I wanted to clarify with all of you whether I am setting up Cesium correctly in wampserver using Windows 7 64 bit. The Reason on why I want use wampserver is because I want to access data from the sql ...
3
votes
0answers
140 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

SQL MERGE on Remote server - Geometry Data Type Objects exposing columns with CLR types are not allowed in distributed queries

I'm trying to merge tables. Both contain a data type of geometry. Apparently I need a passthrough query to be able to write geometry/geography type to remote server. MERGE [SERVER].[DB].[dbo].[TABLE]...
2
votes
1answer
118 views

Transfering real time data from SQL Server to ArcMap without using PI Integrator [closed]

I am new to GIS. Right now I am working on my senior project in which I have to find the fault in transmission line and show its location on a map using ArcMap 10.2. I have some readings of voltage ...
2
votes
1answer
588 views

STContains on SQL Server vs ST_Contains on PostGIS

I am trying to run a basic point in polygon query against a table of polygons. In PostGIS this works: SELECT * FROM schema.table WHERE ST_Contains( table.geom, ST_PointFromText('POINT(XXX.XXXXXXX ...
0
votes
0answers
17 views

Unable to connect to Azure SQL from ArcMap 10.6

I am trying to connect to Azure SQL MI from ArcMap 10.6, But I am getting this error while trying to connect I have tried to installing the newest ODBC driver (version 17) but still doesn't work. ...
4
votes
1answer
1k views

Is there a way to get centroid of geographic object in MSSQL?

I have a table of OSM geographic roads in MSSQL 2012. I want to create a new column with the centroid of each road (So I can set center on OpenLayers map for each road). How can I do it ?
1
vote
0answers
17 views

SQLServer STArea issue with GEOMETRYCOLLECTION resulting in trillion's m2 area

I've come across a weird issue with SQL Server's handling of GEOMETRYCOLLECTION in a Geography data type resulting in an area (square meters) in the trillion's of square meters. (checked on 2014, ...
0
votes
0answers
47 views

MapInfo 17.0.1. Problems with SQL queries for my database

I am writing to you with the following two problems I have with MapInfo at my workplace. Recently we have changed our Microsoft SQL-Server 2003, with MapInfo Spatialware, to a Microsoft SQL Server ...
2
votes
1answer
917 views

Connecting to Microsoft SQL Server from QGIS

I can't connect my QGIS to SQL Server. This is my database: This is my connection configuration to QGIS If I press test connection it says "Driver not loaded". If i load database, there is ...
2
votes
3answers
1k views

Can't import shapefiles into SQL Server, because of Encoding issues

I'm trying to import some shapefiles into SQL Server. At first I had difficulty finding third party tools as I realized that Microsoft has not supported this out of the box. So I found Shape2Sql and ...
8
votes
2answers
12k views

Fastest strategy for proximity searches in SQL Server

I am using SQL Server 2012. I'm implementing a back end for a mobile app which will have to do proximity searches to find nearby POIs (points os interest). I know it's a very common scenario and looks ...
9
votes
4answers
675 views

MS SQL Spatial as Central Datastore?

I've been working on opening up our spatial data from a proprietry system to one that can be read by more products (MapGuide, ESRI, gvSIG, Map3D etc....) I've decided on using SQL Spatial as we have ...
11
votes
2answers
754 views

Why is SQL Server 2019's STDistance Very Slightly Different Than The Vincenty Formula? (Same Up To ~0.0001km)

I'm trying to make a C language equivalent to STDistance. Through research, I've narrowed down what STDistance uses, which apparently is the (inverse) Vincenty Formula. The problem is, I've tried ...
5
votes
2answers
8k views

SQL to get points within a certain distance

I am new to using spatial data types in sql server. I have managed to create a column of Approx 50,0000 geometry points (from x,y data) and would like to find out which (count number of) points are ...
1
vote
0answers
14 views

QGIS does not recognize the CRS when the data is provided by SQLServer Database with Esri SDE

We have a MS SQL Server: Microsoft SQL Server 2016 database with SDE from Esri on Windows Server 2012 R2. Loading data into QGIS results in the QGIS unkown CRS dialog. If we don't select one CRS the ...
0
votes
1answer
77 views

Slow SDE Performance After Append - Geometric Network

I had an odd thing happen today, I do almost daily appends to our fiber network (fiber, splices, etc) and usually, it goes smoothly and with no complications. For some reason, I had an Append stall ...
4
votes
2answers
111 views

Speed difference MS SQL Server 2019 to PostgreSQL/PostGIS 12 for spatial data

I imported a shapefile with 3000 polygons in UTM 25832 into both databases MS SQL Server 2019 and PostgreSQL/PostGIS. Then I calculated a buffer of 1000 meters around these geometries and transferred ...
0
votes
1answer
35 views

Importing a shapefile or geopackage from QGIS 3.16 to MSSQL Server 2019

I can only find PostGIS, SpatiaLite and Oracle in the database management to import layers to the respective databases. However, I can connect to MSSQL Server in QGIS and draw and save geometries in ...
2
votes
2answers
65 views

QGIS Connection with MSSQL: does not work

With QGIS 3.14 I try to get access to a table in MSSQL with points of the GEOGRAPHY type. The table has a PK with clustered index, and a spatial index. There is a filled geometry_columns metadata ...
0
votes
1answer
3k 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. ...
1
vote
1answer
123 views

Measuring area covered by linestring

I have a trajectory given by GPS which I store as a ST_LineString() and I'd like to know the area covered by the line string. I know the "width" of the trajectory, but I'm not sure how to approach the ...
1
vote
1answer
473 views

Unable to load layers from MSSQL PyQGIS

I have a plugin that loads layers from SQL Server 2008. It has worked before but when I reset my PC, i wasn't able to backup my plugins. I am left with an older copy. Below is my python code to load ...
2
votes
1answer
102 views

How QGIS Python loop through all tables MS SQL Server?

I've got Python code on QGIS 3.12 that adds a MS SQL Server data layer to the map, but I need to add all of them. uri = QgsDataSourceUri() uri.setConnection(r"xx.xxx.xxx.xx\xxx", "xxxx&...
0
votes
1answer
48 views

Stop SQL Server selecting outside buffer

I am trying to select all the parks within 200m or a railway. I can easily create and visualise the 200m buffer. However when i try and find only the parks that intersect it i get all parks returned,...
0
votes
0answers
272 views

Loading CSV file Polygon Column to Microsoft SQL Table

How do I import a polygon from CSV to SQL? I have attempted to use the SQL Import and Export wizard to load it in as varchar(max) and then convert using geography::Parse(column) as well as Geography::...
0
votes
0answers
21 views

Display DrillHole locations in QGIS from SQL Server database source

I'm using QGIS 3.10.9, and I want to be able to display some drill hole data from my source database, which is on a SQL server. (I've been able to export the data into CSV format and display the data ...
2
votes
1answer
147 views

Optimising Large Spatial Queries in SQL

I'm sure similar answers have been given elsewhere but no matter what I have tried I am unable to optimise this query. Details: TableA has 3.5mill records TableB Had 57000 records but I have ...
1
vote
0answers
42 views

Using spatial indexes on point to polygon intersection query in SQL Server

I have a table (tab_point) with about 5 million points and another table with a few thousand polygons (tab_polyg). I need to find what points intersect with what polygon (to establish a count of ...
0
votes
1answer
307 views

Adding ArcGIS Pro Query Layer?

I am attempting to add a query layer to ArcGIS Pro 2.1.2 via SQL Server. The table consists of Ticket_ID, Latitude, Longitude. The query layer works if I only add the top 1000 rows. However, when I ...
1
vote
1answer
67 views

Two identical geography objects produce different STIntersects results in SQL Server 2019

Consider I have two POLYON geography object, @g1 and @g2. One from WKT and the other one converted from binary: DECLARE @g1 geography = 'POLYGON ((-45.70072144031528 70.79588950876575,-45....
3
votes
2answers
729 views

Combining ST Buffer and Intersect with Where clause

I'm trying to create a buffer around a single point in a spatial entity and finding all the points from a different entity that fall within that buffer. I tried two approaches. The code below runs ...
3
votes
0answers
43 views

QGIS Convert Shapefile to MSSQL as geography type

I am using QGIS 3.16 and SQL Server 2019. I have a shapefile loaded into the project. I have been able to successfully convert the Shapefile to a spatial dataset in SQL Server. My method for doing ...
1
vote
0answers
25 views

Connect to single table within a MSSQL database or terminate connection to database once layer added to QGIS project?

I'm connecting to MSSQL server '123' that contains 100s of databases and I am connecting to just database 'ABC'. 'ABC' contains roughly ~700 tables. Once I add the 'xyzTable' as a layer to my QGIS ...
0
votes
0answers
54 views

Problems with sde.next_rowid, ArcMap still uses 'old' values

Due to reasons beyond the scope of this question, I'm forced to import data into an SQL Server SDE database using SQL statements (importing using ArcGIS is not possible). The data already contains ...
1
vote
2answers
213 views

Import shapefile to SQL Server 2019 using OGR2OGR

I'm trying to import a shapefile into SQL Server 2019, running his command: ogr2ogr -progress -f "MSSQLSpatial" "MSSQL:server=XXXX;database=test;UID=XXXXX;PWD=XXXX" "MYFILE&...
0
votes
0answers
74 views

Copy tables from Server Database to a Geopackage with no geometry and with geometries using PyQGIS

I am making an application in PyQGIS that uses tables that are on an SQL server. I want to make a copy of all those tables in a local Geopackage, because I want to use my application in my laptop ...
9
votes
3answers
16k views

SQL Server - Select all polygons nested within a larger polygon

This is a seemingly simple SQL Server geometry question that I thought would have an out-of-the box solution, but I'm not having any luck finding one. My intent is to select all the records within ...
1
vote
1answer
34 views

QGIS ODBC connection to mssqlserver returns only filtered data

I am connecting to an MSSQL database table which does not have a geometry type field, but has coordinates in separate columns. The ODBC connection works, but when I bring the table in to QGIS, it is ...
1
vote
0answers
20 views

Disappearing polygons when zooming in Feature Cache extent

I'm currently using ArcMap (v 10.6.1.) and an enterprise geodatabase (v 10.6.0) on SQL Server 2017. I encountered a problem, when I build Feature Cache on full map extent and zoom in to my polygon ...

1
2 3 4 5
18