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
World_Topo_Map (MapServer)
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/xyz/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?