Solved

google maps geo coding store locator

Posted on 2010-09-14
5
413 Views
Last Modified: 2012-08-13
Hi,

I have the code below.

What it does is bascially bring back a certain location from goggle.

What i want it to do is if in the text box a user puts in plumber and postcode ha6 8TP then bring back all the plumbers in that postcode.

Please help

Thanks,

R8VI
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title>Untitled Page</title>

    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />

    <style type="text/css">

  html { height: 100% }

  body { height: 100%; margin: 0px; padding: 0px }

  #map_canvas { height: 100% }

</style>



  <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<YOUR_API_KEY>&sensor=false"

        type="text/javascript"></script>





<script type="text/javascript">

        var map;

        var geocoder;

        function initialize() {

            if (GBrowserIsCompatible()) {

                map = new GMap2(document.getElementById("map"));

                map.setCenter(new GLatLng(51.5, -0.1), 10);

                map.setUIToDefault();



                geocoder = new GClientGeocoder();

            }

        }

        function showAddress() {

            var txtAddress = document.getElementById("<%=txtAddress.ClientID %>");

            var address = txtAddress.value;

            

            geocoder.getLatLng(

                address,

                function (point) {

                    if (!point) {

                        alert(address + " not found");

                    }

                    else {

                        map.setCenter(point, 15);

                        var marker = new GMarker(point);

                        map.addOverlay(marker);

                        marker.openInfoWindow(address);

                    }

                }

            );

        }

        </script>



</head>

<body onload="initialize()" onunload="GUnload()">

    <form id="form1" runat="server">

        <div>

            <asp:TextBox ID="txtAddress" runat="server" />

            <input type="button" value="Find" onclick="showAddress();" />

        </div>

    

        <div id="map" style="width: 500px; height: 500px"></div>

    </form>

</body>

</html>

Open in new window

0
Comment
Question by:R8VI
  • 3
  • 2
5 Comments
 
LVL 8

Accepted Solution

by:
TheMozz earned 500 total points
ID: 33674802
The google maps places api is what you are looking for i believe, http://code.google.com/apis/maps/documentation/places/

Give that a look and let me know if that isn't what you had in mind.
0
 

Author Comment

by:R8VI
ID: 33680502
so i am a bit confused.

For that what it will do is return the data VIA XML or JSON and then i have to manipulate it and present it how i want is that right ?
0
 

Author Comment

by:R8VI
ID: 33681067
ok so what i need is if u go to http://maps.google.com/
and in the search bar type in plumbers HA8 5TP and the results on the side and in the map thats what i need

Thanks,

r8VI
0
 

Author Comment

by:R8VI
ID: 33681768
hi,

ok so i got this code now and does what i want it to do but i dont want the search bar from google i want a text box

Please help

Thanks,

R8VI
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>Google AJAX Search API Sample</title>

    <script src="http://www.google.com/jsapi?key=AIzaSyA5m1Nc8ws2BbmPRwKu5gFradvD_hgq6G0"
        type="text/javascript"></script>

    <script type="text/javascript">
    /*
     * The Local Search Control for Google Maps performs AJAX Search API style
     * Local Searches on an existing map. If you already have a Google Maps
     * application and want to add search capabilities it doesn't get much
     * easier than this. Or, if you want to spruce up your Local Search results,
     * this control will help you easily integrate those results onto a Google Map.
    */
    
    google.load("maps", "2");
    google.load("elements", "1", {
      packages : ["localsearch"]
    });
    
    function OnLoad() {
      var content = document.getElementById("content");
      content.style.border = "1px solid #979797";
      content.style.height = "350px";
    
      var map = new google.maps.Map2(content);
      map.setMapType(G_PHYSICAL_MAP);
      map.setCenter(new google.maps.LatLng(46.688681, 7.686800), 11);
      var lsc = new google.elements.LocalSearch();
      map.addControl(lsc);
    }
    
    google.setOnLoadCallback(OnLoad);
    </script>

</head>
<body style="font-family: Arial; border: 0 none;">
    <div id="content" style="width: 50%">
        Loading...</div>
</body>
</html>

Open in new window

0
 
LVL 8

Expert Comment

by:TheMozz
ID: 33682692
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now