2010-12-11 89 views
0

我在我的Drupal站點上使用GMaps,位置和用戶位置模塊。我想有一張地圖可以顯示我的用戶的「覆蓋範圍」。覆蓋範圍半徑以參考用戶的自定義內容類型存儲。Drupal,GMap和位置的覆蓋圖

如何才能在地圖上顯示只有覆蓋範圍的用戶?在使用GMap宏時,我看到了這樣的顯示類型,所以我認爲可以這樣使用GMaps。

我想這很可能不支持GMap模塊的開箱即用。無論如何,如果有人能指引我走向正確的方向,我會很高興......

回答

0

我已經設法在匈牙利社區的幫助下完成了這一切。 (我會很樂意到原來的螺紋連接,但似乎它刪除了。)

基本上「絕招」是使用鉤子一點點自定義模塊:

function MODULENAME_preprocess_gmap_view_gmap(&$vars) { 
    if ($vars['view']->name == "my_gmap_view") { 
    $map_object = $vars['map_object']; 
    $map_object['id'] = 'my_view_id'; 
    foreach ($vars['view']->result as $key => $row) { 
     $shapes[$key]['type'] = 'circle'; 

     // we have a profile field for the radius, but it could be anything... 
     $shapes[$key]['radius'] = $row->profile_values_profile_radius_value; 

     // center the circles on the coord 
     $shapes[$key]['center'][0] = $row->location_latitude; 
     $shapes[$key]['center'][1]= $row->location_longitude; 
    } 

    // we don't need any markers, just the circles 
    $map_object['markers'] = NULL; 
    $map_object['shapes'] = $shapes; 
    $vars['map'] = theme('gmap', array('#settings' => $map_object)); 
    } 
}