<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: STX Sql Server Geometry Query returns Longitude of 278?? in Geodatabase Questions</title>
    <link>https://community.esri.com/t5/geodatabase-questions/stx-sql-server-geometry-query-returns-longitude-of/m-p/1501644#M9146</link>
    <description>&lt;P&gt;While latitude has hard limits on values ([-90,90]), longitude does not. &lt;EM&gt;pi&lt;/EM&gt; radians is equivalent in every way to &lt;EM&gt;3pi&lt;/EM&gt; radians and &lt;EM&gt;2pi&lt;/EM&gt;, &lt;EM&gt;0&lt;/EM&gt;, and &lt;EM&gt;-2pi&lt;/EM&gt; are equivalent as well. There may be limitations in storage of coordinate values in SQL Server, which, like Esri's ST_Geometry, uses integer internal representation, but values between -360 degrees and +360 degrees ought to be safe.&lt;/P&gt;&lt;P&gt;STDistance(), if done correctly for geodesic values, should not find any distance at all between&amp;nbsp;&lt;SPAN&gt;278.440065912902 and -81.559934087098 with the same latitude. Measuring in Cartesian degrees is of course useless for all purposes.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So it seems your problem is not with the longitude values but with distance measurement. You would need to edit or reply to your own post with a more specific description of that issue to get a useful answer.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- V&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Jul 2024 18:15:07 GMT</pubDate>
    <dc:creator>VinceAngelo</dc:creator>
    <dc:date>2024-07-04T18:15:07Z</dc:date>
    <item>
      <title>STX Sql Server Geometry Query returns Longitude of 278??</title>
      <link>https://community.esri.com/t5/geodatabase-questions/stx-sql-server-geometry-query-returns-longitude-of/m-p/1501384#M9144</link>
      <description>&lt;P&gt;I have a query on table that contains a geometry type named shape:&lt;/P&gt;&lt;P&gt;select shape.STX from Vehicle;&lt;/P&gt;&lt;P&gt;The return value I get is: 278.440065912902&lt;/P&gt;&lt;P&gt;Any ideas how I could end up with a Geometry column in a SQL table with such a result? I get the data from Geoevent which comes from Verizon. Verizon passes me a shape (geometry) and also a lat and long column. The lat and long columns are correct. However, when I try to use a select statement to see the longitude using STX, I get this weird result. If I use shape.STX - 360 I get the correct longitude. I'm puzzled.&lt;/P&gt;&lt;P&gt;I need to be able to use the shape column in an STDistance() query to see how far away my vehicles are from a work order task on another object on our map. Obviously, with a longitude value of 278... the STDistance is giving me erroneous information.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: when querying for shape.STY I get the correct latitude. So only the longitude is wrong in the shape column??&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2024 22:29:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/stx-sql-server-geometry-query-returns-longitude-of/m-p/1501384#M9144</guid>
      <dc:creator>ScottMinter</dc:creator>
      <dc:date>2024-07-03T22:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: STX Sql Server Geometry Query returns Longitude of 278??</title>
      <link>https://community.esri.com/t5/geodatabase-questions/stx-sql-server-geometry-query-returns-longitude-of/m-p/1501644#M9146</link>
      <description>&lt;P&gt;While latitude has hard limits on values ([-90,90]), longitude does not. &lt;EM&gt;pi&lt;/EM&gt; radians is equivalent in every way to &lt;EM&gt;3pi&lt;/EM&gt; radians and &lt;EM&gt;2pi&lt;/EM&gt;, &lt;EM&gt;0&lt;/EM&gt;, and &lt;EM&gt;-2pi&lt;/EM&gt; are equivalent as well. There may be limitations in storage of coordinate values in SQL Server, which, like Esri's ST_Geometry, uses integer internal representation, but values between -360 degrees and +360 degrees ought to be safe.&lt;/P&gt;&lt;P&gt;STDistance(), if done correctly for geodesic values, should not find any distance at all between&amp;nbsp;&lt;SPAN&gt;278.440065912902 and -81.559934087098 with the same latitude. Measuring in Cartesian degrees is of course useless for all purposes.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So it seems your problem is not with the longitude values but with distance measurement. You would need to edit or reply to your own post with a more specific description of that issue to get a useful answer.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- V&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 18:15:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/stx-sql-server-geometry-query-returns-longitude-of/m-p/1501644#M9146</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2024-07-04T18:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: STX Sql Server Geometry Query returns Longitude of 278??</title>
      <link>https://community.esri.com/t5/geodatabase-questions/stx-sql-server-geometry-query-returns-longitude-of/m-p/1502945#M9153</link>
      <description>&lt;P&gt;Attached is an image of the query I'm running. The important fact is that the Longitude that is passed from Verizon as a column is accurate.&lt;/P&gt;&lt;P&gt;The longitude when using the &lt;STRONG&gt;STX&lt;/STRONG&gt; function is different and causing the STDistance to give an inaccurate result.&lt;/P&gt;&lt;P&gt;Query:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;SELECT&lt;/SPAN&gt; v&lt;SPAN&gt;.&lt;/SPAN&gt;Latitude &lt;SPAN&gt;as&lt;/SPAN&gt; VehicleLatPassedFromVerizon&lt;SPAN&gt;,&lt;/SPAN&gt; v&lt;SPAN&gt;.&lt;/SPAN&gt;Longitude &lt;SPAN&gt;as&lt;/SPAN&gt; VehicleLongPassedFromVerizon&lt;SPAN&gt;,&lt;/SPAN&gt; v&lt;SPAN&gt;.&lt;/SPAN&gt;shape&lt;SPAN&gt;.&lt;/SPAN&gt;STX &lt;SPAN&gt;as&lt;/SPAN&gt; VehicleLongUsingTsqlNeededForDistance&lt;SPAN&gt;,&lt;/SPAN&gt; v&lt;SPAN&gt;.&lt;/SPAN&gt;shape&lt;SPAN&gt;.&lt;/SPAN&gt;STY &lt;SPAN&gt;as&lt;/SPAN&gt; VehicleLatUsingTsql&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;v&lt;SPAN&gt;.&lt;/SPAN&gt;shape&lt;SPAN&gt;.&lt;/SPAN&gt;STAsText&lt;SPAN&gt;()&lt;/SPAN&gt; VehicleShapeText&lt;SPAN&gt;,&lt;/SPAN&gt;geoshape&lt;SPAN&gt;.&lt;/SPAN&gt;STAsText&lt;SPAN&gt;()&lt;/SPAN&gt; WOGeoshapeText&lt;SPAN&gt;,&lt;/SPAN&gt; v&lt;SPAN&gt;.&lt;/SPAN&gt;shape &lt;SPAN&gt;as&lt;/SPAN&gt; VehicleShape&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;geoshape &lt;SPAN&gt;as&lt;/SPAN&gt; WOGeoshape&lt;SPAN&gt;,&lt;/SPAN&gt;geoshape&lt;SPAN&gt;.&lt;/SPAN&gt;STX &lt;SPAN&gt;as&lt;/SPAN&gt; WOLatFromShape&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;geoshape&lt;SPAN&gt;.&lt;/SPAN&gt;STY &lt;SPAN&gt;as&lt;/SPAN&gt; WOLongFromShape&lt;SPAN&gt;,&lt;/SPAN&gt; geoshape&lt;SPAN&gt;.&lt;/SPAN&gt;STSrid WOSrid&lt;SPAN&gt;,&lt;/SPAN&gt; shape&lt;SPAN&gt;.&lt;/SPAN&gt;STSrid VehicleSrid&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;geoshape&lt;SPAN&gt;.&lt;/SPAN&gt;STDistance&lt;SPAN&gt;(&lt;/SPAN&gt;v&lt;SPAN&gt;.&lt;/SPAN&gt;SHAPE&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;[Distance between WO Task and Vehicle]&amp;nbsp;&lt;SPAN&gt;FROM&lt;/SPAN&gt; [Elements]&lt;SPAN&gt;.&lt;/SPAN&gt;[dbo]&lt;SPAN&gt;.&lt;/SPAN&gt;[WM_ServiceOrders_WorkItems_Tasks] t&lt;SPAN&gt;,&lt;/SPAN&gt; [ArcSDE]&lt;SPAN&gt;.&lt;/SPAN&gt;dbo&lt;SPAN&gt;.&lt;/SPAN&gt;VEHICLE v&amp;nbsp;&lt;SPAN&gt;where&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;taskid &lt;SPAN&gt;in&lt;/SPAN&gt; &lt;SPAN&gt;(&lt;/SPAN&gt;404565&lt;SPAN&gt;,&lt;/SPAN&gt;407063&lt;SPAN&gt;)&lt;/SPAN&gt; &lt;SPAN&gt;and&lt;/SPAN&gt; &lt;SPAN&gt;(&lt;/SPAN&gt;v&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Label&lt;/SPAN&gt; &lt;SPAN&gt;like&lt;/SPAN&gt; &lt;SPAN&gt;'%Patrick%'&lt;/SPAN&gt; &lt;SPAN&gt;or&lt;/SPAN&gt; v&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Label&lt;/SPAN&gt; &lt;SPAN&gt;like&lt;/SPAN&gt; &lt;SPAN&gt;'%Jasen%'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So in this example, Verizon is sending me a column from the GPS device named longitude with a value =&amp;nbsp;-82.00294200. However, when I use the SQL Server STX function on the vehicle shape Verizon is sending I get something different and I don't understand why. v.shape.STX = 277.997153412551.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I take v.Shape.STX - 360 it equals -81.00294200. I noticed this, but don't know what it means. I know if I plot the vehicles location on Google Maps using the longitude of 277.997153412551 instead of -81.00294200 the point will show up in a different place on the earth vs using the longitude of -81. So the STDistance is giving me an incorrect value.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 12:48:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/stx-sql-server-geometry-query-returns-longitude-of/m-p/1502945#M9153</guid>
      <dc:creator>ScottMinter</dc:creator>
      <dc:date>2024-07-09T12:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: STX Sql Server Geometry Query returns Longitude of 278??</title>
      <link>https://community.esri.com/t5/geodatabase-questions/stx-sql-server-geometry-query-returns-longitude-of/m-p/1503123#M9155</link>
      <description>&lt;P&gt;&lt;SPAN&gt;When using the Geography data type the distance results are returned in meters while with the Geometry data type the results are reported in decimal degrees.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This fact was unknown to me and was the root of my issue. I'm a software engineer learning about GIS....still lots to learn.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Casting the geometry given from Verizon into a Geography type was the solution. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The backstory is our WO system vendor changed their coordinate system to always use WKID 4326. This led to many changes and finally got me to the stored procedure that calculated the distance between our WO and the vehicle. Had to change the coordinate system of the vehicle layer to use Srid 4326 first because STDistance will return 0 every time if the coordinate systems are different. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Solution query by recasting to a geography type:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;SELECT&lt;/SPAN&gt; &lt;SPAN&gt;round&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;geography&lt;/SPAN&gt;&lt;SPAN&gt;::&lt;/SPAN&gt;Point&lt;SPAN&gt;(&lt;/SPAN&gt;geoshape&lt;SPAN&gt;.&lt;/SPAN&gt;STY&lt;SPAN&gt;,&lt;/SPAN&gt;geoshape&lt;SPAN&gt;.&lt;/SPAN&gt;STX&lt;SPAN&gt;,&lt;/SPAN&gt;4326&lt;SPAN&gt;).&lt;/SPAN&gt;STDistance&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;geography&lt;/SPAN&gt;&lt;SPAN&gt;::&lt;/SPAN&gt;Point&lt;SPAN&gt;(&lt;/SPAN&gt;v&lt;SPAN&gt;.&lt;/SPAN&gt;Shape&lt;SPAN&gt;.&lt;/SPAN&gt;STY&lt;SPAN&gt;,&lt;/SPAN&gt;v&lt;SPAN&gt;.&lt;/SPAN&gt;Shape&lt;SPAN&gt;.&lt;/SPAN&gt;STX&lt;SPAN&gt;,&lt;/SPAN&gt;4326&lt;SPAN&gt;))/&lt;/SPAN&gt;1609.34&lt;SPAN&gt;,&lt;/SPAN&gt;1&lt;SPAN&gt;)&lt;/SPAN&gt; &lt;SPAN&gt;as&lt;/SPAN&gt; MilesFromWO&amp;nbsp;&lt;SPAN&gt;FROM&lt;/SPAN&gt; [Elements]&lt;SPAN&gt;.&lt;/SPAN&gt;[dbo]&lt;SPAN&gt;.&lt;/SPAN&gt;[WM_ServiceOrders_WorkItems_Tasks] t&lt;SPAN&gt;,&lt;/SPAN&gt; [ArcSDE]&lt;SPAN&gt;.&lt;/SPAN&gt;dbo&lt;SPAN&gt;.&lt;/SPAN&gt;VEHICLE v&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;where&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;taskid &lt;SPAN&gt;in&lt;/SPAN&gt; &lt;SPAN&gt;(&lt;/SPAN&gt;404565&lt;SPAN&gt;)&lt;/SPAN&gt; &lt;SPAN&gt;and&lt;/SPAN&gt; v&lt;SPAN&gt;.&lt;/SPAN&gt;Latitude &lt;SPAN&gt;is&lt;/SPAN&gt; &lt;SPAN&gt;not&lt;/SPAN&gt; &lt;SPAN&gt;null&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 17:36:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/stx-sql-server-geometry-query-returns-longitude-of/m-p/1503123#M9155</guid>
      <dc:creator>ScottMinter</dc:creator>
      <dc:date>2024-07-09T17:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: STX Sql Server Geometry Query returns Longitude of 278??</title>
      <link>https://community.esri.com/t5/geodatabase-questions/stx-sql-server-geometry-query-returns-longitude-of/m-p/1503127#M9156</link>
      <description>&lt;P&gt;A helpful link:&amp;nbsp;&lt;A href="https://www.benjaminspaulding.com/2012/10/29/stdistance-spatial-sql/" target="_blank"&gt;https://www.benjaminspaulding.com/2012/10/29/stdistance-spatial-sql/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 17:38:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/stx-sql-server-geometry-query-returns-longitude-of/m-p/1503127#M9156</guid>
      <dc:creator>ScottMinter</dc:creator>
      <dc:date>2024-07-09T17:38:49Z</dc:date>
    </item>
  </channel>
</rss>

