# Radzen Google Map Address Lookup

**URL:** <https://forum.radzen.com/t/radzen-google-map-address-lookup/6297>\
**Category:** Radzen.Blazor Components\
**Created:** [January 14, 2021, 7:19pm UTC](https://forum.radzen.com/t/radzen-google-map-address-lookup/6297 "2021-01-14T19:19:32Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jay](https://forum.radzen.com/user_avatar/forum.radzen.com/jay/32/5662_2.png) [@Jay](https://forum.radzen.com/u/Jay)\
**Post date:** [January 14, 2021, 7:19pm UTC](https://forum.radzen.com/t/radzen-google-map-address-lookup/6297/1 "2021-01-14T19:19:32Z")

</div>

Radzen Team,

Does the map support address lookup. I need to put businesses on a map however I do not have the business latitude and longitudes I have their addresses, does the map support this behavior or will it in the near future?

---

<div class="post-metadata">

**Author:** ![johnmu](https://forum.radzen.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@johnmu](https://forum.radzen.com/u/johnmu)\
**Post date:** [January 14, 2021, 8:43pm UTC](https://forum.radzen.com/t/radzen-google-map-address-lookup/6297/2 "2021-01-14T20:43:07Z")

</div>

You need to subscribe to another google service to do this. You can find it on line but essentially it’s another free service you get from the same place as you got the google maps API. Unfortunately I can’t remember what’s it’s called. If you can’t find it let me know and I’ll have another look.

John

---

<div class="post-metadata">

**Author:** ![Jay](https://forum.radzen.com/user_avatar/forum.radzen.com/jay/32/5662_2.png) [@Jay](https://forum.radzen.com/u/Jay)\
**Post date:** [January 14, 2021, 8:56pm UTC](https://forum.radzen.com/t/radzen-google-map-address-lookup/6297/3 "2021-01-14T20:56:39Z")

</div>

Its Google geocode service. I've used it before, just wondering if the functionality was built into the radzen control

---

<div class="post-metadata">

**Author:** ![johnmu](https://forum.radzen.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@johnmu](https://forum.radzen.com/u/johnmu)\
**Post date:** [January 14, 2021, 8:59pm UTC](https://forum.radzen.com/t/radzen-google-map-address-lookup/6297/4 "2021-01-14T20:59:16Z")

</div>

Not as far as I know. I just wrote a method to ue it to get the coordinates.

---

<div class="post-metadata">

**Author:** ![Dominic\_Lallemant](https://forum.radzen.com/user_avatar/forum.radzen.com/dominic_lallemant/32/1058_2.png) [@Dominic\_Lallemant](https://forum.radzen.com/u/Dominic_Lallemant)\
**Post date:** [January 23, 2021, 1:48am UTC](https://forum.radzen.com/t/radzen-google-map-address-lookup/6297/5 "2021-01-23T01:48:32Z")

</div>

Hi @johnmu  
Do you think there is a way to integrate Google address lookup in Radzen? I would like to use the lookup rather than have users type in the address. I manage to implement it in a Lightswitch application and I would love to find a way to do it in Radzen. Any help with this would be appreciated. Thanks.

---

<div class="post-metadata">

**Author:** ![johnmu](https://forum.radzen.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@johnmu](https://forum.radzen.com/u/johnmu)\
**Post date:** [January 23, 2021, 9:56am UTC](https://forum.radzen.com/t/radzen-google-map-address-lookup/6297/6 "2021-01-23T09:56:38Z")

</div>

Dominic,

I have a method that takes the postcode which the user provides and then it queries google to get the map coordinates. If that’s what you mean I’ll post the code.

John

---

<div class="post-metadata">

**Author:** ![Dominic\_Lallemant](https://forum.radzen.com/user_avatar/forum.radzen.com/dominic_lallemant/32/1058_2.png) [@Dominic\_Lallemant](https://forum.radzen.com/u/Dominic_Lallemant)\
**Post date:** [January 23, 2021, 6:02pm UTC](https://forum.radzen.com/t/radzen-google-map-address-lookup/6297/7 "2021-01-23T18:02:26Z")

</div>

Hi @johnmu,  
Yes please 😁 that would be very helpful as it would give me an insight on how to query a Google API from Radzen. The feature I am looking to implement is the " Autocomplete for Addresses and Search Terms" from Google [https://developers.google.com/maps/documentation/javascript/places-autocomplete](https://developers.google.com/maps/documentation/javascript/places-autocomplete)

---

<div class="post-metadata">

**Author:** ![johnmu](https://forum.radzen.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@johnmu](https://forum.radzen.com/u/johnmu)\
**Post date:** [January 26, 2021, 10:21am UTC](https://forum.radzen.com/t/radzen-google-map-address-lookup/6297/8 "2021-01-26T10:21:58Z")

</div>

Dominic,

here's my code

```auto
protected async System.Threading.Tasks.Task Button0Click(MouseEventArgs args)
        {
            if (PostCode!=null)
            {
                var getCoordsAsyncResult = await GetCoordsAsync($"{PostCode}");
            }
        }

```

then I put this in a partial page class

```auto
 public async Task<Tuple<double, double>> GetCoordsAsync(string postcode)
        {
            string url = string.Format("https://maps.google.com/maps/api/geocode/xml?key={1}&address={0}&sensor=false", Uri.EscapeDataString(postcode), Globals.GoogleMapsAPI);

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            Stream receiveStream = response.GetResponseStream();
            Encoding encode = System.Text.Encoding.GetEncoding("utf-8");

            StreamReader readstream = new StreamReader(receiveStream, encode);

            DataSet dsResult = new DataSet();

            dsResult.ReadXml(readstream);

            response.Close();
            readstream.Close();

            Tuple<double, double> output=new Tuple<double, double>(0,0);

            DataTable dt = new DataTable();

            foreach (DataRow row in dsResult.Tables["result"].Rows)
            {
                string geometry_id = dsResult.Tables["geometry"].Select("result_id = " + row["result_id"].ToString())[0]["geometry_id"].ToString();

                DataRow location = dsResult.Tables["location"].Select("geometry_id=" + geometry_id)[0];

               output = Tuple.Create(Convert.ToDouble(location["lat"]), Convert.ToDouble(location["lng"]));

            };

            await AddMarkerfromPostCode(output.Item1, output.Item2);

            return output;

        }

```

I'm sure there are better tighter ways to write this but it works.

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [January 26, 2021, 10:28am UTC](https://forum.radzen.com/t/radzen-google-map-address-lookup/6297/9 "2021-01-26T10:28:25Z")

</div>

You can format your code by nesting it inside ``` (triple backtick) blocks. For example:

````

```
code
```

````

`
`

---

<div class="post-metadata">

**Author:** ![johnmu](https://forum.radzen.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@johnmu](https://forum.radzen.com/u/johnmu)\
**Post date:** [January 26, 2021, 10:47am UTC](https://forum.radzen.com/t/radzen-google-map-address-lookup/6297/10 "2021-01-26T10:47:16Z")

</div>

thanks, didn't know that

---

<div class="post-metadata">

**Author:** ![barry8schneider](https://forum.radzen.com/user_avatar/forum.radzen.com/barry8schneider/32/9777_2.png) [@barry8schneider](https://forum.radzen.com/u/barry8schneider)\
**Post date:** [February 17, 2022, 5:32pm UTC](https://forum.radzen.com/t/radzen-google-map-address-lookup/6297/11 "2022-02-17T17:32:31Z")

</div>

I am going to work on an example for this. more to come.

---

<div class="post-metadata">

**Author:** ![barry8schneider](https://forum.radzen.com/user_avatar/forum.radzen.com/barry8schneider/32/9777_2.png) [@barry8schneider](https://forum.radzen.com/u/barry8schneider)\
**Post date:** [February 19, 2022, 1:37pm UTC](https://forum.radzen.com/t/radzen-google-map-address-lookup/6297/12 "2022-02-19T13:37:00Z")

</div>

An example of using Google Places Autocomplete with Blazor Radzen components.  
See example code: [https://github.com/MSIH/Blazor-Radzen-Google-Places-Autocomplete](https://github.com/MSIH/Blazor-Radzen-Google-Places-Autocomplete)

See Demo site: [https://blazorradzengoogleplacesautocomplete.azurewebsites.net/](https://blazorradzengoogleplacesautocomplete.azurewebsites.net/)

---

<div class="post-metadata">

**Author:** ![13scottdavis](https://forum.radzen.com/letter_avatar_proxy/v4/letter/1/6bbea6/32.png) [@13scottdavis](https://forum.radzen.com/u/13scottdavis)\
**Post date:** [July 16, 2022, 4:14pm UTC](https://forum.radzen.com/t/radzen-google-map-address-lookup/6297/13 "2022-07-16T16:14:45Z")

</div>

Great example. However if you attempt to use this on a Raden Dialog it will not work [Zipped Example Here](https://github.com/13scott/RGADF)
