My request to geocode Rome, Italy, returns this:
{"spatialReference":{"wkid":4326,"latestWkid":4326},"locations":[
{"name":"Roma, Latium, Italy", "extent":{"xmin":12.389896,"ymin":41.800739,"xmax":12.577896,"ymax":41.988739},"feature":{"geometry":{"x":12.483895995000069,"y":41.894738560000064}, "attributes":{"Type":"National Capital","Match_addr":"Roma, Latium, Italy","Addr_type":"POI"}}},
{"name":"Roma, Latium, Italy", "extent":{"xmin":12.389896,"ymin":41.800739,"xmax":12.577896,"ymax":41.988739},"feature":{"geometry":{"x":12.483895995000069,"y":41.894738560000064}, "attributes":{"Type":"National Capital","Match_addr":"Roma, Latium, Italy","Addr_type":"POI"}}},
{"name":"Roma, Latium, Italy", "extent":{"xmin":12.389896,"ymin":41.800739,"xmax":12.577896,"ymax":41.988739},"feature":{"geometry":{"x":12.483895995000069,"y":41.894738560000064}, "attributes":{"Type":"National Capital","Match_addr":"Roma, Latium, Italy","Addr_type":"POI"}}},
{"name":"Roma, Latium, Italy", "extent":{"xmin":12.389896,"ymin":41.800739,"xmax":12.577896,"ymax":41.988739},"feature":{"geometry":{"x":12.483895995000069,"y":41.894738560000064}, "attributes":{"Type":"National Capital","Match_addr":"Roma, Latium, Italy","Addr_type":"POI"}}}
]}
Here is the request URL.
The entries all appear to be duplicates. Is there a reason for this?
Yes. The reason is alternate names for the same place.
If you modify your request to return all fields, you will find that the following fields are different across the four results:
The key difference is the City value. It's giving you four different spellings for Rome (Roma, Rome, Roeme, and Rom). The reason is so that the place can be found when searching for any of its various spellings.
You're most likely to see multiple results when searching for global cities, like Rome or New York (a.k.a. Nova York, Nova Iorque, etc.), since they are the ones that tend to have names in multiple languages.
As one of the comments suggests, you can work around this behavior by setting maxLocations
to 1. The results are sorted by rank, so you'll get likely the best result at the top of the list.