Richard LEHAUT | 2 Nov 2010 09:14
Picon

Re: OpenLayers.Format.GML.write with EPSG:2154

hi
I used your method, and the result is not the same.
Initial polygon is :  POLYGON((432572.220787942 6895705.136637988,433765.0966490602 6869252.816629886,465149.8306762447 6870052.155533891,463599.2580596882 6895802.363928256,432572.220787942 6895705.136637988))

GetFeature with méthod GET is ok
http://ws.carmen.developpement-durable.gouv.fr/WFS/8/nature?&VERSION=1.0.0&SERVICE=WFS&REQUEST=GetFeature&TYPENAME=ZNIEFF_de_type_1&FILTER=%3CFilter%3E%3CIntersect%3E%3CPropertyName%3EGeometry%3C/PropertyName%3E%3Cgml:Polygon%3E%3Cgml:outerBoundaryIs%3E%3Cgml:LinearRing%3E%3Cgml:coordinates%3E432572.220787942,6895705.136637988%20433765.0966490602,6869252.816629886%20465149.8306762447,6870052.155533891%20463599.2580596882,6895802.363928256%20432572.220787942,6895705.136637988%3C/gml:coordinates%3E%3C/gml:LinearRing%3E%3C/gml:outerBoundaryIs%3E%3C/gml:Polygon%3E%3C/Intersect%3E%3C/Filter%3E

GetFeature with method post => fichier test_curl.php
is missing. Where is the problem?

Thans for you help

Richard LEHAUT Tiolebucheron

2010/10/31 Eric Lemoine <eric.lemoine <at> camptocamp.com>
On Sat, Oct 30, 2010 at 10:47 AM, Richard LEHAUT
> I can try.
>
> The coordonnee initials sont en 25572 :
> POLYGON((439405.54831656 2501480.5328861,511724.95370852
> 2478197.2121257,515605.50716858 2489133.3173313,441874.9914275
> 2510652.7501553,439405.54831656 2501480.5328861))
>
> When, i transform projection in 2154 with function geometry.transform(), i
> get :
> POLYGON((579935.0307896 11379308.343843013,652279.391024183
> 11354700.957354637,656364.0020029543 11365633.978103733,582568.3536138271
> 11388492.710118398,579935.0307896 11379308.343843013,579935.0307896
> 11379308.343843013)) . It's correct. When i used the fonction fomats.write
> ()  491432.98817530926,6936119.019221687,44.53511819243431
> 563513.9567961813,6912250.991385791,43.90459069609642
> 567483.0224642601,6923147.889697679,43.85644343402237
> 493976.663637052,6945265.1890874775,44.50042778160423
> 491432.98817530926,6936119.019221687,44.53511819243431.
>
> The coordinates of each point individually are false. Why?

I don't get the same results as you.

>>> proj27572 = new OpenLayers.Projection("EPSG:27572");
>>> proj2154 = new OpenLayers.Projection("EPSG:2154");
>>> polygon27572 = OpenLayers.Geometry.fromWKT("POLYGON((439405.54831656 2501480.5328861,511724.95370852 2478197.2121257,515605.50716858 2489133.3173313,441874.9914275 2510652.7501553,439405.54831656 2501480.5328861))");

>>> polygon2154 = polygon27572.clone();
>>> polygon2154.transform(proj27572, proj2154);
>>> polygon2154.toString()
"POLYGON((491432.9881753047 6936119.019221775,563513.9567961755
6912250.991385875,567483.0224642548
6923147.889697764,493976.66363704775
6945265.189087565,491432.9881753047 6936119.019221775))"

>>> format = new OpenLayers.Format.GML.v2({internalProjection: proj27572, externalProjection: proj2154});
>>> format.write(new OpenLayers.Feature.Vector(polygon27572));
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><gml:null><gml:geometry><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates
decimal="." cs="," ts="
">491432.9881753047,6936119.019221775,44.53511819243431
563513.9567961755,6912250.991385875,43.90459069143981
567483.0224642548,6923147.889697764,43.85644343588501
493976.66363704775,6945265.189087565,44.50042778160423
491432.9881753047,6936119.019221775,44.53511819243431</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:geometry></gml:null></gml:featureMember>"


So the results make sense in my case.

