Hello guys No finally I solved the problems that I had. Now I'd like to builtin switches for the restaurants and holiday flats.
The problem is that the egeoxml.js is there in multiple versions Some allow hide/show some do not. What way do you suggest is the best in hiding/showing KML points or group of points. Greetings Simon On 17 Sep., 17:18, simonsinus <[email protected]> wrote: > Hello Andrew > > OK. I go back to the position I was this morning. > > I'm planning to create a Website that offers regional Point of > Interests to the user. > The Site offers Points of Restaurants and Points of holiday flats. > > It's all in german language. > If you'd visit the website with the urlhttp://www.renchtal.com/ > you can logon (on the left side) as user: guest pass guest. > > Then you'll see two new links in the main menu. > Click on Renchtal Karte (That means more or less Renchtal Map) > Renchtal is the valley this regional search is about. > > On the Map you have a sidebar with numbered sidebar entries. > > This version uses three different kml-sources that are generated > from the Content Management System that is used in this case. > > The Points that are shown in the map are up to 30 entries. > If you change the scope on the map the restaurants ( the red markers) > disapear whan they are not in the viewport. > > But the green ones (The holliday flats don't). > > My thought was then bringing them together into one single kml file. > So that viewport rule for the restaurants also applies on the holiday > flats. > > Future Features should be that the user can set its own map center > and view and add many different walking tours to the systems. > > That's the code of the main js: > > // Declare variables for later use > var map; > > var geoXml; > var geoXml2; > var geoXml3; > > var data = new Array(); > var markers = new Array(); > > var data2 = new Array(); > var markers2 = new Array(); > > var data3 = new Array(); > var markers3 = new Array(); > > var clicked; > var current; > > var clicked2; > var current2; > > var clicked3; > var current3; > > var geocoder; > var marker; > > function loadMap() > { > // loadMap: initialize the API and load the map onto the page > > // Get the map container div > var mapDiv = document.getElementById('map'); > > // Confirm browser compatibility with the Maps API > if (!GBrowserIsCompatible()) > mapDiv.innerHTML = 'Sorry, your browser isn\'t compatible with > Google Maps.'; > else > { > // Initialize the core map object > map = new GMap2(mapDiv, > {mapTypes: [G_NORMAL_MAP, G_SATELLITE_MAP, G_HYBRID_MAP, > G_PHYSICAL_MAP]}); > > // Set the starting map viewport > var coordinates = new GLatLng(48.527924, 8.033119); > map.setCenter(coordinates, 11); > > // Add the standard map controls > map.addControl(new GLargeMapControl()); > map.addControl(new GScaleControl()); > map.addControl(new GOverviewMapControl()); > map.addControl(new GMapTypeControl()); > > // Initialize the KML processor > // var url = 'uk_breweries.kml'; > var url = 'http://www.renchtal.com/index.php?article_id=514'; > var options = {createmarker: addDataPoint, nozoom: true}; > geoXml = new EGeoXml(map, url, options); > > var url2 = 'http://www.renchtal.com/index.php?article_id=577'; > var options2 = {createmarker: addDataPoint2, nozoom: true}; > geoXml2 = new EGeoXml(map, url2, options2); > > var url3 = 'http://www.renchtal.com/index.php?article_id=584'; > var options3 = {createmarker: addDataPoint3, nozoom: true}; > geoXml3 = new EGeoXml(map, url3, options3); > > // Attach an event handler for after the KML is processed > GEvent.addListener(geoXml, 'parsed', xmlParsed); > GEvent.addListener(geoXml2, 'parsed', xmlParsed2); > GEvent.addListener(geoXml3, 'parsed', xmlParsed3); > > // Load the KML > geoXml.parse(); > geoXml2.parse(); > geoXml3.parse(); > > // Attach an event to refresh the marker display whenever the map > moves > GEvent.addListener(map, 'moveend', mapMoveEnd); > GEvent.addListener(map, 'infowindowopen', mapInfoWindowOpen); > GEvent.addListener(map, 'infowindowclose', mapInfoWindowClose); > > GEvent.addListener(map, 'moveend2', mapMoveEnd2); > GEvent.addListener(map, 'infowindowopen2', mapInfoWindowOpen2); > GEvent.addListener(map, 'infowindowclose2', mapInfoWindowClose2); > > GEvent.addListener(map, 'moveend3', mapMoveEnd3); > GEvent.addListener(map, 'infowindowopen3', mapInfoWindowOpen3); > GEvent.addListener(map, 'infowindowclose3', mapInfoWindowClose3); > > geocoder = new GClientGeocoder(); > > LoadGPXFileIntoGoogleMap(map, "http://www.renchtal.com/ > diplomarbeit/Tour_16979-1.gpx"); > > } > > }; > > function addDataPoint(coordinates, name, description) > { > // addDataPoint: save the data for a placemark found by the KML > processor > var d = data.length; > data[d] = {coords: coordinates, title: name, details: description}; > > }; > > function addDataPoint2(coordinates, name, description) > { > // addDataPoint: save the data for a placemark found by the KML > processor > var d2 = data2.length; > data2[d2] = {coords2: coordinates, title2: name, details2: > description}; > > }; > > function addDataPoint3(coordinates, name, description) > { > // addDataPoint: save the data for a placemark found by the KML > processor > var d3 = data3.length; > data3[d3] = {coords3: coordinates, title3: name, details3: > description}; > > }; > > function xmlParsed() > { > // xmlParsed: after KML processing, initialize the marker display > mapMoveEnd(); > > }; > > function xmlParsed2() > { > // xmlParsed: after KML processing, initialize the marker display > mapMoveEnd2(); > > }; > > function xmlParsed3() > { > // xmlParsed: after KML processing, initialize the marker display > mapMoveEnd3(); > > }; > > function mapMoveEnd() > { > // mapMoveEnd: refresh the marker display after the map has moved > > // Get the map boundary coordinates > var mapBounds = map.getBounds(); > > // Don't refresh if the currently-selected marker is still in view > if (current != null) > { > if (mapBounds.contains(current)) > return; > else > map.closeInfoWindow(); > } > > // Prepare to build new sidebar content by starting with a clean > slate > var sidebarContent = ''; > > // Remove previous set of markers from the map and the array > for (var m = markers.length - 1; m >= 0; m--) > { > map.removeOverlay(markers[m]); > markers.splice(m, 1); > } > > // Create a base icon > var numberIcon = new GIcon(G_DEFAULT_ICON); > > // Look for data in the new map area > for (var d = 0; d < data.length; d++) > { > if (mapBounds.contains(data[d].coords)) > { > // Map does contain this data point; create a marker and add it > to the map > m = markers.length; > numberIcon.image = > 'http://www.renchtal.com/markers/marker'+ > (m + 1) + '.png'; > markers[m] = new GMarker(data[d].coords, {icon: numberIcon}); > markers[m].data = data[d]; > map.addOverlay(markers[m]); > > // Also attach an event handler to show infowindow when marker > is clicked > GEvent.addListener(markers[m], 'click', > new Function('showDetail(' + m + ')')); > > // Create sidebar content for this data point, including click > event handler > sidebarContent = sidebarContent + > '<li><a href="#" onclick="showDetail(' + m + '); return > false"><img style="border:0;width:15px;height:24px;vertical- > align:middle;padding-right:5px;" src="http://www.renchtal.com/markers/ > marker'+ (m + 1) +'.png" />' + > data[d].title + '</a></li>'; > > if (m >= 29) > { > // We've reached 20 markers, so break out of the loop > sidebarContent = sidebarContent + > '<li style="list-style: none">zoom in for more...</li>'; > break; > } > } > } > > if (markers.length == 0) > // No data points found in map boundaries > sidebarContent = '<li style="list-style: none">No results found in > map area. ' + > 'Try zooming out or moving the map.</li>'; > > // Move the new content into the sidebar > document.getElementById('list').innerHTML = sidebarContent;}; > > // Moveend 2 > > function mapMoveEnd2() > { > // mapMoveEnd: refresh the marker display after the map has moved > > // Get the map boundary coordinates > var mapBounds2 = map.getBounds(); > > // Don't refresh if the currently-selected marker is still in view > if (current2 != null) > { > if (mapBounds2.contains(current2)) > return; > else > map.closeInfoWindow2(); > } > > // Prepare to build new sidebar content by starting with a clean > slate > var sidebarContent = ''; > > // Remove previous set of markers from the map and the array > for (var m2 = markers2.length - 1; m2 >= 0; m2--) > { > map.removeOverlay(markers2[m2]); > markers2.splice(m2, 1); > } > > // Create a base icon > var numberIcon2 = new GIcon(G_DEFAULT_ICON); > > // Look for data in the new map area > for (var d2 = 0; d2 < data2.length; d2++) > { > if (mapBounds2.contains(data2[d2].coords2)) > { > // Map does contain this data point; create a marker and add it > to the map > m2 = markers2.length; > numberIcon2.image = > 'http://www.renchtal.com/markers2/marker'+ > (m2 + 1) + '.png'; > markers2[m2] = new GMarker(data2[d2].coords2, {icon: > numberIcon2}); > markers2[m2].data2 = data2[d2]; > map.addOverlay(markers2[m2]); > > // Also attach an event handler to show infowindow when marker > is clicked > GEvent.addListener(markers2[m2], 'click', > new Function('showDetail2(' + m2 + ')')); > > // Create sidebar content for this data point, including click > event handler > sidebarContent = sidebarContent + > '<li><a href="#" onclick="showDetail2(' + m2 + '); return > false"><img style="width:15px;border:0;height:24px;vertical- > align:middle;padding-right:5px;" src="http://www.renchtal.com/markers2/ > marker'+ (m2 + 1) +'.png" />' + > data2[d2].title2 + '</a></li>'; > > if (m2 >= 29) > { > // We've reached 20 markers, so break out of the loop > sidebarContent = sidebarContent + > '<li style="list-style: none">zoom in for more...</li>'; > break; > } > } > } > > if (markers2.length == 0){ > // No data points found in map boundaries > ... > > Erfahren Sie mehr » --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en -~----------~----~----~----~------~----~------~--~---
