?
Solved

google maps geo coding store locator

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

What is a Denial of Service (DoS)?

A DoS is a malicious attempt to prevent the normal operation of a computer system. You may frequently see the terms 'DDoS' (Distributed Denial of Service) and 'DoS' used interchangeably, but there are some subtle differences.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
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
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

765 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