Link to home
Start Free TrialLog in
Avatar of phoenixfire425
phoenixfire425Flag for United States of America

asked on

Google Maps with ASP.net and SQL

I have neem looking for the last few days on something that can help me and so far i cannot find anything that really helps.

What i am trying to do is this.

I have a Customer Database that has approx 300-6000 customers in it depending on the user that logs on. typically its 300 or less.

The customer DB does not have the Long and Lat saved with it.

But what i am trying to do is show a map of the customers that are in the SQL reaults on a single map.

So for instance Joe Smoe wants to see all his customers in the 12345 zip code... the asp.net page querys the SQL DB and pulls out 100 customers in that range.   I want those 100 customers to be populated on a map so the REP can see what that area looks like.

Also i would like to be able to control the icons as well to show inactive and active customers.

I am using

ASP.NET 3.5
MS SQL 2000
Visual Studio 2008 Express

Thank You
Avatar of Luis Pérez
Luis Pérez
Flag of Spain image

Well, if you don't have Latitude and Longitude you'll not be able to exactly locate each customer in a map. The most you can do is trying to locate the customer in the map using it's address, but it's not sure that you'll get an exact location for all customers.

To start with google maps basics, I will recommend to you this custom ASP.net control that has a free version you can use without restrictions:
http://googlemaps.subgurim.net/

With this control you can easy & fast begin to show maps, locate icons where you want, paint icons, do address searches, etc. without the need to learn the Google Maps API.

Hope that helps.
Avatar of phoenixfire425

ASKER

Well i have tried to get the control to work with http://googlemaps.subgurim.net/ but i cannot find any way to get out customer information into the maps.  

I guess a good start would be to build the GEOCODE database and store the resaults into a table on the SQL server. but the only way i know of doing that would be doing it line by line.

I know that http://geocoder.us has a free geocoder but i dont know how to send my data to that and get the resaults back for storing them.

Ok so far what i have is i am able to geocode and place the info into a gridview.
but i need to find out how to pull the data from my DB

in the code behind i have tge address set staticly..

What i need is to be able to use a DB query to populate the address field

or i am open to other solutions.
Imports System.Data
Imports System.Xml
Imports System.Net
 
 
Partial Class Testing
    Inherits System.Web.UI.Page
 
    Private Function GetLocation() As DataTable
 
        'Create a WebRequest 
        Dim rssReq As WebRequest = WebRequest.Create("http://local.yahooapis.com/MapsService/V1/geocode?appid=YD-9G7bey8_JXxQP6rxl.fBFGgCdNjoDMACQA--&street=1 cedar point dr&city=sandusky&state=oh")
        'Create a Proxy 
        Dim px As New WebProxy("http://local.yahooapis.com/MapsService/V1/geocode?appid=YD-9G7bey8_JXxQP6rxl.fBFGgCdNjoDMACQA--&street=1 cedar point dr&city=sandusky&state=oh", True)
        'Assign the proxy to the WebRequest 
        rssReq.Proxy = px
        Try
            'Get the WebResponse 
            Dim rep As WebResponse = rssReq.GetResponse()
            'Read the Response in a XMLTextReader 
            Dim xtr As New XmlTextReader(rep.GetResponseStream())
            'Create a new DataSet 
            Dim ds As New DataSet()
            'Read the Response into the DataSet 
            ds.ReadXml(xtr)
            Return ds.Tables(0)
        Catch
            Return Nothing
        End Try
    End Function
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
 
        Dim dt As DataTable = GetLocation()
        Me.GridView1.DataSource = dt
        Me.GridView1.DataBind()
        Me.GMap1.DataSource = dt
        Me.GMap1.DataBind()
 
    End Sub
 
 
End Class

Open in new window

Hi,

Eehh.. Have you even checked out the answer I provided to your OTHER question on this subject?

https://www.experts-exchange.com/questions/24799536/Read-XML-output-from-Googles-Geocoder-to-asp-net.html

/Carl.
ASKER CERTIFIED SOLUTION
Avatar of phoenixfire425
phoenixfire425
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial