I am trying to get specific fields from a wmsgetfeatureinfo request to show in a popup
When I console.log the event from the request I just get [object Object]
I know im missing something obvious but I cant figure out what
I am trying to get specific fields from a wmsgetfeatureinfo request to show in a popup
When I console.log the event from the request I just get [object Object]
I know im missing something obvious but I cant figure out what
Hi Ismail,
you are quite there, try using:
test = event.text;
Converting an Object to String will give you [Object Object]
Are you getting a popup with wrong data or no popup at all?
Regards
Lorenzo Pini
Software Engineer
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
On Mon, Apr 14, 2014 at 5:45 PM, Ismail, Mark
<mark.ismail@anonymised.com> wrote:
I am trying to get specific fields from a wmsgetfeatureinfo request to show
in a popupWhen I console.log the event from the request I just get [object Object]
I know im missing something obvious but I cant figure out what
-
info = new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://gistest:8080/geoserver/Geostore/wms’,
title: 'Identify features by clicking',
layers:[bus, wards],
queryLayers:[bus, wards],
queryVisible: true,
output: 'features',
infoFormat: 'application/json',
eventListeners: {
getfeatureinfo: function (event) {
//alert(event);
//console.log(event);
//console.log(event.text);
console.log(map.events);
test = event;
map.addPopup(new OpenLayers.Popup.FramedCloud(
"chicken",
map.getLonLatFromPixel(event.xy),
null,
"test text" + test,
null,
true
));
}
}
});
Mark
This e-mail and any attachments are confidential. It may contain privileged
information and is intended for the named recipient(s) only. It must not be
distributed without consent. If you are not one of the intended recipients,
please notify the sender immediately and do not disclose, distribute, or
retain this email or any part of it and do not take any action based on it.Unless expressly stated, opinions in this email are those of the individual
sender, and not of Knowsley MBC. Legally binding obligations can only be
created for, or be entered into on behalf of, Knowsley MBC by duly
authorised officers or representatives.Knowsley MBC excludes any liability whatsoever for any offence caused, any
direct or consequential loss arising from the use, or reliance on, this
e-mail or its contents. We believe but do not warrant that this e-mail and
any attachments are virus free. You must therefore take full responsibility
for virus checking and no responsibility is accepted for loss or damage
arising from viruses or changes made to this message after it was sent.
Knowsley MBC reserves the right to monitor and/or record all e-mail
communications through its network in accordance with relevant legislation.------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
I am getting a popup with undefined instead of the data
One of the lads here suggested a json parser - I may give that a go
Mark
-----Original Message-----
From: lore.gnafu@...84... [mailto:lore.gnafu@…84…] On Behalf Of Lorenzo Pini
Sent: 15 April 2014 10:34
To: Ismail, Mark
Cc: geoserver mailing list (geoserver-users@lists.sourceforge.net)
Subject: Re: [Geoserver-users] navigating a wmsgetfeatureinfo json response
Hi Ismail,
you are quite there, try using:
test = event.text;
Converting an Object to String will give you [Object Object] Are you getting a popup with wrong data or no popup at all?
Regards
Lorenzo Pini
Software Engineer
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
On Mon, Apr 14, 2014 at 5:45 PM, Ismail, Mark <mark.ismail@...6440...> wrote:
I am trying to get specific fields from a wmsgetfeatureinfo request to
show in a popupWhen I console.log the event from the request I just get [object
Object]I know im missing something obvious but I cant figure out what
-
info = new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://gistest:8080/geoserver/Geostore/wms’,
title: 'Identify features by clicking',
layers:[bus, wards],
queryLayers:[bus, wards],
queryVisible: true,
output: 'features',
infoFormat: 'application/json',
eventListeners: {
getfeatureinfo: function (event) {
//alert(event);
//console.log(event);
//console.log(event.text);
console.log(map.events);
test = event;
map.addPopup(new OpenLayers.Popup.FramedCloud(
"chicken",
map.getLonLatFromPixel(event.xy),
null,
"test text" + test,
null,
true
));
}
}
});
Mark
This e-mail and any attachments are confidential. It may contain
privileged information and is intended for the named recipient(s)
only. It must not be distributed without consent. If you are not one
of the intended recipients, please notify the sender immediately and
do not disclose, distribute, or retain this email or any part of it and do not take any action based on it.Unless expressly stated, opinions in this email are those of the
individual sender, and not of Knowsley MBC. Legally binding
obligations can only be created for, or be entered into on behalf of,
Knowsley MBC by duly authorised officers or representatives.Knowsley MBC excludes any liability whatsoever for any offence caused,
any direct or consequential loss arising from the use, or reliance on,
this e-mail or its contents. We believe but do not warrant that this
e-mail and any attachments are virus free. You must therefore take
full responsibility for virus checking and no responsibility is
accepted for loss or damage arising from viruses or changes made to this message after it was sent.
Knowsley MBC reserves the right to monitor and/or record all e-mail
communications through its network in accordance with relevant legislation.----------------------------------------------------------------------
-------- Learn Graph Databases - Download FREE O'Reilly Book "Graph
Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field, this
first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
This e-mail and any attachments are confidential. It may contain privileged information and is intended for the named recipient(s) only. It must not be distributed without consent. If you are not one of the intended recipients, please notify the sender immediately and do not disclose, distribute, or retain this email or any part of it and do not take any action based on it.
Unless expressly stated, opinions in this email are those of the individual sender, and not of Knowsley MBC. Legally binding obligations can only be created for, or be entered into on behalf of, Knowsley MBC by duly authorised officers or representatives.
Knowsley MBC excludes any liability whatsoever for any offence caused, any direct or consequential loss arising from the use, or reliance on, this e-mail or its contents. We believe but do not warrant that this e-mail and any attachments are virus free. You must therefore take full responsibility for virus checking and no responsibility is accepted for loss or damage arising from viruses or changes made to this message after it was sent. Knowsley MBC reserves the right to monitor and/or record all e-mail communications through its network in accordance with relevant legislation.
Hi Mark
Try to looks on the browser network profile, while the GetFeatureInfo request in performed. I believe json response is simple enough.
Additionally you could log request url and try to execute it directly on geoserver (without OpenLayers).
Thanks,
Andrii
On Tue, Apr 15, 2014 at 1:17 PM, Ismail, Mark <mark.ismail@anonymised.com> wrote:
I am getting a popup with undefined instead of the data
One of the lads here suggested a json parser - I may give that a go
Mark
-----Original Message-----
From: lore.gnafu@anonymised.com [mailto:lore.gnafu@anonymised.com] On Behalf Of Lorenzo Pini
Sent: 15 April 2014 10:34
To: Ismail, Mark
Cc: geoserver mailing list (geoserver-users@lists.sourceforge.net)
Subject: Re: [Geoserver-users] navigating a wmsgetfeatureinfo json responseHi Ismail,
you are quite there, try using:test = event.text;
Converting an Object to String will give you [Object Object] Are you getting a popup with wrong data or no popup at all?
Regards
Lorenzo Pini
Software Engineer==
Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK for more information.GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272http://www.geo-solutions.it
http://twitter.com/geosolutions_itOn Mon, Apr 14, 2014 at 5:45 PM, Ismail, Mark <mark.ismail@anonymised.com> wrote:
I am trying to get specific fields from a wmsgetfeatureinfo request to
show in a popupWhen I console.log the event from the request I just get [object
Object]I know im missing something obvious but I cant figure out what
info = new OpenLayers.Control.WMSGetFeatureInfo({
url: ‘http://gistest:8080/geoserver/Geostore/wms’,
title: ‘Identify features by clicking’,
layers:[bus, wards],
queryLayers:[bus, wards],
queryVisible: true,
output: ‘features’,
infoFormat: ‘application/json’,
eventListeners: {
getfeatureinfo: function (event) {
//alert(event);
//console.log(event);
//console.log(event.text);
console.log(map.events);
test = event;
map.addPopup(new OpenLayers.Popup.FramedCloud(
“chicken”,
map.getLonLatFromPixel(event.xy),
null,
“test text” + test,
null,
true
));
}
}
});
Mark
This e-mail and any attachments are confidential. It may contain
privileged information and is intended for the named recipient(s)
only. It must not be distributed without consent. If you are not one
of the intended recipients, please notify the sender immediately and
do not disclose, distribute, or retain this email or any part of it and do not take any action based on it.Unless expressly stated, opinions in this email are those of the
individual sender, and not of Knowsley MBC. Legally binding
obligations can only be created for, or be entered into on behalf of,
Knowsley MBC by duly authorised officers or representatives.Knowsley MBC excludes any liability whatsoever for any offence caused,
any direct or consequential loss arising from the use, or reliance on,
this e-mail or its contents. We believe but do not warrant that this
e-mail and any attachments are virus free. You must therefore take
full responsibility for virus checking and no responsibility is
accepted for loss or damage arising from viruses or changes made to this message after it was sent.
Knowsley MBC reserves the right to monitor and/or record all e-mail
communications through its network in accordance with relevant legislation.
-------- Learn Graph Databases - Download FREE O’Reilly Book "Graph
Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field, this
first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-usersThis e-mail and any attachments are confidential. It may contain privileged information and is intended for the named recipient(s) only. It must not be distributed without consent. If you are not one of the intended recipients, please notify the sender immediately and do not disclose, distribute, or retain this email or any part of it and do not take any action based on it.
Unless expressly stated, opinions in this email are those of the individual sender, and not of Knowsley MBC. Legally binding obligations can only be created for, or be entered into on behalf of, Knowsley MBC by duly authorised officers or representatives.
Knowsley MBC excludes any liability whatsoever for any offence caused, any direct or consequential loss arising from the use, or reliance on, this e-mail or its contents. We believe but do not warrant that this e-mail and any attachments are virus free. You must therefore take full responsibility for virus checking and no responsibility is accepted for loss or damage arising from viruses or changes made to this message after it was sent. Knowsley MBC reserves the right to monitor and/or record all e-mail communications through its network in accordance with relevant legislation.
Learn Graph Databases - Download FREE O’Reilly Book
“Graph Databases” is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
There is a particular reason you are requesting json?
If not, you can simply ask GeoServer to respond with a "text/html" or
"text/plain"
infoFormat: 'text/html',
You can find the GeoServer WMS docs at
http://docs.geoserver.org/latest/en/user/services/wms/reference.html
Lorenzo Pini
Software Engineer
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
On Tue, Apr 15, 2014 at 1:15 PM, Andrey Borovik <shupakabras@anonymised.com> wrote:
Hi Mark
Try to looks on the browser network profile, while the GetFeatureInfo
request in performed. I believe json response is simple enough.
Additionally you could log request url and try to execute it directly on
geoserver (without OpenLayers).Thanks,
AndriiOn Tue, Apr 15, 2014 at 1:17 PM, Ismail, Mark <mark.ismail@anonymised.com>
wrote:I am getting a popup with undefined instead of the data
One of the lads here suggested a json parser - I may give that a go
Mark
-----Original Message-----
From: lore.gnafu@anonymised.com [mailto:lore.gnafu@anonymised.com] On Behalf Of
Lorenzo Pini
Sent: 15 April 2014 10:34
To: Ismail, Mark
Cc: geoserver mailing list (geoserver-users@lists.sourceforge.net)
Subject: Re: [Geoserver-users] navigating a wmsgetfeatureinfo json
responseHi Ismail,
you are quite there, try using:test = event.text;
Converting an Object to String will give you [Object Object] Are you
getting a popup with wrong data or no popup at all?Regards
Lorenzo Pini
Software Engineer==
Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK for
more information.GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272http://www.geo-solutions.it
http://twitter.com/geosolutions_itOn Mon, Apr 14, 2014 at 5:45 PM, Ismail, Mark
<mark.ismail@anonymised.com> wrote:
> I am trying to get specific fields from a wmsgetfeatureinfo request to
> show in a popup
>
>
>
> When I console.log the event from the request I just get [object
> Object]
>
>
>
> I know im missing something obvious but I cant figure out what
>
> -
>
>
>
> info = new OpenLayers.Control.WMSGetFeatureInfo({
>
> url: 'http://gistest:8080/geoserver/Geostore/wms’,
>
> title: 'Identify features by clicking',
>
> layers:[bus, wards],
>
> queryLayers:[bus, wards],
>
> queryVisible: true,
>
> output: 'features',
>
> infoFormat: 'application/json',
>
> eventListeners: {
>
> getfeatureinfo: function (event) {
>
> //alert(event);
>
> //console.log(event);
>
> //console.log(event.text);
>
> console.log(map.events);
>
> test = event;
>
> map.addPopup(new OpenLayers.Popup.FramedCloud(
>
> "chicken",
>
> map.getLonLatFromPixel(event.xy),
>
> null,
>
> "test text" + test,
>
> null,
>
> true
>
> ));
>
> }
>
> }
>
> });
>
>
>
> Mark
>
>
>
> This e-mail and any attachments are confidential. It may contain
> privileged information and is intended for the named recipient(s)
> only. It must not be distributed without consent. If you are not one
> of the intended recipients, please notify the sender immediately and
> do not disclose, distribute, or retain this email or any part of it and
> do not take any action based on it.
>
> Unless expressly stated, opinions in this email are those of the
> individual sender, and not of Knowsley MBC. Legally binding
> obligations can only be created for, or be entered into on behalf of,
> Knowsley MBC by duly authorised officers or representatives.
>
> Knowsley MBC excludes any liability whatsoever for any offence caused,
> any direct or consequential loss arising from the use, or reliance on,
> this e-mail or its contents. We believe but do not warrant that this
> e-mail and any attachments are virus free. You must therefore take
> full responsibility for virus checking and no responsibility is
> accepted for loss or damage arising from viruses or changes made to this
> message after it was sent.
> Knowsley MBC reserves the right to monitor and/or record all e-mail
> communications through its network in accordance with relevant
> legislation.
>
> ----------------------------------------------------------------------
> -------- Learn Graph Databases - Download FREE O'Reilly Book "Graph
> Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field, this
> first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech
> _______________________________________________
> Geoserver-users mailing list
> Geoserver-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
This e-mail and any attachments are confidential. It may contain
privileged information and is intended for the named recipient(s) only. It
must not be distributed without consent. If you are not one of the intended
recipients, please notify the sender immediately and do not disclose,
distribute, or retain this email or any part of it and do not take any
action based on it.Unless expressly stated, opinions in this email are those of the
individual sender, and not of Knowsley MBC. Legally binding obligations can
only be created for, or be entered into on behalf of, Knowsley MBC by duly
authorised officers or representatives.Knowsley MBC excludes any liability whatsoever for any offence caused, any
direct or consequential loss arising from the use, or reliance on, this
e-mail or its contents. We believe but do not warrant that this e-mail and
any attachments are virus free. You must therefore take full responsibility
for virus checking and no responsibility is accepted for loss or damage
arising from viruses or changes made to this message after it was sent.
Knowsley MBC reserves the right to monitor and/or record all e-mail
communications through its network in accordance with relevant legislation.------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Indeed this is a root of problem.
Since the infoFormat is chaged to ‘application/json’, format should be also changed (otherwise, default expectation is text/html )
In your case, you should add
format: new OpenLayers.Format.JSON
Thanks,
Andrii
On Tue, Apr 15, 2014 at 2:59 PM, Lorenzo Pini <lorenzo.pini@anonymised.com> wrote:
There is a particular reason you are requesting json?
If not, you can simply ask GeoServer to respond with a “text/html” or
“text/plain”infoFormat: ‘text/html’,
You can find the GeoServer WMS docs at
http://docs.geoserver.org/latest/en/user/services/wms/reference.htmlLorenzo Pini
Software Engineer==
Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK
for more information.GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272http://www.geo-solutions.it
http://twitter.com/geosolutions_itOn Tue, Apr 15, 2014 at 1:15 PM, Andrey Borovik <shupakabras@…84…> wrote:
Hi Mark
Try to looks on the browser network profile, while the GetFeatureInfo
request in performed. I believe json response is simple enough.
Additionally you could log request url and try to execute it directly on
geoserver (without OpenLayers).Thanks,
AndriiOn Tue, Apr 15, 2014 at 1:17 PM, Ismail, Mark <mark.ismail@anonymised.com>
wrote:I am getting a popup with undefined instead of the data
One of the lads here suggested a json parser - I may give that a go
Mark
-----Original Message-----
From: lore.gnafu@anonymised.com [mailto:lore.gnafu@anonymised.com] On Behalf Of
Lorenzo Pini
Sent: 15 April 2014 10:34
To: Ismail, Mark
Cc: geoserver mailing list (geoserver-users@lists.sourceforge.net)
Subject: Re: [Geoserver-users] navigating a wmsgetfeatureinfo json
responseHi Ismail,
you are quite there, try using:test = event.text;
Converting an Object to String will give you [Object Object] Are you
getting a popup with wrong data or no popup at all?Regards
Lorenzo Pini
Software Engineer==
Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK for
more information.GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272http://www.geo-solutions.it
http://twitter.com/geosolutions_itOn Mon, Apr 14, 2014 at 5:45 PM, Ismail, Mark
<mark.ismail@anonymised.com…> wrote:I am trying to get specific fields from a wmsgetfeatureinfo request to
show in a popupWhen I console.log the event from the request I just get [object
Object]I know im missing something obvious but I cant figure out what
info = new OpenLayers.Control.WMSGetFeatureInfo({
url: ‘http://gistest:8080/geoserver/Geostore/wms’,
title: ‘Identify features by clicking’,
layers:[bus, wards],
queryLayers:[bus, wards],
queryVisible: true,
output: ‘features’,
infoFormat: ‘application/json’,
eventListeners: {
getfeatureinfo: function (event) {
//alert(event);
//console.log(event);
//console.log(event.text);
console.log(map.events);
test = event;
map.addPopup(new OpenLayers.Popup.FramedCloud(
“chicken”,
map.getLonLatFromPixel(event.xy),
null,
“test text” + test,
null,
true
));
}
}
});
Mark
This e-mail and any attachments are confidential. It may contain
privileged information and is intended for the named recipient(s)
only. It must not be distributed without consent. If you are not one
of the intended recipients, please notify the sender immediately and
do not disclose, distribute, or retain this email or any part of it and
do not take any action based on it.Unless expressly stated, opinions in this email are those of the
individual sender, and not of Knowsley MBC. Legally binding
obligations can only be created for, or be entered into on behalf of,
Knowsley MBC by duly authorised officers or representatives.Knowsley MBC excludes any liability whatsoever for any offence caused,
any direct or consequential loss arising from the use, or reliance on,
this e-mail or its contents. We believe but do not warrant that this
e-mail and any attachments are virus free. You must therefore take
full responsibility for virus checking and no responsibility is
accepted for loss or damage arising from viruses or changes made to this
message after it was sent.
Knowsley MBC reserves the right to monitor and/or record all e-mail
communications through its network in accordance with relevant
legislation.
-------- Learn Graph Databases - Download FREE O’Reilly Book “Graph
Databases” is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field, this
first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-usersThis e-mail and any attachments are confidential. It may contain
privileged information and is intended for the named recipient(s) only. It
must not be distributed without consent. If you are not one of the intended
recipients, please notify the sender immediately and do not disclose,
distribute, or retain this email or any part of it and do not take any
action based on it.Unless expressly stated, opinions in this email are those of the
individual sender, and not of Knowsley MBC. Legally binding obligations can
only be created for, or be entered into on behalf of, Knowsley MBC by duly
authorised officers or representatives.Knowsley MBC excludes any liability whatsoever for any offence caused, any
direct or consequential loss arising from the use, or reliance on, this
e-mail or its contents. We believe but do not warrant that this e-mail and
any attachments are virus free. You must therefore take full responsibility
for virus checking and no responsibility is accepted for loss or damage
arising from viruses or changes made to this message after it was sent.
Knowsley MBC reserves the right to monitor and/or record all e-mail
communications through its network in accordance with relevant legislation.
Learn Graph Databases - Download FREE O’Reilly Book
“Graph Databases” is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Learn Graph Databases - Download FREE O’Reilly Book
“Graph Databases” is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users