--
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine <at> camptocamp.com
http://www.camptocamp.com
_______________________________________________
Users mailing list
Users-qjLDD68F18NyQMAyxoHuMA@public.gmane.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Attachment (test_curl.php): application/octet-stream, 2007 bytes
_______________________________________________
Users mailing list
Users@...
http://lists.osgeo.org/mailman/listinfo/openlayers-users
Moataz Elmasry | 2 Nov 2010 10:17

Re: GetFeature of WFS Layer with EPSG:4326 with osm base layer EPSG:900913 doesn't work

What does the request in firebug looks like when you click the feature?

if you don't define it explicitly, the map will be displayed in 900913 
(proj of base layer)
I think you need to explicitly define in the map configuration both the 
projection and display projection
for example:

config = {
           projection : new OpenLayers.Projection("EPSG:900913"),
           displayProjection: new OpenLayers.Projection("EPSG:4326"),
           units : "m",
           numZoomLevels : 18,
           maxResolution : "auto",
           maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
                   20037508.34, 20037508.34)

       };

This maxExtent is for the world
This way you force the map to be displayed in 4326 projection. Because 
otherwise you click a point say in Germany and is transformed to another 
point in Argentina :) , or not at all on the map

Good luck
Moataz

stash wrote:
> Hi,
>
> I'm not sure, if you understand, what I wrote in in the subject. My problem
> is the following situation:
>
> I have an osm base Layer:
>
>  map_2.addLayer(new OpenLayers.Layer.OSM("OpenStreetMap Karte"));
>
> my next layer is a wfs layer with epsg-code:4326
>
> on this layer i can call a getfeature to get some information of the
> features displayed in the map.
>
> the problem is now, that the getfeature doesn't work. Nothing happens, when
> i click on a feature on the map.
>
> I'm sure that my code is right, because when i use another layer with the
> same epsg code than the wfs (4326) as my first layer (base layer) then, the
> getfeature works.
>
> but this base layer is a bit boring, so i wanted to include the osm layer.
>
> I don't know what I'm doing wrong, however I have a guess.
>
> The osm layer is using another epsg code than my wfs layer (osmLayer
> epsgcode:900913).
> Because of that, it could be, that my wfs getfeature doesn't work. The
> results of the wfs are displayed correctly, that is not the problem, but the
> getfeature on the results don't work, when i use the osm layer as base
> layer.
>
> I hope you understand my problem.
>
> Thanks for your help.
>
> Best Regards
>   
trigoesrodrigo | 2 Nov 2010 10:56
Picon

Keep zoom & location between layer changes


Hi.

I have a map with two layers in different projections (OSM & EPSG:4236)

When I change the layer through the layer switcher control, the map changes
but it doesn't stay centered in the same point and zoom level.

This is the function I wrote to reset the center of the map.

function onchangelayer(e) {
    if (e.layer.name != previousLayer.name && e.layer.projection.getCode()
!= previousLayer.projection.getCode()) {
        var newCenter = map.getCenter().transform(previousLayer.projection,
e.layer.projection);						
        map.setCenter(newCenter);
    }
    previousLayer= map.baseLayer;
}

Sometimes, after the layer change, the new layer is not shown or can't be
panned.

I have two questions:
 - Which is the correct way to preserve the map center after a layer change?
 - How to keep the zoom level as close as possible to the previous zoom
level?

Regards,
Rodrigo.
--

-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Keep-zoom-location-between-layer-changes-tp5696461p5696461.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
Richard LEHAUT | 2 Nov 2010 13:43
Picon

Re: OpenLayers.Format.GML.write with EPSG:2154

HI
I resolved my problem

If I use OpenLayers.Format.GML and not OpenLayers.Format.GML.v2. I will get only the coordinates XY.

Thank you every body for your help

Richard LEHAUT Tiolebucheron

2010/11/2 Richard LEHAUT <richard.lehaut-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
hi
I used your method, and the result is not the same.
Initial polygon is :  POLYGON((432572.220787942 6895705.136637988,433765.0966490602 6869252.816629886,465149.8306762447 6870052.155533891,463599.2580596882 6895802.363928256,432572.220787942 6895705.136637988))

