2009-06-26 12 views
2

지역 차고 판매를 추적하기 위해 Google지도를 사용하고 싶습니다. Google은지도 (see here)를 만들었으며 해당지도를 웹 사이트에 삽입하려고합니다. 그러나, 우리가 할 때, 우리는 모든 차고 판매의 목록을 포함하고있는지도의 사이드 바를 잃어 버린다.Google지도에 사이드 바를 삽입 할 수 있습니까?

Google을 퍼가는 방법에 대해 잘 알고 있습니다. 그들은 과정을 아주 간단하게 만들었습니다. 그러나지도를 삽입하고 사이드 바 목록의 차고 판매를 유지할 수있는 방법이 있습니까?

답변

4

내 지식에 따르면 가장 좋은 방법은 판매 컨테이너를 만들고 채우려는지도에 연결하는 것입니다. 귀하가 Google 사이트에 귀하의 데이터를 작성하고 입력하고 임베디드 기능을 사용하고 있다고 가정합니다. 이는 내 답변이 훨씬 더 많은 작업을 의미한다는 것을 의미합니다.

지도 데이터와 사이드 바를 만들려면 Maps API를 사용해야합니다.

iFrame을 더 이상 사용하지 않으려면 자신의 솔루션을 코딩해야합니다. 이전에 JavaScript를 사용 해본 적이 있다면 좋은 예제가 없다면 정말 쉽습니다.

0

MAPS API를 사용하고 싶은데 자바 스크립트를 아는 것이 그리 어렵지 않습니다. 본질적으로 데이터 포인트를 자바 스크립트 배열에로드하고 맵에 플롯 한 다음 html에 배열 정보를 채 웁니다.

이 링크는 내가 최근에 작성한 페이지로, 사용자가지도를 드래그 할 때 데이터베이스에서 배열을 동적으로 다시 채 웁니다 (거의 모든 CSS가 현재 있음). 더 이상 의견에 답변을

map with dynamic links

해피.

P. 멋진지도 아이콘!

0

나는 사이드와지도를 생성 한 사이트를 발견,하지만 당신이 더 많은 컨트롤을 원하는 경우, 당신은 다른 제안으로, 자신 만의지도를 만들어야합니다.

http://www.mapchannels.com/

2

이 튜토리얼 http://econym.org.uk/gmap/basic2.htm 그것을 할 방법을 정확하게 보여줍니다 (내가 저자의 종류 허락을 재현 : 커뮤니티 교회 자바 스크립트 팀 http://www.bisphamchurch.org.uk) 코드 공급 Google지도를 접근에 잘

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html> 
    <head> 
    <title>Google Maps</title> 
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=ABQIAAAAPDUET0Qt7p2VcSk6JNU1sBSM5jMcmVqUpI7aqV44cW1cEECiThQYkcZUPRJn9vy_TWxWvuLoOfSFBw" type="text/javascript"></script> 
    </head> 
    <body onunload="GUnload()"> 


    <!-- you can use tables or divs for the overall layout --> 

    <table border=1> 
     <tr> 
     <td> 
      <div id="map" style="width: 550px; height: 450px"></div> 
     </td> 
     <td width = 150 valign="top" style="text-decoration: underline; color: #4444ff;"> 
      <div id="side_bar"></div> 
     </td> 
     </tr> 

    </table> 
    <a href="basic2.htm">Back to the tutorial page</a> 


    <noscript><b>JavaScript must be enabled in order for you to use Google Maps.</b> 
     However, it seems JavaScript is either disabled or not supported by your browser. 
     To view Google Maps, enable JavaScript by changing your browser options, and then 
     try again. 
    </noscript> 


    <script type="text/javascript"> 
    //<![CDATA[ 

    if (GBrowserIsCompatible()) { 

     // this variable will collect the html which will eventually be placed in the side_bar 
     var side_bar_html = ""; 

     // arrays to hold copies of the markers and html used by the side_bar 
     // because the function closure trick doesnt work there 
     var gmarkers = []; 


     // A function to create the marker and set up the event window 
     function createMarker(point,name,html) { 
     var marker = new GMarker(point); 
     GEvent.addListener(marker, "click", function() { 
      marker.openInfoWindowHtml(html); 
     }); 
     // save the info we need to use later for the side_bar 
     gmarkers.push(marker); 
     // add a line to the side_bar html 
     side_bar_html += '<a href="javascript:myclick(' + (gmarkers.length-1) + ')">' + name + '<\/a><br>'; 
     return marker; 
     } 


     // This function picks up the click and opens the corresponding info window 
     function myclick(i) { 
     GEvent.trigger(gmarkers[i], "click"); 
     } 


     // create the map 
     var map = new GMap2(document.getElementById("map")); 
     map.addControl(new GLargeMapControl()); 
     map.addControl(new GMapTypeControl()); 
     map.setCenter(new GLatLng(43.907787,-79.359741), 8); 

     // add the points  
     var point = new GLatLng(43.65654,-79.90138); 
     var marker = createMarker(point,"This place","Some stuff to display in the<br>First Info Window") 
     map.addOverlay(marker); 

     var point = new GLatLng(43.91892,-78.89231); 
     var marker = createMarker(point,"That place","Some stuff to display in the<br>Second Info Window") 
     map.addOverlay(marker); 

     var point = new GLatLng(43.82589,-78.89231); 
     var marker = createMarker(point,"The other place","Some stuff to display in the<br>Third Info Window") 
     map.addOverlay(marker); 


     // put the assembled side_bar_html contents into the side_bar div 
     document.getElementById("side_bar").innerHTML = side_bar_html; 

    } 

    else { 
     alert("Sorry, the Google Maps API is not compatible with this browser"); 
    } 

    // This Javascript is based on code provided by the 
    // Community Church Javascript Team 
    // http://www.bisphamchurch.org.uk/ 
    // http://econym.org.uk/gmap/ 

    //]]> 
    </script> 
    </body> 

</html> 
1

난을 API v3 with Javascript를 사용하여 다양한 샘플 스크립트를 성공적으로 실험 해 보았습니다.하지만 사이드 바를 비롯한 다양한 옵션을 사용하여 삽입 된지도를 만드는 가장 빠르고 (가장 빠른) 방법은 다음과 같습니다. http://www.mymapsplus.com/AddMyMap (Chris B에게 감사)로 이동하여 생성 된지도에서 광고를 없애려면 £ 10 기부를하십시오. 예를 들어 http://www.hope-projects.org.uk/node/41. 편집 페이지에서는 몇 번의 클릭만으로 생각할 수있는 거의 모든 옵션을 추가하거나 변경할 수 있습니다.

관련 문제