Skip to main content
12 votes

MSSQL Connection settings for QGIS on Windows

In 2.16... (some really basic information I struggled to find and a note about an unhelpful error message) The 'Connection Name' is a name for our own use. The 'Provider/DSN' field can be left blank....
Rostranimin's user avatar
  • 2,990
11 votes
Accepted

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

SQL Server's STDistance function does not compute geodesic distances. Its algorithm essentially generates straight lines in 3D, densifies them and maps them on the ellipsoid in a manner described more ...
FSimardGIS's user avatar
  • 3,846
10 votes

Create a geography/geometry column from x and y fields - SQL Server 2008

SQL Server 2012 You can do it like this, SELECT geography::Point(lat, long, 4326) For more information see my post on Database Administrators, "SQL Server Point Constructor or version of ST_Point(x,...
Evan Carroll's user avatar
  • 7,091
9 votes
Accepted

enable enterprise geodatabase error

A google on "ArcGIS READ_COMMITTED_SNAPSHOT ALLOW_SNAPSHOT_ISOLATION" returned a "What's new in ArcMap" 10.4 documentation reference. In the Geodata section it states (third bullet, emphasis mine): ...
Vince's user avatar
  • 20.2k
9 votes
Accepted

Using the MOD expression on an SQL Feature Class is not possible?

The mod keyword is not recognised by SQL Server. For modulo function, you'll need to reformat the expression like so: contour % 50 = 0
Fezter's user avatar
  • 21.9k
9 votes

Importing Shapefile geometry into SQL Server 2016?

Adding to klewis's answer: I got shape2sql.exe to work by adding a Shape2Sql.exe.config file with the following contents: <?xml version="1.0" encoding="utf-8"?> <configuration> <...
Brad's user avatar
  • 91
6 votes

The layer is not a valid layer and can not be added to the map - QGIS WFS

For debugging going to Menu -> View -> Panels -> Log Messages Panel worked for me. In the error log panel showing up, go to WFS-Tab and check for any error messages. It's not very verbose but ...
ulrich's user avatar
  • 1,170
6 votes
Accepted

Downloading the Geoserver SQL Server Extension

You can grab it from this site. Navigate through by selecting the version of GeoServer you're on, and get the latest for that version. So, for version 2.13, you can get it here: https://build....
Alex Leith's user avatar
  • 13.5k
6 votes

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

I'm not sure this is the most efficient way of doing it, but it certainly works: SELECT geography::STGeomFromText([geom].STAsText(),4326) where 4326 is the spatial reference ID (SRID)
PeterS's user avatar
  • 678
6 votes
Accepted

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

You can drag and drop the layer directly into the database seen in browser. Just have a look to this video:
eurojam's user avatar
  • 11.1k
5 votes
Accepted

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

I have stumbled on this issue lately, and if you set the MSSQLSPATIAL_USE_GEOMETRY_COLUMNS environment variable to NO, then the error message disappears. Related documentation here. Hope it helps ...
Benedek Simo's user avatar
5 votes
Accepted

Error when using arcpy.ArcSDESQLExecute() to connect to SQL Server - ArcGIS 10.4

Use sde:sqlserver:mymachinename for your server instance arcpy.ArcSDESQLExecute(server='mymachinename', instance='sde:sqlserver:mymachinename', database='mydbname', user='myuser',password='mypass') ...
Midavalo's user avatar
  • 29.8k
5 votes
Accepted

Geography for Sql Server STIsValid() getting error

STIsValid() was added to the Geography type with SQL Server 2012. If you are using SQL Server 2008 this method only exists for the Geometry data type
Peter Horsbøll Møller's user avatar
5 votes
Accepted

Is it possible to convert from Microsoft's format to WKB?

Yes, STAsBinary() will return WKB. https://msdn.microsoft.com/en-us/library/bb933912.aspx
HeyOverThere's user avatar
  • 7,871
5 votes
Accepted

Import SQL Server Spatial Data into PostGIS

You can also use ogrfdw foreign data wrapper which piggy backs on GDAL. That's what I use for my SQL Server / to PostGIS import needs. https://github.com/pramsey/pgsql-ogr-fdw It's installed as ...
Regina Obe's user avatar
  • 10.6k
5 votes

Working on databased-stored-geodatabase with a ArcGIS for Desktop standard license?

