[OpenLayers-Users] Possible in openlayers?

Slawomir Messner slawomir.messner at staff.uni-marburg.de
Tue May 29 02:44:22 PDT 2012


Hi,
like some others told, drawing is a standard control of OL and described
in some examples. Additional information to a layer is also no problem.
Since your interface needs some metadata for loading the layer, like
name, URL or Format, you can also preload "description".  For name there
is already an attribute in an OL layer (see
http://dev.openlayers.org/releases/OpenLayers-2.11/doc/apidocs/files/OpenLayers/Layer-js.html)
for other non standard attributes you can create your own:
var layer =
OpenLayers.Layer.WMS("myname",myurl,{"layers":mylayers,"format":"image/png"},{"description":"This
is a description"});
You can use the new value like:
alert(layer.description);
Since JavaScript is an prototype language you can add anything to nearly
every object(as I know, there are some restrictions for security).
If you don't want to extend your layer objects you can write some ajax
calls and use name, url or an other unique attribute set to request
additional data.
I would prefer the first solution for often used data, the second for
rarly used data or very large data.
For the first solution you should consider to use an own "namespace" for
custom attributes then the description should be accessible with:
layer.myuniquenamespace.description
and a moredata attribute:
 layer.myuniquenamespace.moredata.
Both ways will need an custom Control to show your attributes, except
for name and attribution the LayerSwitcher control uses it, and when you
want the user to change the attribute you need a custom saving function.
Regards
Slawomir


Am 29.05.2012 10:45, schrieb Gary Duckers:
>
> I am new to web based mapping and I am looking at developing a map
> that allows users to draw features (line, polygon and point). However
> I wish user to be able to add information in a text format to each
> vector such as 'name' and 'description' and then be able to download
> each vector type in kml format or shp. Is this currently possible with
> OpenLayers. Any advice would be greatly appreciated.
>
>  
>
> Gary
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120529/40715f73/attachment-0001.html>


More information about the Users mailing list