GetFeature with méthod GET is ok
http://ws.carmen.developpement-durable.gouv.fr/WFS/8/nature?&VERSION=1.0.0&SERVICE=WFS&REQUEST=GetFeature&TYPENAME=ZNIEFF_de_type_1&FILTER=%3CFilter%3E%3CIntersect%3E%3CPropertyName%3EGeometry%3C/PropertyName%3E%3Cgml:Polygon%3E%3Cgml:outerBoundaryIs%3E%3Cgml:LinearRing%3E%3Cgml:coordinates%3E432572.220787942,6895705.136637988%20433765.0966490602,6869252.816629886%20465149.8306762447,6870052.155533891%20463599.2580596882,6895802.363928256%20432572.220787942,6895705.136637988%3C/gml:coordinates%3E%3C/gml:LinearRing%3E%3C/gml:outerBoundaryIs%3E%3C/gml:Polygon%3E%3C/Intersect%3E%3C/Filter%3E

GetFeature with method post => fichier test_curl.php
is missing. Where is the problem?

Thans for you help

Richard LEHAUT Tiolebucheron

2010/10/31 Eric Lemoine <eric.lemoine-vRqkqqOcNB5PC9TT5Vdp3Q@public.gmane.org>

On Sat, Oct 30, 2010 at 10:47 AM, Richard LEHAUT
> I can try.
>
> The coordonnee initials sont en 25572 :
> POLYGON((439405.54831656 2501480.5328861,511724.95370852
> 2478197.2121257,515605.50716858 2489133.3173313,441874.9914275
> 2510652.7501553,439405.54831656 2501480.5328861))
>
> When, i transform projection in 2154 with function geometry.transform(), i
> get :
> POLYGON((579935.0307896 11379308.343843013,652279.391024183
> 11354700.957354637,656364.0020029543 11365633.978103733,582568.3536138271
> 11388492.710118398,579935.0307896 11379308.343843013,579935.0307896
> 11379308.343843013)) . It's correct. When i used the fonction fomats.write
> ()  491432.98817530926,6936119.019221687,44.53511819243431
> 563513.9567961813,6912250.991385791,43.90459069609642
> 567483.0224642601,6923147.889697679,43.85644343402237
> 493976.663637052,6945265.1890874775,44.50042778160423
> 491432.98817530926,6936119.019221687,44.53511819243431.
>
> The coordinates of each point individually are false. Why?

I don't get the same results as you.

>>> proj27572 = new OpenLayers.Projection("EPSG:27572");
>>> proj2154 = new OpenLayers.Projection("EPSG:2154");
>>> polygon27572 = OpenLayers.Geometry.fromWKT("POLYGON((439405.54831656 2501480.5328861,511724.95370852 2478197.2121257,515605.50716858 2489133.3173313,441874.9914275 2510652.7501553,439405.54831656 2501480.5328861))");

>>> polygon2154 = polygon27572.clone();
>>> polygon2154.transform(proj27572, proj2154);
>>> polygon2154.toString()
"POLYGON((491432.9881753047 6936119.019221775,563513.9567961755
6912250.991385875,567483.0224642548
6923147.889697764,493976.66363704775
6945265.189087565,491432.9881753047 6936119.019221775))"

>>> format = new OpenLayers.Format.GML.v2({internalProjection: proj27572, externalProjection: proj2154});
>>> format.write(new OpenLayers.Feature.Vector(polygon27572));
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><gml:null><gml:geometry><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates
decimal="." cs="," ts="
">491432.9881753047,6936119.019221775,44.53511819243431
563513.9567961755,6912250.991385875,43.90459069143981
567483.0224642548,6923147.889697764,43.85644343588501
493976.66363704775,6945265.189087565,44.50042778160423
491432.9881753047,6936119.019221775,44.53511819243431</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:geometry></gml:null></gml:featureMember>"


So the results make sense in my case.

--
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine-vRqkqqOcNB5PC9TT5Vdp3Q@public.gmane.org
http://www.camptocamp.com
_______________________________________________
Users mailing list
Users-qjLDD68F18NQ/50SGhhxiw@public.gmane.orgo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users


_______________________________________________
Users mailing list
Users@...
http://lists.osgeo.org/mailman/listinfo/openlayers-users
stash | 2 Nov 2010 15:21

Re: GetFeature of WFS Layer with EPSG:4326 with osm base layer EPSG:900913 doesn't work


Hello,

thanks for your answer. My firebug tells me nothing, the getfeature code
doesn't even start. 

I already have defined my map with projection and displayprojection. The
problem is, when i define as projection 900913 and for displayprojection
4326 I see no wfs layer and only the osm layer. I changed it into projection
4326 and displayprojection 4326 and then I get my wfs layer and my osm layer
(displayed in lat/lon) but the getfeature doesn't work.

Do you have any idea.