The two highlighted passages do not contradict each other, they're merely referring to different capabilities. The first passage explains that Standard or Advanced seats of ArcGIS Desktop can ...
Vince's user avatar
  • 20.2k
5 votes
Accepted

Export spatial data from SQL Server to ESRI shapefile

If that is the exact command copied from your terminal, you simply need to be more careful with the spelling; there are spaces between quotation marks and the output file string. Try and replace your ...
geozelot's user avatar
  • 30.4k
5 votes
Accepted

Native JAI is false in geoserver

The docs are old and native JAI is on the "way of the dodo", I believe in most of our installations we are not adding it anymore (mostly because it does not have some basic fixes present in jai-ext ...
Andrea Aime's user avatar
  • 17.5k
5 votes
Accepted

ArcGIS Pro cannot read SQL Server databases with "-" in their name

Esri states this as a limitation for geodatabases on their Enterprise geodatabase size and name limits page. Character type limits in object names Database management systems have different ...
Jay Cummins's user avatar
  • 14.7k
5 votes
Accepted

Performance of arcpy.Exists() in SQL Server enterprise gdb environment

One of the interesting quirks of many SQL client APIs is the lack of a "table exists" function. Many implementations of an "exists" are really a low-level "describe", which returns a "does not exist" ...
Vince's user avatar
  • 20.2k
5 votes
Accepted

Non-spatial SQL Server table with X,Y fields directly in QGIS?

You can create a virtual layer in QGIS that builds the geometry. Changes to the data source should be reflected upon panning/refreshing the attribute table. Go to the menu layer / Add layer / Add-...
JGH's user avatar
  • 42.3k
5 votes

"Driver not loaded Driver not loaded" when trying to connect to MSSQL database in QGIS 3.8 on MacOS

When you click "Test Connection" you get the "Driver not loaded Driver not Loaded" error at the top. However, if you ignore the Test Connection button, and instead click the "...
Brian B's user avatar
  • 815
5 votes
Accepted

GDAL ogr2ogr into SQL Server Bulk Insert (BCP) not working

The solution was to download GDAL from GIS Internals as suggested by J├╝rgen Zornig in this question. Downloading GDAL from the OSGEO4W network installer, does not seem to activate the SQL Server bulk ...
spagbol's user avatar
  • 71
4 votes

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

I've been having the same issue while migrating an existing script from a test machine (Win7) to a new server (Win Server 2012), therefore I knew the syntax and spelling were correct. On the non-...
BStone's user avatar
  • 503
4 votes
Accepted

Finding SDE permissions on feature class using ArcPy?

I didn't find a pre-built tool to do this, but ended up using the following code which was easy enough to then query the dictionary to pass to arcpy.ChangePrivileges_management() import arcpy def ...
Midavalo's user avatar
  • 29.8k
4 votes
Accepted

subtract polygons from other polygons with SQL

If you are working with SQL Server 2012+ then you should be able to do this within a single query. Don't expect it to be very performent, but do make sure that you have all the appropriate indexes (...
MickyT's user avatar
  • 3,430
4 votes

Copy Enterprise Geodatabase to new SQL Server - will it work?

Yes, you can take a backup of an SDE geodatabase and move it to a new server, but it's a bit tricky. We regularly do this for SDE geodatabases with PostgreSQL. The biggest caveat is you cannot rename ...
Radar's user avatar
  • 10.7k
4 votes

Why does rendering from a view take significantly longer than rendering from a table?

I believe that the underlying query (used to make the view) will be executed every time you try to access the view, where if you are just using the source table the select will much simpler. This ...
Heath's user avatar
  • 91
4 votes
Accepted

Finding spatial views with ArcPy?

@Vince pointed out the arcpy.ArcSDESQLExecute command. Here is a function I put together to return True/False for finding a Spatial View, based on the code sample from http://pro.arcgis.com/en/pro-...
RyanKDalton's user avatar
  • 23.1k
4 votes
Accepted

Error occured during an attempt to connect 10.1 SDE geodatabase on SQL Server from ArcMap 10.5

While it is technically possible for ArcGIS 10.5 to connect to ancient geodatabase releases as far back as 10.1 (according to the compatibility matrix), there is a caveat in the support policy for ...
Vince's user avatar
  • 20.2k

Only top scored, non community-wiki answers of a minimum length are eligible