Thank you for sharing your observations. My further tests reveal there are two separate matters that need to be discussed:
1. Custom script's affects:
I can confirm that the autocomplete initialized as a result of my custom script seems to apply the country and type restrictions, correctly.
Without that custom script, if I type "empire", the autocomplete field brings in results like "Empire State Building" (a place/landmark), "Empire City Casino" (a place/landmark), and then a couple of cities from different states in the US.
( screenshot: hidden link )
And when that code is added, the same text "empire", only limits the results to cities from different states in the US only, excluding any places/landmarks.
( screenshot: hidden link )
You can even repeat the same test with the simple text "new". Without code, you'll see results like New York (US), New Orleans(US), New Delhi (India), and Newquay(UK). And with the code, the results will be limited to only the cities in the US.
And about "Black Hills", I'm sorry but I couldn't find any reference online confirming a city with this name and all the results point to a mountain range, not a city.
2. Downside of using the custom script:
The challenge here is that Toolset Map initialize's its own instance of autocomplete for the address type field, through the file:
/wp-content/plugins/toolset-maps/resources/js/wpv_addon_maps_editor.js
The way it is added, it is not possible to include additional attributes for the type and area restrictions, without actually editing the core plugin files (which is never recommended).
My custom script doesn't alter the default autocomplete instance, but initializes new one. It initially appears to work, but repeated entry of text and location selection results in duplicate suggestion windows appearing for the same field, which eventually disconnects with the map preview and is bad for the user experience.
Disabling the original autocomplete instance from Toolset isn't an option because then the map preview and storing of selected location's coordinates in the map's cache table in the background, won't work.
So based on these points, I'll not recommend using that custom script to initialize a new instance of autocomplete as it is doesn't work consistently.
You're welcome to submit a feature request for this restriction feature in the Toolset Maps through:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/
For more personalized assistance around some different custom code alternative, you can also consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/