Thanks for your help.

Best Regards 
--

-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/GetFeature-of-WFS-Layer-with-EPSG-4326-with-osm-base-layer-EPSG-900913-doesn-t-work-tp5689706p5697592.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
Moataz Elmasry | 2 Nov 2010 15:48

Re: Re: GetFeature of WFS Layer with EPSG:4326 with osm base layer EPSG:900913 doesn't work

Then maybe you can try to override the map projection with the layer 
projection, as follows:

var map = new OpenLayers.Map({
    projection : "EPSG:900913",
    displayProjection : "EPSG:4326"
})

var wfs = new OpenLayers.Layer.WFs({
    projection : "EPSG:4326"
})

this way the osm layer should be displayed correctly, and at the same 
time ol will not try to translate your wfs from 900913 to 4326

stash wrote:
> Hello,
>
> thanks for your answer. My firebug tells me nothing, the getfeature code
> doesn't even start. 
>
> I already have defined my map with projection and displayprojection. The
> problem is, when i define as projection 900913 and for displayprojection
> 4326 I see no wfs layer and only the osm layer. I changed it into projection
> 4326 and displayprojection 4326 and then I get my wfs layer and my osm layer
> (displayed in lat/lon) but the getfeature doesn't work.
>
> Do you have any idea.
>
> Thanks for your help.
>
> Best Regards 
>   
stash | 2 Nov 2010 16:17

Re: GetFeature of WFS Layer with EPSG:4326 with osm base layer EPSG:900913 doesn't work


Hello,
thanks for your answer. I tried what you explained and now my wfs is shown
on the map with projection 900913 and displayprojection 4326. The bad news
are, that my wfs getfeature request still doesn't work.

Here is my code for the getfeature request:

var control = new OpenLayers.Control.GetFeature
    ({
        protocol: OpenLayers.Protocol.WFS
({
    url: "http://.../geoserver/wfs",
    featureType: "my_shape",
    featurePrefix: 'topp',
    featureNS: "http://www.openplans.org/topp",
    geometryName: 'the_geom',
    maxFeatures: 100
})
    });

I tried to add the projection parameter in this block too, but it didn't
change anything.

Do you have any other idea.

Thanks.

Best Regards
--

-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/GetFeature-of-WFS-Layer-with-EPSG-4326-with-osm-base-layer-EPSG-900913-doesn-t-work-tp5689706p5697860.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
Ian Turton | 2 Nov 2010 16:33
Picon
Gravatar

Re: Re: GetFeature of WFS Layer with EPSG:4326 with osm base layer EPSG:900913 doesn't work

On Tue, Nov 2, 2010 at 11:17 AM, stash <steffen.schwarz85@...> wrote:
>
> Hello,
> thanks for your answer. I tried what you explained and now my wfs is shown
> on the map with projection 900913 and displayprojection 4326. The bad news
> are, that my wfs getfeature request still doesn't work.

Could you not change the WFS request to 1.1.0 and then it can use
900913 as the request projection? That would seem to be the simplest
solution.

Ian
--

-- 
Ian Turton
stash | 2 Nov 2010 16:42

Re: GetFeature of WFS Layer with EPSG:4326 with osm base layer EPSG:900913 doesn't work


Hello,

thanks for the answer. I have already tried the solution you mentioned. I
set up a layer in geoserver with 900913 projection for my wfs and included
it in my openlayers app. The wfs is shown on the map but the wfs getfeature
still doesn't work.

Unfortunately, it didn't help.

Do you have any more ideas?

Best Regards
--

-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/GetFeature-of-WFS-Layer-with-EPSG-4326-with-osm-base-layer-EPSG-900913-doesn-t-work-tp5689706p5697966.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
Ian Turton | 2 Nov 2010 16:45
Picon
Gravatar

Re: Re: GetFeature of WFS Layer with EPSG:4326 with osm base layer EPSG:900913 doesn't work

On Tue, Nov 2, 2010 at 11:42 AM, stash <steffen.schwarz85@...> wrote:
>
> Hello,
>
> thanks for the answer. I have already tried the solution you mentioned. I
> set up a layer in geoserver with 900913 projection for my wfs and included
> it in my openlayers app. The wfs is shown on the map but the wfs getfeature
> still doesn't work.

Sounds like there is a deeper problem with your code which has nothing
to do with projections then. Maybe you need to post a link to your
page or attach some code so we can see what is going on.

Ian

Gmane