[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

google maps geo coding store locator

Posted on 2010-09-14
5
Medium Priority
?
425 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

656 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