Find a Location by Query, restricted to a specific country RRS feed

  • Question

  • Hello,

    how can I make a request with query=xxx ,but restricted to a specific country?

    If I add at the end of each query string " Germany", the service returns Germany if no other match is found.And, second question, can I build a query that returns only streets, no cities or countries.



    Wednesday, April 27, 2016 2:16 PM


  • You would need to append ", Germany" to your query. As you mentioned this means that if a location isn't found that a result for Germany will be returned. This is to be expected. However all of your above requirements can be achieved with the response that does come back (documented here). The result object has several useful properties that you can use;

    • entityType - Tells you the what the result is; Address, RoadBlock, Locality (city), CountryRegion...
    • matchCodes - Tells you how the result is matched to query; Good, Ambiguous, UpHierarchy

    Using these you can easily determine the information you need to answer both your questions. For example, if a user queried a street in Germany and Germany was the result, the entityType would be CountryRegion and the match ode would be UpHierarchy match code.

    [Blog] [twitter] [LinkedIn]

    Wednesday, April 27, 2016 5:48 PM