question

EdwardSwangren-5905 avatar image
0 Votes"
EdwardSwangren-5905 asked SatishBoddu-MSFT commented

Azure Maps API - require exact match from /address/structured

My use case is simple; I have a country code and a postal code. I want lat/lon back. Take the following query:

https://atlas.microsoft.com/search/address/structured/json?subscription-key={key}&api-version=1.0&postalCode=Thomas&countryCode=US

This returns 5986 results, the first of which is a hit for Thomas, OK. I provided a postalCode explicitly, so I'm not sure why a fuzzy search is being performed. On top of that, I see no way to filter this result out as incorrect. I noticed the "fuzzyLevel" field in the "summary" section and thought I could perhaps use that. Unfortunately, the docs (useless autogenerated nonsense) have this to say about it:

 fuzzyLevel    integer    FuzzyLevel property 

`Well that's certainly helpful. I played around with it but, unfortunately, the query aboev comes back with "fuzzyLevel: 1", the same as an exact match. Using the postalCode "error" returns a 2, so that can be filtered, but not universally helpful. I also noticed that there is no postalCode included in the "address" response for postalCode: Thomas. I of course have no idea if I can count on this behavior though, so I am hesitant to rely upon it. Is there a simple way I can request that only an exact match on the field(s) I provide be used, otherwise return nothing? I have no use for these wild guesses.

Would filtering by result.entityType.PostalCodeArea be correct here?

Edit: Nope! Some responses don't have an entityType field at all! e.g. E6L 2H2, CA


azure-maps
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @EdwardSwangren-5905, Thanks for reaching out to us.

We will update you soon on this issue.

0 Votes 0 ·
SatishBoddu-MSFT avatar image
0 Votes"
SatishBoddu-MSFT answered SatishBoddu-MSFT commented

Hello @EdwardSwangren-5905,

So one of your main questions is that the Azure Maps API search should return all the postalCode when its fuzzy level=1, right?

I think the below image shows the entire list of Thomas, OK Postal codes. Just for the reference.
23412-image.png

Repro of the issues reported in your question is as below, please confirm if we are on the same page for these.../

23421-image.png


using 'error', as reported in your question.

23441-image.png


I hope you have already seen this document on 'Get Search Fuzzy' , which neither shows the postal code in address response.

23304-image.png

And we see the response with postal code for 'Get Search Address Structured'.

23345-image.png





image.png (25.4 KiB)
image.png (63.8 KiB)
image.png (51.4 KiB)
image.png (86.5 KiB)
image.png (96.4 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Due to limitations in the characters limit, we have posted further clarification questions in Answer section.

0 Votes 0 ·
EdwardSwangren-5905 avatar image
1 Vote"
EdwardSwangren-5905 answered SatishBoddu-MSFT commented

Thanks @SatishBoddu-MSFT, I appreciate it, but that's not quite my issue. My problem is that I don't know of a reliable way to validate that the combination of post/country code found a "strong" match. What I'd like to do is return an error if there is no match on those, but the API returns a result anyway by matching street name/munici[pality/whatever. I'm not interested in that sort of free form, fuzzy matching.

Here's our use case: We need to determine how old a blood sample is. A lab operator enters a country code and a postal code. They expect back a time span. In order to calculate that span we need to know when it was shipped, including time zone information. So, we use azure maps to get the local time in the shipping location as well as the receiving location and do some simple math.

If someone enters "Thomas" as the postal code it is obviously a typo and I need to bail on the entire thing, not return the time from e.g. Thomas OK. Essentially, I don't want the API to be tolerant of typos and incomplete information, or find a way to determine whether or not it got an exact hit.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks @EdwardSwangren-5905, Thanks for the clarification on your question.

We were looking for the exact query as below.

What I'd like to do is return an error if there is no match on those, but the API returns a result anyway by matching street name/munici[pality/whatever.

Thanks for sharing your use case as well, now the requirement is clear, our team is looking into this and will get back to you soon.

1 Vote 1 ·
SatishBoddu-MSFT avatar image
0 Votes"
SatishBoddu-MSFT answered SatishBoddu-MSFT commented

Thanks @EdwardSwangren-5905,

Updated:
In short the confirmation is 'No'





Below is the response from the Microsoft Product Group Team, I hope this helps with your query.

  • We will only return error codes when the query is invalid, e.g. it has invalid parameters, or it does not follow the correct format.

  • Azure Maps Search services are designed to return coordinate location for a given address excluding the unit level, and they can be used for address validation.

  • Azure Maps can provide an address that has spelling mistakes removed. The returned data follows the standard format for the specific country, e.g. in the US and in Finland we have different formats.

  • Our Geocoder API’s do provide a list of addresses in the response, but this will require some human intervention to choose which of these response makes the most sense. This works well in forms where the customer can choose the right address.

For example, if we provide 1, Main Street, Seattle – it will return 2 responses:

1, Main Street, N Seattle

and

1, Main Street, S Seattle.

We cannot guarantee the results if inaccurate input parameters are sent to us.
In the example, the result type is now municipality, and for municipalities, we don't return postal codes, because one municipality can cover hundreds of postal codes.

Please let us know if you need further help in this matter.
Please accept helpful responses as 'Answer', which will be helpful to others as well with similar question.




· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

So the answer is "no" then? No way to ensure an exact match?

0 Votes 0 ·

Sorry for the inconvenience caused over this issue, let me once again check with the Product Team and get full & Final confirmation on your latest comment/query. please stay tuned.

0 Votes 0 ·

Thanks @EdwardSwangren-5905,

I confirm the Answer is 'No'

Could you please accept helpful responses as 'Answer', which will be helpful to others as well with similar question.

0 Votes 0 ·

Thanks @EdwardSwangren-5905, Please accept helpful response as 'Answer', which will be helpful to others as well with similar question.

0 Votes 0 ·
foobarbaz-3697 avatar image
0 Votes"
foobarbaz-3697 answered SatishBoddu-MSFT commented

As 2021, It seems like the endpoint now takes the "entityType" url param?

https://atlas.microsoft.com/search/address/structured/json?api-version=1.0&subscription-key=&postalCode=45875&countryCode=US&entityType=PostalCodeArea

This works for me, but It seems like the documentation does not make any mention about it??? https://docs.microsoft.com/en-us/rest/api/maps/search/get-search-address-structured

Can someone clarify this?

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, Is your question related with the same original query?

0 Votes 0 ·

Hello!, it may not be exactly the same scenario, but I believe it is related in the sense that I'm just expecting to retrieve one result from the endpoint (city name, state, lat, long), this is why i'm using entityType=PostalCodeArea. As you can see in my example I want to retrieve information to the city associated to a given zipCode, in this case: &postalCode=45875.

0 Votes 0 ·

Could you please post a new question on this forum? So that the community can help in this matter!

0 Votes 0 ·