开发者

Google Maps LocalSearch API custom marker not showing

I have implemented the LocalSearch API (GSmapSearchControl) which is working nicely.

I simply want to change the default green pin marker to my own custom marker.

My code runs through successfully (no javascript errors), the image URLs definitely exist, yet the custom marker doesn't display. No errors, but I just still get the default green pin marker.

Any ideas??

  <script type="text/javascript">
    function load() {
        var container = document.getElementById("mapsearch");
        new GSmapSearchControl(container, "4 Dan Close Lambton",
            { title: "Dan Close",
                url: "<%=Model.ToFullUrl() %>",
                idleMapZoom: GSmapSearchControl.ACTIVE_MAP_ZOOM + 3,
                hotspots: hotspots,
                showResultList: GSmapSearchControl.DEFAULT_RESULT_LIST,
                drivingDirections: GSmapSearchControl.DRIVING_DIRECTIONS_FROM_USER,
                linkTarget: GSearch.LINK_TARGET_BLANK,
                onBootComplete: bootComplete
            }
        );
    }
  GSearch.setOnLoadCallback(load);

  function bootComplete(searchControl) {
      var image = new google.maps.MarkerImage('http://localhost:59825/images/markers/image.png', new google.maps.Size(16, 16), new google.maps.Point(0, 0), new google.maps.Point(8, 16));
      var shadow = new google.maps.MarkerImage('http://localhost:59825/images/markers/shadow.png', new google.maps.Size(28, 16), new google.maps.Point(0, 0), new google.maps.Point(8, 16));
      var shape = { coord: [15, 0, 15, 1, 15, 2, 15, 3, 15, 4, 15, 5, 15, 6, 15, 7, 15, 8, 15, 9, 15, 10, 15, 11, 15, 12, 15, 13, 15, 14, 15, 15, 0, 15, 0, 14, 0, 13, 0, 12, 0, 11, 0, 10, 0, 9, 0, 8, 0, 7, 0, 6, 0, 5, 0, 4, 0, 3, 0, 2, 0, 1, 0, 0, 15, 0], type: 'poly' };
      var point = new google.maps.LatLng(-32.916792, 151.708295);
      var marker = new google.maps.Marker({ draggable: false, position: point, shadow: shadow, icon: image, shape: shap开发者_开发百科e });

      localSearch.idleMarker = marker;
      localSearch.mapCenterMarker = marker;
  }

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