[Users] how to include a download button for downloadind a vector layer with lines/pol draw by user
Alexandre Dubé
adube at mapgears.com
Wed Nov 21 14:49:24 CET 2012
Hi,
If you mean "export the features as text" then you need to pick a
format in which you want to export your data, for example GeoJSON, KML,
etc. Here's a live example doing it in KML :
http://dev.geoext.org/geoext/sandbox/redlining/ux/FeatureEditing/examples/ControlerOnlyExample.html
Start by drawing a feature (any first 3 tools). A popup will appear
in which there's an export button at the bottom left of the bottom
toolbar. You could also use the one in the map toolbar. Here's the code
that actualy does the KML writing :
http://dev.geoext.org/geoext/sandbox/redlining/ux_externals/layermanager/ux/data/Export.js
Feel free to use any portion of this widget.
HTH,
Alexandre
On 12-11-21 03:19 AM, nacho barandalla wrote:
> Hi everyone,
>
> I'm not sure this is the channel to send doubts to the
> community....anyway, let's go! (If not, im sorry and please tell me
> the correct way to do it.)
>
> My question is how to include a download button for downloadind a
> vector layer with lines/pol draw by user. explain:
>
> I have a map developed with geoext with several functions.
> With the drawing controls, user is able to draw polygon and lines and
> stores it in a vector layer (called vector1). I need to give the
> user the possibility to download that vector layer containing its own
> draw, but I have no idea how to do it!
> The idea is to create a json layer and browse to save it in local user
> pc....
>
> Some help or idea please?
>
> Thanks a lot
>
>
> My code is:
>
>
> var vector = new OpenLayers.Layer.Vector("vector1");
> map.addLayers([vector]);
>
> var ctrl, toolbarItems = [], action, actions = {};
> action = new GeoExt.Action({
> text: "Dibuja polígono",
> control: new OpenLayers.Control.DrawFeature(
> vector, OpenLayers.Handler.Polygon
> ),
> map: map,
> // button options
> toggleGroup: "draw",
> allowDepress: true,
> tooltip: "draw polygon",
> // check item options
> group: "draw"
> });
> actions["draw_poly"] = action;
> toolbarItems.push(action);
>
>
> Thank again!
>
>
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
--
Alexandre Dubé
Mapgears
www.mapgears.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20121121/f6041606/attachment.htm
More information about the Users
mailing list