Forum: WebMapViewer Forum

Javascript API for WebMapViewer

Hi all,
the question n°7 in the WMV FAQ said that there are some Javascripts API to control the WebMapViewer. Where can I find the list and/or the documentation?

Thanks and regards
Marco


Re: Javascript API for WebMapViewer

Marco,

You should use updateFeatures(null,null,null,null,null,"1","1","1") with the "1" instead of the true.



Re: Javascript API for WebMapViewer

Thank you,
now I am able to add new specific layer, but how can I delete it without use the layerManager?
The function updateFeatures(null,null,null,null,null,true,true,true) does not "clean" the map.
In my hypothetical service, I need to add and remove the layers by clicking on a result link.
e.g.
{CODE()}
MOD.A2008045.0955.005: <a onclick="addOne('MOD','A2008045.0955.005');">View</a> | <a href="#" onclick="removeOne('MOD','A2008045.0955.005');">Remove</a>



Re: Javascript API for WebMapViewer

Marco,

For WFS layers that are added via this Javascript function, you cannot use URL parameters to be passed to GeoServer as we will use standard the HTTP POST binding for WFS.

In the WebMapViewer we have however implemented something similar as the CQL parameters that GeoServer uses. Add a parameter called criteria to the URL and what you put there will be taken into account in the WFS filter inside the POST message.

The function call then becomes:

addLayer("http://t7.services.meeo.it:8080/geoserver/wfs?version=1.0.0&outputFormat=GML2&criteria=platform%3DMOD%26granuleid%3DA2008045.0955.005","WFS","mft:modisdata")

We are using url escaped values for signs like '=' and '&' (use %3D for the =-sign and %26 of the &-sign). The '&'-sign is our AND-operator.

Best regards,



Re: Javascript API for WebMapViewer

In order to add a new feature to WMV, I'm trying to use the updateFeatures function.
I'm using this JavaScript snippet:

_and   = decodeURIComponent('%26'); // char: "&"
_apex  = decodeURIComponent('%27'); // char: "'" (apex)
_space = decodeURIComponent('%20'); // char: " " (space)
var wfsFeaturesURL="http://hostname:port/wfs|mft:modisdata|CQL_FILTER=((platform="+_apex+"MOD"+_apex+")AND(granuleid="+_apex+"A2008048.0845.005"+_apex+"))";
frameViewer.updateFeatures(null,null,null,null,wfsFeaturesURL,false,false,false);


When this code runs, the Feature is added to the "Layer Manager", but no footprints are displayed on the WMV.
Where is my mistake?

Thanks and regards.

p.s.
In the API's documentation, could you:
1) change the last two lines adding the null string into the function parameter? (null,aoiFeatures,null,null,null,false,false,false)
2) explain better how to use the parameter parameters of the addLayer function?



Re: Javascript API for WebMapViewer

Thank you very much!

Regards



Re: Javascript API for WebMapViewer

Marco,

The documentation can now be found in the WIKI pages


Best regards,

Steven




The original document is available at https://wiki.services.eoportal.org/tiki-view_forum_thread.php?comments_parentId=262&topics_offset=12&topics_sort_mode=title_asc&display=&fullscreen=&PHPSESSID=