We need to write a map service that returns a static map image in png. The map service will return 25 nearest records from a center point (lat/long input to the service) within 0.25 and 0.5 mile radius (Red and Yellow circle in the map). We are getting different results when using the Google Map and the ArcGIS Map as basemap Layer. Please see below the comparative images to know the difference between the result images. The left side images are generated using Google Map as basemap layer and the right side images are generated using the ArcGIS map as the basemap layer.
This is happening for some locations though, for some locations the maps are identical.
Example No - 1
lat=61.230110000000082 lng=-149.89142999999996
Example No - 2
lat=40.641575 lng=-74.134704
Example No - 3
lat=60.9075 lng=-161.229402
Code
1.Geocode Server find
https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?text=" . $lng . "," . $lat . "&outFields=addr_type&f=json
2. Basemap layer
We have used Map option scale as 18055.954822 for zoom level.
3. Circle layer using symbol
Circle red [ 0.25 mile radius ] size : 175
Circle yellow [ 0.50 mile radius ] size : 350
4. Custom feature server layer data for multi point.
https://services6.arcgis.com/xxxxxxxxxx/ArcGIS/rest/services/Facility_Data/FeatureServer/0/
where=(( 6371 * acos( cos( '.$lat.' * 0.01745 ) * cos( (LATITUDE83) * 0.01745 ) * cos( ((LONGITUDE8) * 0.01745) - ('.$lng.' * 0.01745) ) + sin( '.$lat.' * 0.01745) * sin( (LATITUDE83) * 0.01745 ) ) ) ) / 1.60934 <= .5
5. Then sorting
$sort = array();
foreach($features as $key => $value){
$xa = $value['geometry']['x'];
$ya = $value['geometry']['y'];
$id = $value['attributes']['OBJECTID'];
$pi = pi() / 180.0;
$dis = (( 6371 * acos( cos( $lat * $pi ) * cos( $ya * $pi ) * cos( ($xa * $pi) - ($lng * $pi) ) + sin( $lat * $pi) * sin( $ya * $pi ) ) ) ) / 1.60934;
$sort[$id] = $dis;
$data[$id] = $value;
}
asort($sort);
Can you please guide on what is the problem here?
Could it be a projection issue?
Thanks Jennifer for the reply.
That is very much possible. But is there a way we could control the projection in ArcGIS Basemap?
To me it looks like that the main difference between these two cases are that the circles in the google map is exactly maintaining the 0.25 and 0.5 miles radius as we are passing these parameter in miles while calling the API, so even in cases when of the zoom level changes, the circles may show up in smaller or bigger sizes but the points are never outside the designated circle as their physical location over the map is never changed. But in case of the ArcGIS map we are not able to send the 0.25 and 0.5 miles as parameter to draw the circles. We are drawing the circles by calculating the pixel radius and trying to match with the physical distance. So the map draws the circle measuring the pixel, it does not consider the actual physical distance. So it is geometrically correct but if the basemap layer is not projected exactly like google map as you have anticipated or in some other way it is tilted, then the circles are far from "geospacially" correct.
Can you please advise?