[OpenLayers-Users] GeoJSON layer and modifyFeature control

Adorian Ardelean mynature at gmail.com
Thu Dec 4 07:41:36 EST 2008


Dear Jan,

I have tried to declare the control also as in your example. It did not work
either.
In the meantime, I have localized the problem although I do not have a
solution to it yet.

Turns out that if I remove style declaration the modify tool works.

With this the modifyFeature does not work:
var regions = new OpenLayers.Layer.Vector("regions",{extractAttributes:true,
format: OpenLayers.Format.GeoJSON, projection: new
OpenLayers.Projection("EPSG:4326"), styleMap: new
OpenLayers.StyleMap(mystyle)});

With this it works
var regions = new OpenLayers.Layer.Vector("regions",{extractAttributes:true,
format: OpenLayers.Format.GeoJSON, projection: new
OpenLayers.Projection("EPSG:4326")});

However, the style is quite necessary because depending on properties
(attributes) I store in GeoJSON array, I have rules to change style of
features when rendered. It seems that this interferes somehow with the
select style of modifyFeature controlo. Or...

Hopefully, I will find a solution to keep them both. Otherwise, is there a
way to migrate features from one vector layer to another?

All the best,
Adorian





On Thu, Dec 4, 2008 at 12:25 PM, Jan van der Ven <j.vanderven at magion.nl>wrote:

>  Dear Adorian,
>
>
> This is the code I have to activate a modifyFeature on a geojson layer. I
> have a lot of those, so I activate it on a layer by name:
>
>       modifyControl = new
> OpenLayers.Control.ModifyFeature(map.getLayersByName(stateNames[modifyControlIndex])[0]);
>       map.addControl(modifyControl);
>       modifyControl.activate();
>
> Hope this helps.
>
> Kind regards,
>
> Jan
>
>
>  ------------------------------
> *From:* Adorian Ardelean [mailto:mynature at gmail.com]
> *Sent:* Thursday, December 04, 2008 10:17
> *To:* j.vanderven at magion.nl
> *Cc:* users at openlayers.org
> *Subject:* Re: [OpenLayers-Users] GeoJSON layer and modifyFeature control
>
> Hi Jan,
>
> In test case, it does not work even if I have only one layer and one
> modifyFeature control (no other selectFeature and modifyFeature controls).
>
> In real application case, I switch (one-at-a-time)  among controls using an
> external form and multiple selection controls work on the two distinct
> layers (let say I have several selectFeature controls to get feature infos
> in various layers). Only the modifyFeature on the GeoJSON layer does not
> work.
>
> All the best,
> Adorian
>
>
> On Thu, Dec 4, 2008 at 9:54 AM, Jan van der Ven <j.vanderven at magion.nl>wrote:
>
>>  Hi,
>>
>>
>> Only one select control can be active at the same time. Selections are
>> made in the layer that is on top of the Z-order.
>>
>> Kind regards,
>>
>> Jan
>>
>>
>>  ------------------------------
>> *From:* users-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
>> *On Behalf Of *Adorian Ardelean
>> *Sent:* Thursday, December 04, 2008 09:47
>> *To:* users at openlayers.org
>> *Subject:* [OpenLayers-Users] GeoJSON layer and modifyFeature control
>>
>>   Hi,
>>
>> I have a very simple question: is it possible to modify features in a
>> layer populated from a GeoJSON file? I am asking just about modifying
>> feature on map without the saving part.
>> I did add the modifyFeature control, but I cannot select and modify any of
>> the polygons in this layer ( var regions = new
>> OpenLayers.Layer.Vector("regions",{extractAttributes:true, format:
>> OpenLayers.Format.GeoJSON, projection: new
>> OpenLayers.Projection("EPSG:4326"), styleMap: new
>> OpenLayers.StyleMap(mystyle)});)
>> Another modifyFeature control works OK on a second vector layer (var
>> vectors = new OpenLayers.Layer.Vector("vectors");).
>>
>> All the best,
>> Adorian
>>
>> --
>> Dr. Adorian Ardelean
>> coordinator of myNature Project
>>
>> http://mybiosis.info/nature/portal.php?pagename=firstpage [a Romanian
>> biodiversity-database]
>> http://mybiosis.info/nature/portal.php?pagename=adorian [CV]
>>
>> No virus found in this incoming message.
>> Checked by AVG - http://www.avg.com
>> Version: 8.0.176 / Virus Database: 270.9.12/1824 - Release Date: 2-12-2008
>> 9:31
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>>
>
>
> --
> Dr. Adorian Ardelean
> coordinator of myNature Project
>
> http://mybiosis.info/nature/portal.php?pagename=firstpage [a Romanian
> biodiversity-database]
> http://mybiosis.info/nature/portal.php?pagename=adorian [CV]
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com
> Version: 8.0.176 / Virus Database: 270.9.12/1824 - Release Date: 2-12-2008
> 9:31
>



-- 
Dr. Adorian Ardelean
coordinator of myNature Project

http://mybiosis.info/nature/portal.php?pagename=firstpage [a Romanian
biodiversity-database]
http://mybiosis.info/nature/portal.php?pagename=adorian [CV]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081204/cd77abaf/attachment.html


More information about the Users mailing list