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,982
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,806
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,031
9 votes
Accepted

SQL Server - Select all polygons nested within a larger polygon

In theory the queries that you have done should return the polygons you said haven't been returned. That makes me suspect that you might be encountering floating point error issues that SQL Server ...
MickyT's user avatar
  • 3,410
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
  • 19.9k
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.8k
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
8 votes
Accepted

How to use LIKE clause/condition in Arcpy.Exists/Delete

Wildcard searching is built into arcpy.ListRasters(): import arcpy arcpy.env.workspace = "c:/base/data.gdb" for raster in arcpy.ListRasters("*_*"): arcpy.Delete_management(raster) If you want ...
Paul's user avatar
  • 11.6k
8 votes

Working around Table does not contain OIDs arcpy Error 000339?

I am getting the same error as you, I have tested your workflow on 10.3.1. I get the error in both cases, when I have the source view is registered with geodatabase and when it's not. Running the ...
Alex Tereshenkov's user avatar
7 votes

Is it possible to reproject spatial data using SQL Server?

Example for reprojection from EPSG:2193 to EPSG:3857 c:\OSGeo4W64\bin\ogr2ogr.exe ^ -f "MSSQLSpatial"^ "MSSQL:server=DestServerName;database=DestDbName;trusted_connection=yes"^ "MSSQL:server=...
Maxim Mikhisor's user avatar
7 votes
Accepted

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

It's not supported (yet). Db manager only supports Postgres, Spatialite and Oracle databases.
ndawson's user avatar
  • 27.4k
7 votes
Accepted

Working around Table does not contain OIDs arcpy Error 000339?

The Copy Rows to in_memory as suggested by @alex-tereshenkov took the processing time for this part of the script down from 2mins+ to 38 seconds, however I have found an even quicker solution that ...
Midavalo's user avatar
  • 29.6k
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,120
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.4k
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
  • 9,809
5 votes
Accepted

Unable to register gdb with the server due to sql server client incompatibility

I was having this same problem after upgrading everything to 10.3. I just dug this up from an old e-mail from ESRI Support. Here is the main part of the information in the e-mail. Regarding SQL ...
jbchurchill's user avatar
  • 4,489
5 votes

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

At least in PostgreSQL it is much faster to do a left or right join on st_intersects instead and use "where id is null" to find those that "don't have a friend" edit: Ok, here comes an example ...
Nicklas Avén's user avatar
5 votes

Mapping SQL tables in ArcGIS Desktop

First, I hope I understand your setup correctly: You have several tables in SQL, some with tabular data and one table containing Lat/Long columns (probably floating/double precision data type). You ...
Sorin RUSU'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.6k
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,861
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 ...
LR1234567's user avatar
  • 10.3k
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
  • 19.9k
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
  • 29.3k
5 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
  • 658
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.3k
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.6k
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
  • 19.9k
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
  • 40.8k
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
  • 805

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