HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

SQL Server Point Constructor or version of ST_Point(x,y)?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
pointsqlversionst_pointconstructorserver

Problem

PostGIS provides two point-constructors

  • ST_MakePoint(x,y,[z,[m]])



  • ST_Point(x,y)or the compliant version that does not support 3DZ or 4D



MySQL supports Point(x,y)

In SQL Server, Is there anyway to construct a point from two numeric inputs or reals without going from text first?

I do not see a constructor that takes numbers
in the docs on "Create, Construct, and Query geometry Instances".

Solution

SQL Server 2012+

Yes, it's not listed there though. You'll find it documented on the docs of geography::Point(x,y,srsid)

The following example uses Point() to create a geography instance.

geography::Point(47.65100, -122.34900, 4326)


Microsoft calls it an "Extended Static Geography Methods"

It's documented in the SqlGeography Class and the Geometry constructor in the SqlGeometry Class

Code Snippets

geography::Point(47.65100, -122.34900, 4326)

Context

StackExchange Database Administrators Q#188246, answer score: 6

Revisions (0)

No revisions yet.