Project

General

Profile

Revision 2bbc28c8

ID2bbc28c83e2693264d2434fd062cad50c835e775
Parent d7abe39c
Child 589a392b

Added by Andreas Kohlbecker over 7 years ago

adding support for custom wms and solving some bugs

View differences:

7.x/modules/cdm_dataportal/settings.php
261 261
      // it is sufficient to define the preferred layer,
262 262
      // since it will automatically be enabled:
263 263
      'PREFERRED' => 'osgeo_vmap0'),
264
    'show_layer_switcher' => TRUE
264
     'custom_wms_base_layer' => array(
265
            'name' => NULL,
266
            'url' => NULL,
267
            'params' =>  NULL,
268
            'projection' => NULL,
269
            'max_extent' => NULL,
270
            'units' => NULL
271
     ),
272
    'show_layer_switcher' => TRUE,
273
    'display_outside_max_extent' => FALSE
265 274
  ),
266 275
  'legend' => array(
267 276
    'show' => TRUE,
......
1605 1614
      '#title' => t('Map preview'),
1606 1615
      '#collapsible' => FALSE,
1607 1616
      '#description' => 'The preview of the map'
1608
       . ($dummy_distribution_query != null ? ' may not be accurate in case if image maps, please check the map display in the taxon pages.': '.')
1617
       . ($dummy_distribution_query != null ?
1618
           ' may not be accurate in case if image maps, please check the map display in the taxon pages.':
1619
           '.<br/>Hold down Strg and drag with your mouse to select a bbox to zoom to. <br/>The bbox of the visisble area of the map is always displayed below the map.')
1609 1620
  );
