Closed MSIH closed 3 years ago
You could check server side demos https://github.com/rungwiroon/BlazorGoogleMaps/tree/master/ServerSideDemo/Pages
Probably you need https://github.com/rungwiroon/BlazorGoogleMaps/blob/master/ServerSideDemo/Pages/MapAutocomplete.razor
Also i dont think this is GoogleMap component. I think you need https://github.com/chadly/Geocoding.net
I have already reviewed the page for the demo of autocomplete but does not use show how to access the content of the place.AddressComponents object.
What use case are you trying to solve?
I am trying to create a form for people to enter their address. users enter their address in the google place autocomplete form and populates other fields for with street, city, state, postal code. See google example/demo https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-addressform
I see all required info to fill form in MapAutocomplete component place object have all fields. Try to debug ServerSideDemo and you will see by yourself.
await this.autocomplete.AddListener("place_changed", async () =>
{
var place = await this.autocomplete.GetPlace();
if (place?.Geometry == null)
{
this.message = "No results available for " + place?.Name;
}
else if (place.Geometry.Location != null)
{
await this.map1.InteropObject.SetCenter(place.Geometry.Location);
await this.map1.InteropObject.SetZoom(13);
var marker = await Marker.CreateAsync(this.map1.JsRuntime, new MarkerOptions
{
Position = place.Geometry.Location,
Map = this.map1.InteropObject,
Title = place.Name
});
this.markers.Push(marker);
this.message = "Displaying result for " + place.Name;
}
else if (place.Geometry.Viewport != null)
{
await this.map1.InteropObject.FitBounds(place.Geometry.Viewport, 5);
this.message = "Displaying result for " + place.Name;
}
this.StateHasChanged();
});
Thanks but I am not interested in debugging. I was hoping for an example of how to access the place.AddressComponents from this library.
Sorry but i dont do programing for you. I almost sure you could find all required info in that component example In other hand drop me email and you could hire me if you want and i will give exact working page
I am new to programming and can not figure out how to get the Address component information. Could you please provide an example for the street address?
Here is the javascript example from the google dev web site.