I am having some issue when i try to get the X, Y from a SHAPE saved in a sql server database.
For example, in the rest service, in a layer of points i have the following data saved for a point:
# records: 1
If i try to get the same point (oid 41602) from a SQL Database using this sentence:
SELECT SHAPE.STY AS LAT, SHAPE.STX AS LON FROM MYTABLE
WHERE OBJECTID = 41602
I got this result
How u can see, the X coord is the same, but the Y coor is not.
Why am i getting this difference? How can i fix it to get the same as the REST service but in my sql server?
Thanks in advice!
Please answer the following questions:
1. What version of ArcGIS GIS Server are you using? Are you utilizing the ArcGIS Data Store as the managed database for your ArcGIS GIS Server?
2. What is the data source of the REST service that you are consuming? Is the data coming from an Enterprise Geodatabase or File Gedoatabase that is registered with ArcGIS GIS Server? Did you choose to copy data to the server when publishing the service?
The goal of my questioning is essentially to try to understand the location of the data source for the REST service that you are working with. For instance, if your data was being copied into the ArcGIS Data Store during the publishing process vs being housed in a registered Enterprise Geodatabase or File Geodatabase, this would have implications for how your SQL statements should be formatted for your queries.
What is the underlying RDBMS of your Enterprise Geodatabase that your data is located in? Is this the SQL Server database that you are referencing above?
This is what i have:
WKID: 3857 Authority: EPSG
Linear Unit: Meter (1.0)
Geographic Coordinate System: GCS_WGS_1984
Angular Unit: Degree (0.0174532925199433)
Prime Meridian: Greenwich (0.0)
Semimajor Axis: 6378137.0
Semiminor Axis: 6356752.314245179
Inverse Flattening: 298.257223563
As Joshua Bixby has alluded to, the discrepancy that you are seeing could be due to a difference in spatial reference between the data that is stored in your Enterprise Geodatabase vs. the REST service. Is the spatial reference information that you are showing here associated with the REST service, the Enterprise Geodatabase Feature Class, or both?
Was the Enterprise Geodatabase data's projection changed prior to publishing it as a service?
You should be able to find the spatial reference information for the REST service at the REST Endpoint of that particular service. The "Well-Known ID" (WKID) for the spatial reference associated with the service will be located within a parameter at the REST Endpoint called "Spatial Reference".
For an example, please see the following URL: https://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer
You will see the "Spatial Reference" parameter listed on this page upon visiting the above URL.