Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

How to map multiple addresses in Google Maps.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to map multiple addresses in Google Maps.

    Here is the code needed to map out multiple addresses through Google Maps. These are only static maps, however I do have the code to generate kml files which can be used through Maps or Google Earth.

    To use this code you must have a Maps API Key found here.

    This Example:
    Code:
    ?static_map("106 S. Main Street, North East, MD","241 Market Street Charlestown MD 21914","64 South Main Street Port Deposit, Maryland 21904","1 E Main St Rising Sun, MD 21911","107 Chesapeake Blvd Elkton, MD 21921-6313, US")
    = "http://maps.google.com/staticmap?&size=512x512&markers=39.600076,-75.942774|39.572971,-75.975116|39.600979,-76.111402|39.698069,-76.062902|39.605745,-75.787264|&key=ENTER KEY HERE"
    Produces this Map:



    This work is licensed under a Creative Commons Attribution 3.0 Unported License.

    Code:
    Index of Functions
    ------------------
       1:  accuracy
       2:  geocode_xml
       3:  static_map
         
         
         
    Function Name (   1):  accuracy
    --------------------------------------------------------------------------------
    'Date Created: 15-Dec-2007 04:54:39 PM
    'Last Updated: 21-Dec-2007 03:12:25 AM
    'Created By  : GreenJEans
    'Updated By  : GreenJEans
    'This work is licensed under a Creative Commons Attribution 3.0 Unported License
    FUNCTION accuracy AS A (value AS C )
        dim result as P
        result.zoom = "10000"
        
        if value = "0" then
            result.body = "Unknown location."
            result.zoom = "12874752"
            end if
        if value = "1" then
            result.body = "Country level accuracy."
            result.zoom = "4023360"
            end if
        if value = "2" then
            result.body = "Region (state, province, prefecture, etc.) level accuracy."
            result.zoom = "402336"
            end if
        if value = "3" then
            result.body = "Sub-region (county, municipality, etc.) level accuracy."
            result.zoom = "48280"
            end if
        if value = "4" then
            result.body = "Town (city, village) level accuracy."
            result.zoom = "16093"
            end if
        if value = "5" then
            result.body = "Post code (zip code) level accuracy."
            result.zoom = "16093"
            end if
        if value = "6" then
            result.body = "Street level accuracy."
            result.zoom = ""
            end if        
        if value = "7" then
            result.body = "Intersection level accuracy."
            result.zoom = ""
            end if
        if value = "8" then
            result.body = "Address level accuracy."
            result.zoom = ""
            end if
    accuracy = result
    END FUNCTION    
    End Function (   1)---------------------------------------------------------------
      
      
    Function Name (   2):  geocode_xml
    --------------------------------------------------------------------------------
    'Date Created: 11-Dec-2007 01:57:08 AM
    'Last Updated: 17-Aug-2008 05:01:30 PM
    'Created By  : GreenJEans
    'Updated By  : GreenJeans
    'This work is licensed under a Creative Commons Attribution 3.0 Unported License
    FUNCTION geocode_xml AS A (address AS C )
        dim x as P
        dim i as N
        delete response
        dim response as A
        i=0
        key ="ENTER YOUR KEY HERE"
        url = "http://maps.google.com/maps/geo?q="+urlencode(Address)+"&output=xml&key="+key
        response = http_post(url,"","",80,2500,.f.)
        x.body = response.body
        x.code = extract_string(response.body,"<code>","</code>")
                    x.error = "Invalid Location..."
                    x.Request = extract_string(response.body,"<request>","</request>")
                    x.Name = extract_string(response.body,"<Name>","</Name>")
                    a = accuracy("0")
                    x.Accuracy = a.body
                    x.Zoom = a.zoom
                    x.Country = ""
                    x.AdministrativeArea = " "
                    x.Locality = ""
                    x.PostalCode = ""
                    x.Point = ""
                    x.has_gps = .f.
                    x.latitude = ""
                    x.longitude = ""
                    x.Time = now()
                    x.Address=""
                    x.marker=""
    if x.code = "200" then
                x.Request = extract_string(response.body,"<request>","</request>")
                x.Address = extract_string(response.body,"<address>","</address>")
                a = accuracy(extract_string(response.body,"Accuracy=\"","\" xmlns"))
                x.Accuracy = a.body
                x.Zoom = a.zoom
                x.Country = extract_string(response.body,"<CountryNameCode>","</CountryNameCode>")    
                x.AdministrativeArea = extract_string(response.body,"<AdministrativeAreaName>","</AdministrativeAreaName>")
                x.Locality = extract_string(response.body,"<LocalityName>","</LocalityName>")
                x.PostalCode = extract_string(response.body,"<PostalCodeNumber>","</PostalCodeNumber>")
                x.Point = extract_string(response.body,"<coordinates>","</coordinates>")
                x.has_gps = .t.
                x.latitude = word(x.Point,2,",")
                x.longitude = word(x.Point,1,",")
                x.Time = now()
                x.marker = word(x.Point,2,",")+","+word(x.Point,1,",")
                end if            
    
    
              
    geocode_xml = x
    END FUNCTION    
    End Function (   2)---------------------------------------------------------------
      
      
    Function Name (   3):  static_map
    --------------------------------------------------------------------------------
    'Date Created: 17-Aug-2008 05:01:32 PM
    'Last Updated: 17-Aug-2008 05:01:32 PM
    'Created By  : GreenJeans
    'Updated By  : GreenJeans
    'This work is licensed under a Creative Commons Attribution 3.0 Unported License
    FUNCTION static_map AS C (Address1 as c, Address2="", Address3="", Address4="", Address5="",height="512", length="512")
        Dim a1 as p
        Dim a2 as p
        Dim a3 as p
        Dim a4 as p
        Dim a5 as p
        url =""
        key ="ENTER YOUR KEY HERE"
        url = "http://maps.google.com/staticmap?&size=512x512"
        url = url+"&markers="    
        
        a1=geocode_xml(Address1)
        a2=geocode_xml(Address2)
        a3=geocode_xml(Address3)
        a4=geocode_xml(Address4)
        a5=geocode_xml(Address5)
        
        url = url+a1.marker+"|"+a2.marker+"|"+a3.marker+"|"+a4.marker+"|"+a5.marker+"|&key="+key
        
        static_map = url
    END FUNCTION  
    End Function (   3)---------------------------------------------------------------

  • #2
    Re: How to map multiple addresses in Google Maps.

    Hi James,

    I think there is a problem with your url: http://maps.google.com/staticmap?&si...vbTagyDPNmpLEw
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

    Comment


    • #3
      Re: How to map multiple addresses in Google Maps.

      When i clicked on your link it failed...when i clicked on mine it worked. I think its something on google's end.

      I utilized the api from google. I dont know what went wrong. However static maps are of little use. I have code that writes KML for the addresses. I am still working on a way to take the new google earth plugin for internet browsers and placing it inside alpha.
      Here is the image...

      Comment


      • #4
        Re: How to map multiple addresses in Google Maps.

        Hi GreenJeans,

        I know it's been awhile since you have seen this post but I have to tell you that your syntax for multiple lat/lon in a Google Maps URL is great and quite unique on the Internet. I have been searching the 'net' for days looking for just this syntax but I kept getting dragged into other peoples' pages of code and commentary regarding javascript. I know it only produces a staticmap but that is really all I needed for my app.

        I have to ask: is there a way to add marker descriptions to the multiple lat/lon's (addresses) on the submitted Google Maps URL? I know... somethng about cake and eating it too....but I have to ask. If the answer is no, then 'Thanks' just the same (and now I scurry back to the 'code cave' quite happy with your staticmap solution) :D

        Comment


        • #5
          Re: How to map multiple addresses in Google Maps.

          Hey there Junocat,

          Ironically it has not been very long since I have seen this code I keep up with things on a regular basis. To answer your question straight up no the static maps do not allow for marker descriptions. This is not any fault of mine...the issue lies with Google. The static maps allow for one character identification inside each marker.

          http://code.google.com/apis/maps/doc...kerDescriptors

          This link will take you to the marker requirements in the map api itself.

          An alternate solution that I might suggest for you is using KML. Google provides an in-browser Google plug in. They offer both the Maps and the Google Earth for KML.

          All the source code I have posted online is really just an aggregate for data. If you are interested in code that is able to generate KML files let me know.

          Comment


          • #6
            Re: How to map multiple addresses in Google Maps.

            Hi Mr GreenJeans,
            -
            I play with google maps a lot at the moment, but I can't see why I should use KML files. Can you enlighten me with respect to Alpha Five. Thanks

            Comment


            • #7
              Re: How to map multiple addresses in Google Maps.

              Depending on usage both have their own strenghts. If you are in need of a simple map image then use the static map code. If you are building a app that requires pliable maps then using the google maps function in A5v9 will be the best option.

              However IMHO KML provides the best medium for mapping any data. You can add descriptions, images, among many other features. This format also makes it easy to share the map among users. You can utilize the NetworkLinks comand built into KML to create maps that update on a schedule you decide. So for example you can host the data, send a client a NetworkLink and they can see what you see...that way if you update the map they see it on the next time they open it.

              There are many features to KML that I think make it the more robust choice. Perhaps you might agree?

              Comment


              • #8
                Re: How to map multiple addresses in Google Maps.

                Ok,
                Thanks for trying to explain it to me. However I'm thinking now I'd better get my hands dirty with some KML to really have an idea of what's happening.
                -
                I'm actually working with A5 Web apps, FYI the areas of the Maps API, I'm using are Custom Markers, Info Windows, Streetview, Geocoding (like you), Polygons Polylines, and some Tiles. So if you ever need any assist in those areas please sing out. This weekend I'll have a dive into KML.

                Comment


                • #9
                  Re: How to map multiple addresses in Google Maps.

                  If you are familiar with the Google Maps Api then KML is just an extension of that...

                  I would recomend brushing up on XML skills and read the documentation that Google provides for the KML. When combined with alpha the uses are amazing...I wrote a app that would take a list of addresses and geocode them, then categorize them, and finally write the KML for the map automatically. I geocoded 1800 addresses an hour and with alpha doing the heavy lifting write 2 million characters of code in under 3 minutes flat.

                  I wish you luck...and if you have any questions please just let me know.

                  Comment


                  • #10
                    Re: How to map multiple addresses in Google Maps.

                    I was reading your thread. I wanted to place a map of the state of New Jersey on my website containing pins at various locations I would extract from my A5 dbf. How do I go about this or where can I read up on how to accomplish this?

                    Thanks,

                    Charlie

                    Comment


                    • #11
                      Re: How to map multiple addresses in Google Maps.

                      Charlie , unsure whether you are addressing myself or MrGreenJeans.
                      Anyhow,
                      First place to have a read is http://code.google.com/apis/maps/doc...reference.html.
                      and grab a google maps API key while you are there.
                      There are multiple ways of acomplishing this, what I suggest is what works for me but otherways are possible.
                      On the client||browser side everything is in JavaScript. So If you see a site with something you like like just checkout its html/source code.
                      -
                      First Geocoding, yes you can put all your addresses in as physical street addresses, But I suggest in your dbf you create a mini geocache of lattitudes and longitudes.
                      -
                      on your webpage, have it initiate and center a map in javascript,
                      next call an AJAX routine ,
                      then from the .AJAX.a5w page, it opens and iterates a your dbf, for the lat lngs stored there,
                      for each lat lng, send them to a function on your maps page,
                      Thus you need a javascript function on your maps page that processes the lat, lngs and creates a marker.
                      - If you want this marker can be a simple colored pin or a custom marker||icon , and if also want you can set the marker up to have infowindow txt.

                      Hope that gives you an idea, but there are other ways to achieve this, I guess it really depends on your requirements.

                      Comment


                      • #12
                        Re: How to map multiple addresses in Google Maps.

                        As Colin stated there is many different ways to accomplish this. Perhaps you could describe what you would like your end goal to be? Are you interested in static map? Or an interactive map?

                        If you do not wish to post these details perhaps you could message me...I should be able to guide you in the right direction.

                        I would also be willing to consult with you in the design of your solution. Perhaps I would be able to code something for you specifically.

                        Comment


                        • #13
                          Re: How to map multiple addresses in Google Maps.

                          The below is an script which can placed multiple locations on google map


                          <script type="text/javascript">

                          function initialize() {
                          if (GBrowserIsCompatible()) {
                          var map = new GMap2(document.getElementById("map_canvas"));
                          map.setCenter(new GLatLng(26.4984667, 80.3047708), 13);


                          map.addOverlay(new GMarker(new GLatLng(26.4949724, 80.2830029)));
                          map.addOverlay(new GMarker(new GLatLng(26.4984667, 80.3047708)));
                          map.addOverlay(new GMarker(new GLatLng(26.5129934, 80.2339049)));
                          map.addOverlay(new GMarker(new GLatLng(26.4754982, 80.2864862)));

                          }
                          }


                          </script>
                          in case still any prob contact me at susheel1104@gmail.com

                          Comment


                          • #14
                            Re: How to map multiple addresses in Google Maps.

                            Originally posted by ColinJD View Post
                            Charlie , unsure whether you are addressing myself or MrGreenJeans.
                            Anyhow,
                            First place to have a read is http://code.google.com/apis/maps/doc...reference.html.
                            and grab a google maps API key while you are there.
                            There are multiple ways of acomplishing this, what I suggest is what works for me but otherways are possible.
                            On the client||browser side everything is in JavaScript. So If you see a site with something you like like just checkout its html/source code.
                            -
                            First Geocoding, yes you can put all your addresses in as physical street addresses, But I suggest in your dbf you create a mini geocache of lattitudes and longitudes.
                            -
                            on your webpage, have it initiate and center a map in javascript,
                            next call an AJAX routine ,
                            then from the .AJAX.a5w page, it opens and iterates a your dbf, for the lat lngs stored there,
                            for each lat lng, send them to a function on your maps page,
                            Thus you need a javascript function on your maps page that processes the lat, lngs and creates a marker.
                            - If you want this marker can be a simple colored pin or a custom marker||icon , and if also want you can set the marker up to have infowindow txt.

                            Hope that gives you an idea, but there are other ways to achieve this, I guess it really depends on your requirements.

                            Comment


                            • #15
                              Re: How to map multiple addresses in Google Maps.

                              Originally posted by Keith Hubert View Post
                              Hi James,

                              I think there is a problem with your url: http://maps.google.com/staticmap?&si...vbTagyDPNmpLEw
                              The below is the script for which show multiple location on google map

                              <script type="text/javascript">

                              function initialize() {
                              if (GBrowserIsCompatible()) {
                              var map = new GMap2(document.getElementById("map_canvas"));
                              map.setCenter(new GLatLng(26.4984667, 80.3047708), 13);


                              map.addOverlay(new GMarker(new GLatLng(26.4949724, 80.2830029)));
                              map.addOverlay(new GMarker(new GLatLng(26.4984667, 80.3047708)));
                              map.addOverlay(new GMarker(new GLatLng(26.5129934, 80.2339049)));
                              map.addOverlay(new GMarker(new GLatLng(26.4754982, 80.2864862)));

                              }
                              }


                              </script>
                              i

                              Comment

                              Working...
                              X