473,473 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

google maps: arrows on polylines from selectbox?

17 New Member
Hi,

I'm trying to write a function that will show arrowheads on polylines selected from a select box in a google map. I only want the arrowheads that belong to the line shown to be displayed.

I have got it working using check boxes, and the select box shows the lines, but am having trouble tweaking the code to get the arrows to show up as well. You can see the working checkboxes (and the semi-working selectbox) here: http://www.xelawho.com/map/zonesarrowstest.htm

Below are (what I think are) the relevant bits of code. Thanks in advance for any help.

(cross-posted on the google maps forum, here and here over the last week, but unanswered)

Expand|Select|Wrap|Line Numbers
  1. var h = 0;
  2.  var v = 0;
  3.  
  4. // === Function to create a marker arrow ===
  5.       function createArrow(point,icon,category) {
  6.         var arrows = new GMarker(point,icon);
  7.         map.addOverlay(arrows);
  8.         pts[v] = arrows;
  9.         arrows.hide(); 
  10.         arrows.mycategory = category;                                 
  11.         pts.push(arrows);
  12.         }
  13.  
  14. var select_html = '<select onChange="handleSelected2(this)">' + "selclick(this)" +
  15.                         '<option selected> - Select a bus route - <\/option>';
  16.  
  17.  
  18.       function showsel(category) {
  19.         for (var v=0; v<pts.length-1; v++) {
  20.          if (pts[v].mycategory == category) {
  21.             pts[v].show();
  22.           }
  23.         }
  24.  
  25.       }
  26.  
  27.       function hidesel(category) {
  28.       for (var v=0; v<pts.length-1; v++) {
  29.          if (pts[v].mycategory == category) {
  30.             pts[v].hide();
  31.           }
  32.         }
  33. }
  34.  
  35.      function selclick(option,category) {
  36.         if (option.onclick) {
  37.           showsel(category);
  38.         } else {
  39.           hidesel(category);
  40.         }
  41.         }                    
  42.  
  43.                          function handleSelected2(opt,category) {     
  44.   for (var h = 0; h <gpolylines.length; h++) {
  45.           gpolylines[h].hide();
  46.         }
  47.         var h = opt.selectedIndex - 1; 
  48.         if (h > -1) {
  49.           gpolylines[h].show();
  50.           }
  51.           for (var v=0; v<pts.length; v++) {
  52.  
  53.                selclick(category);         
  54.                }
  55.  
  56. }    
  57.  
  58. GDownloadUrl("allzonesencoded.xml", function(doc) {
  59.         var xmlDoc = GXml.parse(doc);
  60.  
  61. var lines = xmlDoc.documentElement.getElementsByTagName("line");
  62.  
  63. for (var i=0; i< pts.length; i++) {
  64.         var category = lines[a].getAttribute("category");
  65.         }
  66.  
  67. // ===== final part of the select box =====
  68.         select_html += '<\/select>' ;
  69.         document.getElementById("selection2").innerHTML = select_html;
Nov 24 '10 #1
0 1376

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Sean | last post by:
Have you ever wanted to add the great features inherent in Google Maps? Here is how you do it. ============== == STEP ONE == ============== Create a new MS Access form called frmGoogleMap....
6
by: Sam Carleton | last post by:
Ok, over the years I have read about doing web programing and I have done some real basic stuff. Now I am digging into some real ASP.Net 2.0 and am totally lost some things. I have a master...
17
by: MeerkatInFrance | last post by:
There comes a time when you know you are not going to be able to work something out yourself, however hard you try. I have reached that moment. I have a master page and a slave page (or whatever...
5
by: xml .NET group | last post by:
Is there any book on using ASP.NET for Google Maps. For example, following books: http://www.amazon.com/Beginning-Google-Maps-Applications-Ajax/dp/1590597079/ ...
6
by: Gumbatman | last post by:
Is there a way to use the Google Maps API in C-Sharp? I've found very little when seaching the web. I don't know JavaScript very well and I thought doing it in C-Sharp would be easier. Thank...
3
by: Harch84 | last post by:
Hi I am using a javascript for google maps to geocode two locations and I thin want to retrieve the two coordinates and enter them into a Perl Script. Now I have managed to set up the page with the...
6
by: pagina21 | last post by:
I am a true beginner in Access and coding. I am creating a database with facility information and I want to use the address of a specific facility to display a map on my form or at least open a...
3
by: Phil Stanton | last post by:
I have a button on a form which when pressed displays a google map of the address. Code is Private Sub Googlemap_Click() MakeURL ("") End Sub
2
by: H.Schmidt | last post by:
Hi! im would like to get address informations like city, state or zip for a given GPoint. Is it possible (i found nothing in Google maps Api)? Thanks in advance
5
by: Nike1984 | last post by:
I'm fairly new to Javascript and it's more of a guessing game for me... I'm trying to build an app for Google Maps and just had some issues recently. First off I just wanted to say that everything...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.