1610 1621
  $form['map_preview']['map'] = compose_map(NULL, $dummy_distribution_query, NULL,
1611 1622
      array(
......
1701 1712
    '#default_value' => $map_distribution['bbox'],
1702 1713
    '#description' => t('The bounding box defines the area to be initially displayed in maps.
1703 1714
      Use "-180,-90,180,90" for the whole world. Leave <strong>empty</strong>
1704
      to let the map <strong>automatically zoom</strong> to the bounds enclosing the shown data.'),
1715
      to let the map <strong>automatically zoom</strong> to the bounds enclosing the shown data.</p>
1716
      <strong>TIP: </strong>You can use the map preview above to choose a bbox from the map. Maybe you need to change the map type to OpeLayers.
1717
      Hold down Strg and drag with your mouse to select a bbox to zoom to. The bbox of the visisble area of the map is always displayed
1718
      below the map from where you can copy the bbox string.</p>'),
1705 1719
  );
1706 1720

  
1707 1721
  $form[CDM_MAP_DISTRIBUTION]['show_labels'] = array(
......
1795 1809
    '#description' => '',
1796 1810
  );
1797 1811

  
1812

  
1813
  $form[CDM_MAP_DISTRIBUTION]['openlayers']['display_outside_max_extent'] = array(
1814
      '#type' => 'checkbox',
1815
      '#title' => 'Display outside max extent',
1816
      '#default_value' => $map_distribution['openlayers']['display_outside_max_extent'],
1817
      '#description' => t('Allows the map to display parts of the layers which are outside
1818
         the max extent if the aspect ratio of the map and of the baselayer
1819
         are not equal.'),
1820
  );
1821

  
1822
  $form[CDM_MAP_DISTRIBUTION]['openlayers']['show_layer_switcher'] = array(
1823
      '#type' => 'checkbox',
1824
      '#title' => 'Show Layer Switcher',
1825
      '#default_value' => $map_distribution['openlayers']['show_layer_switcher'],
1826
      '#description' => 'The Layer Switcher control displays a table of contents
1827
      for the map.  This allows the user interface to switch between
1828
      base layers and to show or hide overlays.  By default the switcher is
1829
      shown minimized on the right edge of the map, the user may expand it
1830
      by clicking on the handle.',
1831
  );
1832

  
1798 1833
  if (!$open_layers_is_enabled) {
1799 1834
    $form[CDM_MAP_DISTRIBUTION]['openlayers']['#description'] = '<div class="messages warning">'
1800 1835
        . 'The Openlayers viewer is currently not enabled! (see section Maps settings above )</div>'
......
1812 1847
    // 'edit-vmap0_world_basic' => 'EDIT Vmap0',
1813 1848
    'edit-etopo1' => "ETOPO1 Global Relief Model",
1814 1849
    'mapnik' => 'OpenStreetMap',
1815
    'osmarender' => 'OpenStreetMap (Tiles@home)',
1850
    'mapquest_open' => "MapQuest",
1851
    'mapquest_sat' => "MapQuest Sattelite",
1852
//     'osmarender' => 'OpenStreetMap (Tiles@home)',
1816 1853
    'gmap' => 'Google Streets',
1817 1854
    'gsat' => 'Google Satellite',
1818 1855
    'ghyb' => 'Google Hybrid',
......
1822 1859
    // 'yahoo' => 'Yahoo Street',
1823 1860
    // 'yahoosat' => 'Yahoo Satellite',
1824 1861
    // 'yahoohyb' => 'Yahoo Hybrid',
1862
     'custom_wms_base_layer_1' => 'Custom WMS base layer (needs to be manually configured below!)',
1825 1863
  );
1826 1864

  
1827 1865
  $form[CDM_MAP_DISTRIBUTION]['openlayers']['base_layers'] = array(
......
1832 1870
    '#description' => 'Choose the baselayer layer you prefer to use as map background in the OpenLayers dynamic mapviewer.',
1833 1871
  );
1834 1872

  
1835
  // cdm_dataportal_geoservice_showLayerSwitcher
1836
  $form[CDM_MAP_DISTRIBUTION]['openlayers']['show_layer_switcher'] = array(
1837
    '#type' => 'checkbox',
1838
    '#title' => 'Show Layer Switcher',
1839
    '#default_value' => $map_distribution['openlayers']['show_layer_switcher'],
1840
    '#description' => 'The Layer Switcher control displays a table of contents
1841
      for the map.  This allows the user interface to switch between
1842
      base layers and to show or hide overlays.  By default the switcher is
1843
      shown minimized on the right edge of the map, the user may expand it
1844
      by clicking on the handle.',
1873
  $form[CDM_MAP_DISTRIBUTION]['openlayers']['custom_wms_base_layer'] = array(
1874
      '#type' => 'fieldset',
1875
      '#title' => 'Custom WMS base layer',
1876
      '#tree' => TRUE,
1877
      '#collapsible' => FALSE,
1878
      '#collapsed' => FALSE,
1879
      '#description' => 'Here you an define a custom wms layer as additional base layer.',
1880
  );
1881

  
1882
  $form[CDM_MAP_DISTRIBUTION]['openlayers']['custom_wms_base_layer']['name'] = array(
1883
      '#type' => 'textfield',
1884
      '#title' => 'Layer name',
1885
      // Only line color by now.
1886
      '#default_value' => $map_distribution['openlayers']['custom_wms_base_layer']['name'],
1887
      '#description' => 'A arbitrary name for the layer.',
1888
  );
1889
  $form[CDM_MAP_DISTRIBUTION]['openlayers']['custom_wms_base_layer']['url'] = array(
1890
      '#type' => 'textfield',
1891
      '#title' => 'WMS url',
1892
      // Only line color by now.
1893
      '#default_value' => $map_distribution['openlayers']['custom_wms_base_layer']['url'],
1894
      '#description' => 'Base url for the WMS (e.g.  http://wms.jpl.nasa.gov/wms.cgi)'
1895
  );
1896
  $form[CDM_MAP_DISTRIBUTION]['openlayers']['custom_wms_base_layer']['params'] = array(
1897
      '#type' => 'textarea',
1898
      '#title' => 'WMS parameters',
1899
      '#element_validate' => array('form_element_validate_json'),
1900
      // Only line color by now.
1901
      '#default_value' => $map_distribution['openlayers']['custom_wms_base_layer']['params'],
1902
      '#description' => 'An javasript object with key/value pairs representing the GetMap query string parameters and parameter values, entered in valid JSON.'
1903
  );
1904
  $form[CDM_MAP_DISTRIBUTION]['openlayers']['custom_wms_base_layer']['projection'] = array(
1905
      '#type' => 'textfield',
1906
      '#title' => 'Projection',
1907
      // Only line color by now.
1908
      '#default_value' => $map_distribution['openlayers']['custom_wms_base_layer']['projection'],
1909
      '#description' => 'The desired projection for the layer (e.g. EPSG:4326, EPSG:900913, EPSG:3857)'
1910
  );
1911
  $form[CDM_MAP_DISTRIBUTION]['openlayers']['custom_wms_base_layer']['max_extent'] = array(
1912
      '#type' => 'textfield',
1913
      '#title' => 'Maximum extent',
1914
      // Only line color by now.
1915
      '#default_value' => $map_distribution['openlayers']['custom_wms_base_layer']['max_extent'],
1916
      '#description' => 'The maximum extent of the map as boundin box in the units of the map.'
1917
  );
1918
  $form[CDM_MAP_DISTRIBUTION]['openlayers']['custom_wms_base_layer']['units'] = array(
1919
      '#type' => 'textfield',
1920
      '#title' => 'Units',
1921
      '#default_value' => $map_distribution['openlayers']['custom_wms_base_layer']['units'],
1922
      '#description' => 'The layer map units.  Defaults to null.  Possible values are ‘degrees’ (or ‘dd’), ‘m’, ‘ft’, ‘km’, ‘mi’, ‘inches’.  Normally taken from the projection.  Only required if both map and layers do not define a projection, or if they define a projection which does not define units.'
1845 1923
  );
1846 1924

  
1847 1925
  /*
......
2325 2403
 * Form submission handler for textareas and textfields containing JSON.
2326 2404
 *
2327 2405
 * The contained JSON will be converted into an php array
2328
 * or object and will be stores in the variables as such.
2406
 * or object and will be stored in the variables as such.
2329 2407
 *
2330 2408
 * @see http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7#submit
2331 2409
 *

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)