kigen / Ushahidi-plugin-wms

A simple plugin for Ushahidi platform that allows adding OGC WMS Layers as {Base or Overlay}
6 stars 4 forks source link

instead of line 100 it was line 124 with latest Ushahidi release #1

Closed robertdbuckley closed 12 years ago

robertdbuckley commented 12 years ago

Date: 01-05-2012

  1. Edit Map helper application/helper/map.php line 100 just above  return $js add this line of code  Event::run('ushahidi_filter.map_base_layers_code', $js); 

In my installtion I added the code to line 124 like so...

            Event::run('ushahidi_filter.map_layers_js', $js);
            Event::run('ushahidi_filter.map_base_layers_code', $js);
            return $js;
    }

however I keep getting this error when I activate the plugin and try to load the main page of Ushahidi.

An error was detected which prevented the loading of this page. If this problem persists, please contact the website administrator. application/helpers/map.php [42]: Undefined index: osm_mapnik

robertdbuckley commented 12 years ago

I was using USHAHIDI VERSION: 2.3.1..by the way....be great if it worked with latest version ;-)

kigen commented 12 years ago

This plugin works with 2.2 very well, developed and tested it with 2.2 but forgot to upgrade it to support 2.3

I have tested the plugin with 2.3 and i am getting the same error, on close inspection, it seems the plugin installation code isn't working. {Still investigating why?}

Beyond that error, there is another error that i am encountering(Some weird JavaScript error) {Still Investigating}

You can utilize Mackay's plugin https://github.com/rjmackay/Ushahidi-plugin-metacarta. for now as i fix those bugs.

robertdbuckley commented 12 years ago

Mackay's version works great for basemaps, but adding wms overlays seems to be more difficult. I assume that that is what your version does having looked at your code in config/map.php?

robertdbuckley commented 12 years ago

I´m getting the same error with Ushahidi 2.2!

FILE: application/helpers/map.php LINE: 41 ERROR: Undefined index: google_normal

URL: maps.zgb.de/ushahidi_22/admin/settings REFERER: http://maps.zgb.de/ushahidi_22/admin/settings/site _USERAGENT: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.162 Safari/535.19 IP: 87.139.33.85 USHAHIDI VERSION: 2.2 DB VERSION: 76

Am I doing something wrong?

kigen commented 12 years ago

Released a new version

Ver 0.2 Fully tested with 2.3 and 2.4 & Ver 0.3 fully tested with the latest code 2.5

robertdbuckley commented 12 years ago

Hi Seth,

In the ushahidi dev forum Heather asked to test the new wms plugin written by yourself.

I have tested on 2.4 and 2.5 and both times I receive the following Error message.

application/helpers/map.php [42]: 

Undefined index: osm_mapnik 

I have tested the plugin with the default layers from opengeo and from my own geoserver, but I have not had any success.

Thanks,

Robert Buckley


