Skip to content

Commit

Permalink
Fix WMSGetFeatureInfo popup for GeoJSON info format
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart van den Eijnden committed Nov 20, 2014
1 parent 1790734 commit 6cc9b59
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/script/plugins/WMSGetFeatureInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* @requires plugins/FeatureEditorGrid.js
* @requires GeoExt/widgets/Popup.js
* @requires OpenLayers/Control/WMSGetFeatureInfo.js
* @requires OpenLayers/Format/GeoJSON.js
* @requires OpenLayers/Format/WMSGetFeatureInfo.js
*/

Expand Down Expand Up @@ -95,6 +96,13 @@ gxp.plugins.WMSGetFeatureInfo = Ext.extend(gxp.plugins.Tool, {
* html: text, // responseText from server - only for "html" format
*/

/** private: method[constructor]
*/
constructor: function(config) {
this.geoJSONFormat = new OpenLayers.Format.GeoJSON();
gxp.plugins.WMSGetFeatureInfo.superclass.constructor.apply(this, arguments);
},

/** api: method[addActions]
*/
addActions: function() {
Expand Down Expand Up @@ -167,6 +175,11 @@ gxp.plugins.WMSGetFeatureInfo = Ext.extend(gxp.plugins.Tool, {
this.displayPopup(evt, title, '<pre>' + evt.text + '</pre>');
} else if (evt.features && evt.features.length > 0) {
this.displayPopup(evt, title, null, x.get("getFeatureInfo"));
} else if (infoFormat === 'application/json' && evt.text) {
evt.features = this.geoJSONFormat.read(evt.text);
if (evt.features && evt.features.length > 0) {
this.displayPopup(evt, title, null, x.get("getFeatureInfo"));
}
}
},
scope: this
Expand Down

0 comments on commit 6cc9b59

Please sign in to comment.