[OpenLayers-Dev] saving a vector file permanently

David Zwarg dzwarg+ol at azavea.com
Fri Jan 21 09:36:04 EST 2011


Hello Mohammed,

The attributes will be saved along with the geometry when using the formats
to serialize the features.

As a side note: these questions may be better suited for the
openlayers-users list.

-z

On Fri, Jan 21, 2011 at 9:24 AM, Mohammed Rashad <mohammedrashadkm at gmail.com
> wrote:

> thanks David,
> I mean something like you said. Also please tell me how can I edit and save
> attributes too
>
>
> On Fri, Jan 21, 2011 at 7:47 PM, David Zwarg <dzwarg+ol at azavea.com<dzwarg%2Bol at azavea.com>
> > wrote:
>
>> Hello Mohammed,
>>
>> Look at the OpenLayers.Format classes.
>>
>> Here's a link to the geojson format example:
>> http://dev.openlayers.org/apidocs/files/OpenLayers/Format/GeoJSON-js.html
>>
>> You will probably do something like:
>>
>> var format = new OpenLayers.Format.GeoJSON();
>>
>> // given that 'layer' is a vector layer attached to the map with some
>> features:
>> var jsonstring = format.write( layer.features );
>>
>> // given that 'txtarea' is an HTML textarea element somewhere in your page
>> to display the geojson:
>> txtarea.value = jsonstring;
>>
>> There's no way to save the file directly via openlayers (opening a "Save
>> File..." dialog), you have to do some copy & pasting from the browser.
>>
>> -z
>>
>> On Fri, Jan 21, 2011 at 8:51 AM, Mohammed Rashad <
>> mohammedrashadkm at gmail.com> wrote:
>>
>>> How can I save a OpenLayers.Layer.Vector to a gml, geojson or any
>>> openlayer supported formats without using
>>>  WFS or WFS- T( without geoserver,postgis);
>>>
>>> Is it possible?
>>>
>>> --
>>> Rashad
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> Dev at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/openlayers-dev
>>>
>>>
>>
>
>
> --
> Rashad
>
> _______________________________________________
> Dev mailing list
> Dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20110121/a73fcad7/attachment.html


More information about the Dev mailing list