Hello everybody,
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:
REST SERVICE:
# records: 1
OBJECTID: 41602
Point:
X: -7932483.373700001
Y: -3897037.876665604
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!
Hi Evelyn,
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?
-Jacob
1.- version 10.3. What do u mean with if im using DS?
2.- Enterprise GeoDB and i didnt choose to copy the data.
Hi Evelyn,
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?
Thank you,
Jacob
It is the same sql database and is being housed.
What is the projection of data in SQL Server vs the GIS service you are querying?
This is what i have:
WGS_1984_Web_Mercator_Auxiliary_Sphere
WKID: 3857 Authority: EPSG
Projection: Mercator_Auxiliary_Sphere
False_Easting: 0.0
False_Northing: 0.0
Central_Meridian: 0.0
Standard_Parallel_1: 0.0
Auxiliary_Sphere_Type: 0.0
Linear Unit: Meter (1.0)
Geographic Coordinate System: GCS_WGS_1984
Angular Unit: Degree (0.0174532925199433)
Prime Meridian: Greenwich (0.0)
Datum: D_WGS_1984
Spheroid: WGS_1984
Semimajor Axis: 6378137.0
Semiminor Axis: 6356752.314245179
Inverse Flattening: 298.257223563
Hi Evelyn,
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?
Thank you,
Jacob
Both.
Is there any way to verify the coordinate system in the rest service? Because we dont know if it is changing or not.
Thanks in advice.
Hi Evelyn,
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.
Thank you,
Jacob