[OpenLayers-Users] How can I show a picture a popup (URL for
the pic should be read automatically from the attributes)
Max Stephan
x.zam at gmx.net
Thu Feb 26 13:50:03 EST 2009
If anyone´s interested in the almost final results, here you go:
http://141.13.60.18:8080/geoserver/www/wfs-test5.htm
http://141.13.60.18:8080/geoserver/www/wfs-test5.htm . It´s the product of a
project at my university where we mapped all letter-boxes, stamp-automates,
parcel-stations and phoneboxes in our town (Bamberg).
greets
Max Stephan
P.S.: If you see something in the code that could cause problems feel free
to let me know :)
Max Stephan wrote:
>
> Hey,
>
> I was successfull getting it to work via GML. It now looks like this:
>
> function setHTML(response){
>
> var gmlparser = new OpenLayers.Format.GML();
> var features = gmlparser.read(response.responseText);
> var url;
> var postart;
> var postamt;
>
> for(var feat in features) {
> url = features[feat].attributes.url;
> postart = features[feat].attributes.postart;
> postamt = features[feat].attributes.postamt;
> }
>
> In the lines that follow I´m defining the output but that´s just basic
> stuff. OK, now that I achieved this, there´s another question:
> I´m going to query multiple layers that have different attributes. That
> means I have to read from the GML which layer contains the current feature
> to know which further reading-operations have to be done. One easy method
> would be to add an attribute "type" to each layer which is read via
> "features[feat].attributes.type" and to check this attribute with "if...
> else". But it´ll be nicer if I could read the layer-Name directly. I found
> the layerName-function in the API-Documentation of OpenLayers but the var
> which should have contained the layerName always staid "undefined" (I
> tried "features[feat].layerName" and "response.layerName").
>
> Thx in advance and greets
> Max Stephan
>
>
> Ivan Grcic-2 wrote:
>>
>> Hi,
>>
>> im sorry i also dont know so much about Format.XML methods, i mostly
>> use Format.GML or JSON
>>
>> but this should help:
>> http://openlayers.org/dev/examples/xml.html
>> http://dev.openlayers.org/docs/files/OpenLayers/Format/XML-js.html
>>
>> Cheers,
>>
>
>
>
>
--
View this message in context: http://n2.nabble.com/How-can-I-show-a-picture-a-popup-%28URL-for-the-pic-should-be-read-automatically-from-the-attributes%29-tp2262546p2391473.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list