Von: Seth Kigen reply@reply.github.com An: Robert Buckley robertdbuckley@yahoo.com Gesendet: 15:23 Donnerstag, 2.August 2012 Betreff: Re: [Ushahidi-plugin-wms] instead of line 100 it was line 124 with latest Ushahidi release (#1)

Released a new version

Ver 0.2 Fully tested with 2.3 and 2.4 & Ver 0.3 fully tested with the latest code 2.5


Reply to this email directly or view it on GitHub: https://github.com/kigen/Ushahidi-plugin-wms/issues/1#issuecomment-7455019

kigen commented 12 years ago

Thank you, Robert for testing the plugin. This error seems to be a result of an unsuccessful installation of the plugin. I would kindly like to know

  1. If you had any errors while installing the plugin.
  2. Which version of the plugin did you use for Ushahidi 2.4 and 2.5
  3. if you can access the database kindly check Settings table -> default_map field: what id the value of this field.

This info will help me diagnose the genesis of the error. Thank you!

robertdbuckley commented 12 years ago

Just noticed a typo in hooks/wms.php line 17 "regsiter_map_layers" - should be register.

Not a solution to the problem though!

robertdbuckley commented 12 years ago

Hi seth.

  1. what is the installation process??? I thought I just had to download the plugin to "plugins" and activate in the ushahidi-admin?
  2. I am testing on both 2.4 and 2.5
  3. my settings table does not have the field "default_map_field". It just has default_map which is set to "osm_mapnik"
robertdbuckley commented 12 years ago

"regsiter_map_layers" is consistent - so can´t affect the code!

robertdbuckley commented 12 years ago

Question 2: I did the following on linux for version 2.5 (I also tested sudo git clone https://github.com/kigen/Ushahidi-plugin-wms.git -b 2.5

Question 3: ID = 22 Value of default_map = google_satellite

It seems therefore that the wms_install.php is not working!

robertdbuckley commented 12 years ago

ok...I manually edited the database with the settings in wms_install.php and can see the maps defined in the wms.php settings file! Great work!

robertdbuckley commented 12 years ago

One question though. The Plugin needs to set a basemap AND an overlay layer. If the wms_base does not exist in the wms.php file in the plugin directory, the map does not default back to osm_mapnik. Therefore as far as I can tell, there is no way to define wms overlay layers which display with a mapnik/google etc....or is there a way to create a layer config for the osm_mapnik layer and the wms overlay?

kigen commented 12 years ago

Thanks again for helping me test this plugin. I will try looking into the plugin installation issue.

kigen commented 12 years ago

I was thinking of the same issue was few minutes ago. I will have to rethink the whole plugin again.

robertdbuckley commented 12 years ago

I see....would it be possible to put the service_url variable into the layer config? This would at least allow the user to use different wms layers which come from different geoserver services....and also allow wms_base to be configured independantly of the service_url.

robertdbuckley commented 12 years ago

for example: something like this

$config['layers'] = array( 'wms_base' => array( 'title' => "OpenStreetmap", 'name' => "osm_mapnik", 'openlayers' = "OSM.Mapnik"; 'api_url' ="https://www.openstreetmap.org/openlayers/OpenStreetMap.js"; 'base' => TRUE ) , 'overlay_1' => array( 'title' => "Theme 1", 'name' => "zgb:grenzen_lk", 'service_url' => "http://maps.zgb.de/geoserver/wms", 'base' => FALSE ) , 'overlay_2' => array( 'title' => "Theme 2", 'name' => "zgb:wea", 'service_url' => "http://maps.zgb.de/geoserver/wms", 'base' => FALSE )

);

robertdbuckley commented 12 years ago

Is there also a way to alter map.php and allow overlay layers here? e.g

public static function overlay($layer_name = NULL) { $layers = array();

    // CONFIG FOR MY OVERLAY LYR
    );
    $layers[$layer->name] = $layer;
robertdbuckley commented 12 years ago

Why do ALL layers in applications/helpers/map.php get set to "baselayer" even though 'baselayer' => FALSE,????

What is overriding this?

robertdbuckley commented 12 years ago

I´ve just got wms working as a hack!

I simply added this to line 440 in ushahidi.js

    var layer_zgb_grenze =new OpenLayers.Layer.WMS("Planungsraum Grenze", "http://maps.zgb.de/geoserver/wms", {
    layers: 'zgb:Grenzen_ZGB',
    format: 'image/png',
    transparent: true,
    singleTile: true
        }, {
    'buffer': 0,
    'opacity': 1,
    'isBaseLayer': false,
    visibility: true
    }); 

    var layer_raum =new OpenLayers.Layer.WMS("Planungsraum Grenze", "http://maps.zgb.de/geoserver/wms", {
    layers: 'RROP08 Raum und Siedlung (Gruppenlayer)',
    format: 'image/png',
    transparent: true,
    singleTile: true
        }, {
    'buffer': 0,
    'opacity': 1,
    'isBaseLayer': false,
    visibility: true
    });

    this._olMap.addLayers([layer_raum,layer_zgb_grenze]);
kigen commented 12 years ago

The latest commit fixes all of the above issues.

robertdbuckley commented 12 years ago

Hi, just wanted to ask if there is any progress on creating a plugin for wms overlay layers? Is this a priority for ushahidi?

kigen commented 12 years ago

Hi Robert, This version of the plugin supports wms overlays. Now you can have OSM/Google as the base map and use this plugin to attach wms based overlays. The earlier version required a full wms setup, where the base layer had to be a wms based layer to have wms overlays.

robertdbuckley commented 12 years ago

really? I have to test this out. Does this work with ushahidi 2.5 or 2.6?