<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
<br>Thanks Alexandre,<br><br>Finally I did it drawing the features in a kml vector layer and exporting with the following function (with LayerManager):<br><br><br><u>Define vector layer:</u><br><br> var <font style="" color="#FF0000">vector </font>= new OpenLayers.Layer.Vector("vector", {<br> projection: map.displayProjection,<br> strategies: [new OpenLayers.Strategy.Fixed()],<br> protocol: new OpenLayers.Protocol.HTTP({<br> url: "placemark_floating.kml",<br> format: new OpenLayers.Format.KML({<br> extractStyles: true,<br> extractAttributes: true,<br> kmlns: "http://www.opengis.net/kml/2.2"<br> })<br> })<br> });<br><br><br><u>Draw features:</u><br><br> action = new GeoExt.Action({<br> text: "Dibuja polígono",<br> control: new OpenLayers.Control.DrawFeature(<br> <font style="" color="#FF0000">vector</font>, OpenLayers.Handler.Polygon<br> ),<br> map: map,<br> // button options<br> toggleGroup: "draw",<br> allowDepress: true,<br> tooltip: "draw polygon",<br> // check item options<br> group: "draw"<br> });<br> actions["draw_poly"] = action;<br> toolbarItems.push(action);<br> toolbarItems.push("-");<br> <br> <br><br><br><u>Export function:<br></u><br><br> var button2 = new Ext.Button({<br> text: 'Guardar dibujo',<br> enableToggle: false,<br> handler: <br> <br> function ()<br> //alert ('probando')<br> <br> {<br> GeoExt.ux.data.Export.KMLExport(map,[<font style="" color="#FF0000">vector</font>], null);<br> }<br> <br> }); <br><br><br><br>Thanks for your help<br><br>Nacho B<br><br><br><div><div id="SkyDrivePlaceholder"></div><hr id="stopSpelling">Date: Wed, 21 Nov 2012 08:49:24 -0500<br>From: adube@mapgears.com<br>To: users@geoext.org<br>Subject: Re: [Users] how to include a download button for downloadind a vector layer with lines/pol draw by user<br><br>
<div class="ecxmoz-cite-prefix">Hi,<br>
<br>
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 :<br>
<br>
<a class="ecxmoz-txt-link-freetext" href="http://dev.geoext.org/geoext/sandbox/redlining/ux/FeatureEditing/examples/ControlerOnlyExample.html" target="_blank">http://dev.geoext.org/geoext/sandbox/redlining/ux/FeatureEditing/examples/ControlerOnlyExample.html</a><br>
<br>
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 :<br>
<br>
<a class="ecxmoz-txt-link-freetext" href="http://dev.geoext.org/geoext/sandbox/redlining/ux_externals/layermanager/ux/data/Export.js" target="_blank">http://dev.geoext.org/geoext/sandbox/redlining/ux_externals/layermanager/ux/data/Export.js</a><br>
<br>
Feel free to use any portion of this widget.<br>
<br>
HTH,<br>
<br>
Alexandre<br>
<br>
<br>
On 12-11-21 03:19 AM, nacho barandalla wrote:<br>
</div>
<blockquote cite="mid:SNT107-W6CBDF0013D6E8027F60CDBE540@phx.gbl">
<style><!--
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Tahoma;}
--></style>
<div dir="ltr">
Hi everyone,<br>
<br>
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.)<br>
<br>
My question is how to include a download button for downloadind
a vector layer with lines/pol draw by user. explain:<br>
<br>
I have a map developed with geoext with several functions. <br>
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!<br>
The idea is to create a json layer and browse to save it in
local user pc....<br>
<br>
Some help or idea please?<br>
<br>
Thanks a lot<br>
<br>
<br>
My code is:<br>
<br>
<br>
var vector = new OpenLayers.Layer.Vector("vector1");<br>
map.addLayers([vector]);<br>
<br>
var ctrl, toolbarItems = [], action, actions = {};<br>
action = new GeoExt.Action({<br>
text: "Dibuja polígono",<br>
control: new OpenLayers.Control.DrawFeature(<br>
vector, OpenLayers.Handler.Polygon<br>
),<br>
map: map,<br>
// button options<br>
toggleGroup: "draw",<br>
allowDepress: true,<br>
tooltip: "draw polygon",<br>
// check item options<br>
group: "draw"<br>
});<br>
actions["draw_poly"] = action;<br>
toolbarItems.push(action);<br>
<br>
<br>
Thank again!<br>
<br>
</div>
<br>
<fieldset class="ecxmimeAttachmentHeader"></fieldset>
<br>
<pre>_______________________________________________
Users mailing list
<a class="ecxmoz-txt-link-abbreviated" href="mailto:Users@geoext.org">Users@geoext.org</a>
<a class="ecxmoz-txt-link-freetext" href="http://www.geoext.org/cgi-bin/mailman/listinfo/users" target="_blank">http://www.geoext.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
<br>
<pre class="ecxmoz-signature">--
Alexandre Dubé
Mapgears
<a class="ecxmoz-txt-link-abbreviated" href="http://www.mapgears.com" target="_blank">www.mapgears.com</a>
</pre>
<br>_______________________________________________
Users mailing list
Users@geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users</div>                                            </div></body>
</html>