New answers tagged

1

So I figured it out - @Yanes was close but instead of three sets of double quotes, it needed to be double-single-double. So the following script works: -- Turn ReportsTable into a View Table arcpy.MakeTableView_management(ReportsTable, ViewTable) -- Get start and end times for report start_time= datetime.timedelta(hours = 24) end_time = ...


1

Try wrapping your Where statement with three double quotations so that Arcpy understands it as an expression for your select function not a standalone SQL task - I may be wrong on the reasoning, I will check. SQL = """ "created_date" >= '{}'""".format(report_time.strftime('%Y-%m-%d %H:%M:%S')) ...


0

Awesome answer! Wrapping up those code snippets into a SQL agent job or a SSRS report that shows the lineage stats daily, or fires an email when they pass a certain value, would make for a great maintenance plan!


2

I'm afraid this is more of a personal preference than a best practices issue. You have many choices: Create the spatial table in database A with SQL tools, and access it though Query Layers Create the spatial table in database B with SQL tools, and access it through Query Layers Create the spatial table in database B with SQL tools, and register it with ...


2

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=SourceServerName;database=SourceDbName;trusted_connection=yes"^ -sql "SELECT [Id], [Shape].STAsText() Shape FROM [SourceDbName].[dbo].[SourceTableName]"^ -nln ...


1

I have also noticed that QGIS up to my current version (2.12.2) appears to have a problem loading MSSQL geometries of type "GeometryCollection", when you would expect Polygons or Multipolygons. To check if you have these, use: SELECT GEOM.STGeometryType() FROM [yourtable]


3

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 would like to join several data tables together and see the information as points in ArcGIS. Possible solution: You should make your join/view directly in ...


0

I believe the issue is that your table "dbo.My_View" is not defined in a GEOMETRY_COLUMNS table in the MSSQL database. If you use OGR2OGR or Qgis to import a layer into MSSQL, that will automatically create the table for you. Once you have it, fill out the proper values for the table you are trying to add to QGIS. In this case, "dbo.My_View". Once you ...


2

First some associations. From the postgis docs. geometry <-> plane geography <-> sphere Make sure the intersection is calculated using geometry data types. See the docs on STIntersection. Convert/Typecast if necessary. Since you only want a simple intersection I don't think you need to reproject. If you want your output in geography you might need ...



Top 50 recent answers are included