Hi,
I am trying to find distance between two points using the following API.
I'm getting below error :
{"error":{"code":400,"message":"Unable to complete operation.","details":["The input points are not all located within a single region."]}}
Please let me know how to resolve this.
I believe your longitude and latitude pairs are in the ocean and not in North America. Also longitude should be negative for NA.
I believe both sets of coordinates are in Japan, which would be positive longitude as specified. Only 1 pair in Japan.
I was considering that possibility. I thought one might be Japan and the other Poland. If so, this would be between Europe and Japan (and thus between 2 regions). I think the NAServer is just for the North America region.
I believe this service is looking for a driving route between locations. If a straight line distance is desired, using a great circle or Dan Patterson's Vincenty calculator would be an easier solution.
You are right, I mistyped one of the coordinate pairs. I agree, one is in Japan and the other Poland.
The NAServer doesn't mean North America, although the acronym does line up, I think it is "network analyst" since that is the server that does routing.
Realizing that one point is in Japan and the other Poland, the error message makes a bit more sense. The routing is setup by regions, and there are certain regions that cannot be routed between. For example, if you try to route between a random point in the middle of North America and a random point in South America, you won't be able to route between them.
"Network Analyst" makes sense in the URL path. Perhaps our comments will also make sense to the OP.
Hi Randy Burton and Joshua,
Thanks for your reply. So to calculate only distance does not ESRI provide any direct API?
When you say distance, are you thinking/referring to "as a crow flies" or straight line? Since you are using the World Route service, I think commentors assumed you were interested in travel or routed distance.
Hi Joshua,
Thanks. Yes I actually want a straight line distance between two latlons.
As Randy Burton points out, use the Geometry Service and not Network Service. Here is an example URL using the Geometry Service and your coordinates: