Why the Select By Location analysis calculates distance in a wrong way?

I want to select cities, which are within a distance of 200 km from my pre-selected city. However my result depends on whether I'm creating a buffer and use it to clip the cities (good result) or use the Select by Location analysis and supply it with the same data. My ArcGIS version is 10.2.1.

I figured out that the problem is that the analysis doesn't consider the data in a sphere (geographical) way, but in a planar (geometry) way. What I mean by that is, it calculates distance as in XY coordinates, so that the supposed buffer representing the distance has a perfect disk shape, which in Y direction is OK, however in X the results are tottaly wrong), meanwhile my data is geographical one and it uses deegrees (the data is in WGS84).

I made an experiment and created a buffer in PostGIS on the data imported as geometry, not geography and the result corresponds perfectly to the distance Select By Location uses. I've also created a buffer and used it to clip the cities and the result is correct.

I'm attaching the following files:

• cities (a layer with some alaskan cities)
• sel_city (a layer with a pre-selected city for the buffer)
• city_buff200 (correct buffer create in ArcMap)
• buff200_exp (buffer created in postgis, when data type was set as geometry and not geography) [this is a representation of the wrong distance buffer used by select by location]
• cit_within200 (a layer with cities extracted using an incorrect distance representation)
• cities_buff200_inter2 (correct result)

The code which I used to create the incorrect result is following:

cities_lyr = arcpy.mapping.Layer(cities)
arcpy.SelectLayerByLocation_management(cities_lyr, "WITHIN_A_DISTANCE", selected_city, "200 kilometers", "NEW_SELECTION")
arcpy.CopyFeatures_management(cities_lyr, "cit_withi200")

• You need to project your data in PROJECTED coordinate system (not GEOGRAPHIC coordinate system, e.g. WGS84) – SIslam Jan 26 '15 at 12:29
• @msi_g Is there any reason why I need to do that? The documentation stays dead silent about that and states: "This tool evaluates a spatial relationship in the coordinate system of the Input Feature Layer data source (the feature class on disk). Set the output coordinate system environment to evaluate the spatial relationship in a different coordinate system." from desktop.arcgis.com/en/desktop/latest/tools/… – Michal Jan 26 '15 at 12:37