I could not find a handler for WFS in the code, I hacked one into the openlayers.module and one into the openlayers.layers.js just to see if I could get it working and this gets the wfs layer to validate and to show in the switcher, but the data wont display. Since my data source is outside the drupal host, it needs a proxyhost to work but I dont see that either...

the code I used to get that far is as follows:
in openlayers.module:


/**
 * Implementation of hook_openlayers_layers_handler_info().
 */
function openlayers_openlayers_layers_handler_info($map = array()) {
  return array(

    'WMS' => array(
      'layer_handler' => 'WMS',
      'js_file' => drupal_get_path('module', 'openlayers') .'/js/openlayers.layers.js',
    ),

    'WFS' => array(
      'layer_handler' => 'WFS',
      'js_file' => drupal_get_path('module', 'openlayers') .'/js/openlayers.layers.js',
    ),


    'Vector' => array(
      'layer_handler' => 'Vector',
      'js_file' => drupal_get_path('module', 'openlayers') .'/js/openlayers.layers.js',
    ),
  );
}

in the openlayers.layers.js:

/**
 * Process WFS Layers
 * 
 * Process a WFS definition into a OpenLayers WFS Object
 * 
 * @param layerOptions
 *   The WFS layer part of the map definition array.
 * @param mapid
 *   Map ID.
 * @return
 *  OpenLayers WFS layer object.
 */
OL.Layers.WFS = function(layerOptions, mapid) {
  // Check if there is a defined format
  if (typeof(layerOptions.params.format) == "undefined"){
    layerOptions.params.format = "image/png";
  }

  // Return Layer object
  return new OpenLayers.Layer.WFS(layerOptions.name, layerOptions.url, layerOptions.params, layerOptions.options);
}

the layer array I used to make this happen was like this:

       'sparcs_fire_danger' => array(
        'id' => sparcs_fire_danger,
        'type' => 'WFS',
        'name' => 'FWI Danger Rating',
        'projection' => array('900913'),
        'baselayer' => false,
        'url' => 'http://gnwt.sparcsonline.com:8080/geoserver/wfs?' ,
        'params' => array(
          'layers' => 'fmd:fwidanger',
        	"wfs_typename" => "fmd:fwidanger",
          "wfs_version" => "1.0.0",
          "wfs_request_method" => "GET",
          "wfs_connectiontimeout" => "60",
          "wfs_maxfeatures" => "999",
        ),  
          
         'options' => array( 
          

        ),
      ),

Comments

zzolo’s picture

Status: Active » Closed (won't fix)

@spydmobile

All of this looks pretty good. Unfortunately, there is not support for proxy and using URL's outside your domain. We will be addressing this in 2.x: #615968: Document Proxy Possibilty

If you can get a proxy to work, this should work fine for you.

spydmobile’s picture

Ikes, please obscure that URL up there for me Alan, pretty please?