?
Solved

google maps geo coding store locator

Posted on 2010-09-14
5
Medium Priority
?
428 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 2000 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

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…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

850 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