I dont know why Im getting this error. Here is my function that is throwing it:
const handleSearch = async () => {
if (!searchInput) return;
setSearching(true);
const credential = new SubscriptionKeyCredential(subscriptionKey);
console.log("Searching for:", searchInput);
console.log("Credential:", credential);
var pipeline = MapsURL.newPipeline(new MapControlCredential(mapRef));
const searchURL = new SearchURL(pipeline);
console.log("Credential2:", credential);
try {
console.log("Searching for:", searchInput);
const response = await searchURL.searchAddress(Aborter, searchInput).then((response) => {
console.log(response);
}).catch((error) => {
console.log(error);
}
);
console.log("'Response' type:", typeof(response));
const results = await response.json();
console.log("Results:", results);
if (results && results.length > 0) {
const coordinates = results[0].position;
console.log("Coordinates:", coordinates);
// Optionally, you can update the map view to the search result location
mapRef.current.setCamera({
I was expecting to get the address information from azure maps API. This is my first time using Azure si im not too sure whats causing it. I put in the location “London”
New contributor
StackBoy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.