10 July 2023
Getting latitude and longitude of objects (SQL)
Below is an example of using the Geometry object defined by the OGC standard to geoprocess a
layer and get the latitude and longitude of objects.
We take a look at how to get the following information:
- object ID
- name of the type and mode from the layer structure
- WKT representation of geometry defined by the OGC standards
- graphic object type according to the OGC standard
- latitude and longitude of the symbol
- latitude and longitude of the first polyline point
- rounded longitude of the polyline endpoint
- longitude of the penultimate polyline point
To get information about the latitude and longitude of objects, a suitable projection other than the Non-Earth projection must be assigned to the layer.
Select
sys,
“Type-“ + typename +" Mode-“+ modename as “Type and Mode”,
Geometry.AsTextWGS84() as “WKT representation of geometry”,
geometry.GeometryType() as "OGC object type", ,
geometry.Y_WGS84() as "Symbol latitude",
geometry.X_WGS84() as "Symbol latitude",
geometry.StartPoint().Y_WGS84() as "Latitude of the first polyline point",
geometry.StartPoint().X_WGS84() as "Longitude of the first polyline point",
round(geometry.EndPoint().X_WGS84(),3) as "Longitude of the polyline endpoint",
geometry.PointN(geometry.NumPoints()-1).X_WGS84() as "Longitude of the penultimate polyline point"
from [Sample Heat Network]