Solved

google maps geo coding store locator

Posted on 2010-09-14
5
412 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

759 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

22 Experts available now in Live!

Get 1:1 Help Now