IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

IGN API Géoportail Discussion :

Ajout couche WFS-T


Sujet :

IGN API Géoportail

  1. #21
    Nouveau membre du Club
    Inscrit en
    Mai 2010
    Messages
    73
    Détails du profil
    Informations forums :
    Inscription : Mai 2010
    Messages : 73
    Points : 33
    Points
    33
    Par défaut
    Citation Envoyé par mga_geo Voir le message
    J'ai mis en ligne le code avec quelques ajouts ...
    Peux-tu nous indiquer comment tu crées la couche dans postgis et GeoServer ?
    Dans postgis c'est une couche polygone en EPSG:4326, géométries dans le champ 'geom'

    sous geoserver, namespace 'postgis',
    SRC natif : EPSG:4326
    SRC des données : EPSG:4326
    Gestion des SRC : laisser en natif

    dis moi si tu as besoin de plus d'infos...

    Merci

  2. #22
    Membre chevronné
    Profil pro
    Inscrit en
    Mai 2009
    Messages
    2 124
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2009
    Messages : 2 124
    Points : 1 764
    Points
    1 764
    Par défaut
    Je viens de trouver en recherche Google, un lien http://tinyows.org/trac/wiki/OpenLay...oTransactional, sur une solution en OpenLayers 2.9.
    Il doit être possible de s'en inspirer!?

  3. #23
    Nouveau membre du Club
    Inscrit en
    Mai 2010
    Messages
    73
    Détails du profil
    Informations forums :
    Inscription : Mai 2010
    Messages : 73
    Points : 33
    Points
    33
    Par défaut
    Citation Envoyé par mga_geo Voir le message
    Je viens de trouver en recherche Google, un lien http://tinyows.org/trac/wiki/OpenLay...oTransactional, sur une solution en OpenLayers 2.9.
    Il doit être possible de s'en inspirer!?
    Merci mga_deo pour cette info, j'en avais entendu parler. A priori le mode WFS-T fonctionne bien maintenant c'est plus un problème de projection à l'affichage ...

    Est-ce que quelqu'un a réussi a faire prendre en compte le dernier patch ...?

  4. #24
    Membre chevronné
    Profil pro
    Inscrit en
    Mai 2009
    Messages
    2 124
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2009
    Messages : 2 124
    Points : 1 764
    Points
    1 764
    Par défaut
    J'en suis toujours au stade d'essayer de faire fonctionner en local ta page.
    Mais la ligne
    featureNS : "http://192.168.3.85:8080/postgis",
    pose problème à mon Tomcat!
    Mon code SQL de création de la base:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    DROP TABLE IF EXISTS my_table CASCADE;
    CREATE TABLE my_table (
      id SERIAL PRIMARY KEY, 
      name VARCHAR,
      geom GEOMETRY
    );
    INSERT INTO my_table (id,name,geom) VALUES (1,'NW',ST_GeomFromText('POINT(-1.506647 48.131193)',4326));
    INSERT INTO my_table (id,name,geom) VALUES (2,'SW',ST_GeomFromText('POINT(-1.505991 48.122211)',4326));
    INSERT INTO my_table (id,name,geom) VALUES (3,'NE',ST_GeomFromText('POINT(-1.493231 48.131631)',4326));
    INSERT INTO my_table (id,name,geom) VALUES (4,'SE',ST_GeomFromText('POINT(-1.492576 48.122650)',4326));
    SELECT name, 
    cast(x(geom) as decimal(10,6)) as lon,
    cast(y(geom) as decimal(10,6)) as lat
    FROM my_table;

  5. #25
    Nouveau membre du Club
    Inscrit en
    Mai 2010
    Messages
    73
    Détails du profil
    Informations forums :
    Inscription : Mai 2010
    Messages : 73
    Points : 33
    Points
    33
    Par défaut
    Mon cript de création de table (tel qu'affiché par postgis)

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    -- Table: poly4326
    
    -- DROP TABLE poly4326;
    
    CREATE TABLE poly4326
    (
      id integer NOT NULL,
      texte text,
      geom geometry,
      CONSTRAINT poly4326_pkey PRIMARY KEY (id),
      CONSTRAINT enforce_dims_geom CHECK (st_ndims(geom) = 2),
      CONSTRAINT enforce_geotype_geom CHECK (geometrytype(geom) = 'POLYGON'::text OR geom IS NULL),
      CONSTRAINT enforce_srid_geom CHECK (st_srid(geom) = 4326)
    )
    WITH (
      OIDS=FALSE
    );
    ALTER TABLE poly4326 OWNER TO postgres;
    GRANT ALL ON TABLE poly4326 TO postgres;
    GRANT ALL ON TABLE poly4326 TO public;
    Par contre chez moi l'api tourne sous apache et non pas tomcat...

  6. #26
    Membre chevronné
    Profil pro
    Inscrit en
    Mai 2009
    Messages
    2 124
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2009
    Messages : 2 124
    Points : 1 764
    Points
    1 764
    Par défaut
    Mon apache tourne sur le port 80 et sert les pages html, js, ... de l'API.
    Sur le port 8080, j'ai Tomcat qui lance geoserver.
    Je n'ai pas choisi la version "standalone" de GeoServer ayant déjà un Tomcat actif.

    Dans ton apache, comment as-tu défini les entrées pour geoserver et postgis ?

  7. #27
    Nouveau membre du Club
    Inscrit en
    Mai 2010
    Messages
    73
    Détails du profil
    Informations forums :
    Inscription : Mai 2010
    Messages : 73
    Points : 33
    Points
    33
    Par défaut
    Citation Envoyé par mga_geo Voir le message
    Mon apache tourne sur le port 80 et sert les pages html, js, ... de l'API.
    Sur le port 8080, j'ai Tomcat qui lance geoserver.
    Je n'ai pas choisi la version "standalone" de GeoServer ayant déjà un Tomcat actif.
    ok on a donc quasiment la même config, sauf que moi j'ai laisser geoserver installer tomcat...

    Citation Envoyé par mga_geo Voir le message
    Dans ton apache, comment as-tu défini les entrées pour geoserver et postgis ?
    euh ...? je n'ai pas eu a toucher à la config d'apache pour ça ...
    Je fais passer l'api par un proxy pour aller interroger le serveur tomcat mais c'est tout...

  8. #28
    Membre chevronné
    Profil pro
    Inscrit en
    Mai 2009
    Messages
    2 124
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2009
    Messages : 2 124
    Points : 1 764
    Points
    1 764
    Par défaut
    Si tu as pris la version "standalone" de geoserver, tu ne tournes pas Tomcat!
    GeoServer utilise le serveur d'application Jetty.
    Quand tu fais un essai, tu dois avoir un GET dans la console Firebug, pour l'adresse ""http://192.168.3.85:8080/postgis"" via le proxy.
    Peux-tu donner la réponse ?

    NB: pour savoir qui écoute sous Windows:
    netstat -anb

  9. #29
    Nouveau membre du Club
    Inscrit en
    Mai 2010
    Messages
    73
    Détails du profil
    Informations forums :
    Inscription : Mai 2010
    Messages : 73
    Points : 33
    Points
    33
    Par défaut
    A priori c'est postgres.exe qui écoute 0.0.0.0:8080...
    j'sais pas pourquoi j'étais resté sur tomcat...

    Voici la requête/réponse du GET :

    l'affichage est centré sur la France FXX, pourtant on voit bien les coord en 0.000... , 0.000...

    Requête :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><wfs:Query typeName="postgis:poly4326" xmlns:postgis="http://192.168.3.85:8080/postgis"><ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:BBOX><ogc:PropertyName>geom</ogc:PropertyName><gml:Box xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326"><gml:coordinates decimal="." cs="," ts=" ">-0.0003487141766973531,0.0003139240171870351 0.000514190490865172,0.0005069564894413836</gml:coordinates></gml:Box></ogc:BBOX></ogc:Filter></wfs:Query></wfs:GetFeature>
    Réponse :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <?xml version="1.0" encoding="UTF-8"?><wfs:FeatureCollection xmlns="http://www.opengis.net/wfs" xmlns:wfs="http://www.opengis.net/wfs" xmlns:postgis="http://192.168.3.85:8080/postgis" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://192.168.3.85:8080/postgis http://192.168.3.85:8080/geoserver/wfs?service=WFS&amp;version=1.0.0&amp;request=DescribeFeatureType&amp;typeName=postgis%3Apoly4326 http://www.opengis.net/wfs http://192.168.3.85:8080/geoserver/schemas/wfs/1.0.0/WFS-basic.xsd"><gml:boundedBy><gml:null>unknown</gml:null></gml:boundedBy><gml:featureMember><postgis:poly4326 fid="poly4326.7"><postgis:texte/><postgis:geom><gml:Polygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts=" ">0.00003391,0.00041573 0.00000252,0.00039771 0.00003565,0.0003873 0.00005379,0.0004035 0.00003391,0.00041573</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></postgis:geom></postgis:poly4326></gml:featureMember><gml:featureMember><postgis:poly4326 fid="poly4326.8"><postgis:texte/><postgis:geom><gml:Polygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts=" ">0.0000231,0.00043159 0.00001542,0.00041689 0.00003949,0.00041705 0.00004193,0.00042912 0.0000231,0.00043159</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></postgis:geom></postgis:poly4326></gml:featureMember><gml:featureMember><postgis:poly4326 fid="poly4326.11"><postgis:texte>996</postgis:texte><postgis:geom><gml:Polygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts=" ">-0.00000202,0.00042515 -0.00001004,0.00040961 0.00000914,0.00040862 0.00001124,0.00042581 -0.00000202,0.00042515</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></postgis:geom></postgis:poly4326></gml:featureMember><gml:featureMember><postgis:poly4326 fid="poly4326.12"><postgis:texte>55</postgis:texte><postgis:geom><gml:Polygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts=" ">0.00005867,0.00042978 0.00005937,0.00041441 0.00008378,0.00041589 0.00009669,0.0004254 0.0000803,0.00043358 0.00005867,0.00042978</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></postgis:geom></postgis:poly4326></gml:featureMember><gml:featureMember><postgis:poly4326 fid="poly4326.16"><postgis:texte>yy</postgis:texte><postgis:geom><gml:Polygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts=" ">0.00003338,0.00044796 0.00002571,0.00044184 0.00004664,0.00043672 0.00005082,0.00044035 0.00004838,0.00044597 0.00003338,0.00044796</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></postgis:geom></postgis:poly4326></gml:featureMember><gml:featureMember><postgis:poly4326 fid="poly4326.20"><postgis:texte>88</postgis:texte><postgis:geom><gml:Polygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts=" ">0.0000707,0.00044415 0.00006164,0.00043705 0.00007001,0.00043655 0.00007768,0.00043837 0.00007838,0.00044267 0.0000707,0.00044415</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></postgis:geom></postgis:poly4326></gml:featureMember><gml:featureMember><postgis:poly4326 fid="poly4326.24"><postgis:texte>44</postgis:texte><postgis:geom><gml:Polygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts=" ">0.00007105,0.00040267 0.00006164,0.00039193 0.00007873,0.00038995 0.00009093,0.0003997 0.0000878,0.00040069 0.00007105,0.00040267</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></postgis:geom></postgis:poly4326></gml:featureMember><gml:featureMember><postgis:poly4326 fid="poly4326.32"><postgis:texte>undefined</postgis:texte><postgis:geom><gml:Polygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts=" ">0.00009059,0.00044052 0.00009093,0.00043573 0.00010454,0.00043655 0.00010524,0.00043887 0.00010105,0.00043986 0.00009059,0.00044052</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></postgis:geom></postgis:poly4326></gml:featureMember></wfs:FeatureCollection>

  10. #30
    Membre chevronné
    Profil pro
    Inscrit en
    Mai 2009
    Messages
    2 124
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2009
    Messages : 2 124
    Points : 1 764
    Points
    1 764
    Par défaut
    Dans une configuration standard, on a:
    TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 2556
    [httpd.exe]
    TCP 0.0.0.0:443 0.0.0.0:0 LISTENING 2556
    [httpd.exe]
    TCP 0.0.0.0:1204 0.0.0.0:0 LISTENING 352
    [java.exe]

    TCP 0.0.0.0:5432 0.0.0.0:0 LISTENING 424
    [postgres.exe]

    TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 352
    [java.exe]

    TCP 127.0.0.1:8079 0.0.0.0:0 LISTENING 352
    [java.exe]

  11. #31
    Membre chevronné
    Profil pro
    Inscrit en
    Mai 2009
    Messages
    2 124
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2009
    Messages : 2 124
    Points : 1 764
    Points
    1 764
    Par défaut
    Lors de l'interrogation http://localhost:8080/geoserver/wfs/...=cite:my_table

    J'ai cette réponse:
    <xsd:schema elementFormDefault="qualified" targetNamespace="http://www.opengeospatial.net/cite">
    <xsd:import namespace="http://www.opengis.net/gml" schemaLocation="http://localhost:8080/geoserver/schemas/gml/3.1.1/base/gml.xsd"/>
    <xsd:complexType name="my_tableType">
    <xsd:complexContent>
    <xsd:extension base="gml:AbstractFeatureType">
    <xsd:sequence>
    <xsd:element maxOccurs="1" minOccurs="0" name="name" nillable="true" type="xsd:string"/>
    <xsd:element maxOccurs="1" minOccurs="0" name="geom" nillable="true" type="gml:GeometryPropertyType"/>
    </xsd:sequence>
    </xsd:extension>
    </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="my_table" substitutionGroup="gml:_Feature" type="cite:my_tableType"/>
    </xsd:schema>

  12. #32
    Nouveau membre du Club
    Inscrit en
    Mai 2010
    Messages
    73
    Détails du profil
    Informations forums :
    Inscription : Mai 2010
    Messages : 73
    Points : 33
    Points
    33
    Par défaut
    j'ai effectivement la même réponse que toi :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    <?xml version="1.0" encoding="UTF-8" ?> 
    - <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" xmlns:postgis="http://192.168.3.85:8080/postgis" elementFormDefault="qualified" targetNamespace="http://192.168.3.85:8080/postgis">
      <xsd:import namespace="http://www.opengis.net/gml" schemaLocation="http://localhost:8080/geoserver/schemas/gml/3.1.1/base/gml.xsd" /> 
      <xsd:import namespace="http://www.opengis.net/gml" schemaLocation="http://localhost:8080/geoserver/schemas/gml/3.1.1/base/gml.xsd" /> 
    - <xsd:complexType name="poly4326Type">
    - <xsd:complexContent>
    - <xsd:extension base="gml:AbstractFeatureType">
    - <xsd:sequence>
      <xsd:element maxOccurs="1" minOccurs="0" name="texte" nillable="true" type="xsd:string" /> 
      <xsd:element maxOccurs="1" minOccurs="0" name="geom" nillable="true" type="gml:PolygonPropertyType" /> 
      </xsd:sequence>
      </xsd:extension>
      </xsd:complexContent>
      </xsd:complexType>
      <xsd:element name="poly4326" substitutionGroup="gml:_Feature" type="postgis:poly4326Type" /> 
      </xsd:schema>
    Mais je ne vois pas trop le rapport avec mon problème ... Pour l'instant je bloque sur l'application du dernier patch de dgrichard... je n'arrive pas a ce qu'il soit pris en compte...

  13. #33
    Membre chevronné
    Profil pro
    Inscrit en
    Mai 2009
    Messages
    2 124
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2009
    Messages : 2 124
    Points : 1 764
    Points
    1 764
    Par défaut
    J'essaye toujours d'afficher des points via geoserver et je ne vois rien venir ...
    Donc avant de pouvoir les modifier, il me reste du chemin.

  14. #34
    Membre chevronné
    Profil pro
    Inscrit en
    Mai 2009
    Messages
    2 124
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2009
    Messages : 2 124
    Points : 1 764
    Points
    1 764
    Par défaut Lignes ...
    A priori, l'affichage des points n'est pas visible avec l'API, mais celui des lignes oui!
    Donc je vais pouvoir continuer ...

  15. #35
    Expert confirmé
    Homme Profil pro
    Ingénieur cartographe
    Inscrit en
    Avril 2009
    Messages
    3 173
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Ingénieur cartographe
    Secteur : Service public

    Informations forums :
    Inscription : Avril 2009
    Messages : 3 173
    Points : 4 224
    Points
    4 224
    Par défaut
    J'ai mis quelques informations ... je m'attaque au save()

    En fait, le patch du Strategy.save() ne sert à rien finalement ... L'important est vraiment que formatOptions:{(internal|external)Projection} soit affecté correctement !?

  16. #36
    Nouveau membre du Club
    Inscrit en
    Mai 2010
    Messages
    73
    Détails du profil
    Informations forums :
    Inscription : Mai 2010
    Messages : 73
    Points : 33
    Points
    33
    Par défaut
    Merci pour ces infos

    le patch save() semblait pourtant répondre a une partie du problème (envoi des coord dans le bon système) non ...?

    je vais regarder les patchs de l'autre post !

  17. #37
    Expert confirmé
    Homme Profil pro
    Ingénieur cartographe
    Inscrit en
    Avril 2009
    Messages
    3 173
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Ingénieur cartographe
    Secteur : Service public

    Informations forums :
    Inscription : Avril 2009
    Messages : 3 173
    Points : 4 224
    Points
    4 224
    Par défaut
    Citation Envoyé par Sigmax Voir le message
    le patch save() semblait pourtant répondre a une partie du problème (envoi des coord dans le bon système) non ...?
    C'est ce que j'ai cru, mais en fait (comme indiqué avec formatOptions), c'est OpenLayers.Format.WFST qui fait le boulot au final !

  18. #38
    Nouveau membre du Club
    Inscrit en
    Mai 2010
    Messages
    73
    Détails du profil
    Informations forums :
    Inscription : Mai 2010
    Messages : 73
    Points : 33
    Points
    33
    Par défaut
    Citation Envoyé par dgrichard Voir le message
    C'est ce que j'ai cru, mais en fait (comme indiqué avec formatOptions), c'est OpenLayers.Format.WFST qui fait le boulot au final !
    oki... en attendant j'ai joué l'apprenti sorcier et j'ai peut-être quelque chose qui pourra vous aider ^^

    Etant donné que la synthaxe 1 me permettait d'afficher mes objets au bon endroit et que la synthaxe 2 me permettait de les éditer j'ai tenté de "mixer" les deux... et j'ai un résultat en demi-teinte mais un résultat quand même !!

    mon code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    var couche2= VISU.getMap().addLayer(
                "WFS",
                "couche2",
                "http://192.168.3.85:8080/geoserver/wfs",
                {
                    typename: 'poly4326',
    				featureNS :  "http://192.168.3.85:8080/postgis",
    				featureType: "poly4326",
    				featurePrefix:'postgis',
    				geometryName: "geom"
                },
                {
    				strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
                    projection: 'EPSG:4326',
                    units:'degrees',
                    // maxExtent expressed in EPSG:4326 :
                    maxExtent: new OpenLayers.Bounds(-180,-90,180,90),
                    minZoomLevel:0,
                    maxZoomLevel:15,
                    hover: false,
    				protocol: new OpenLayers.Protocol.WFS({
    					version: "1.0.0",
    					srsName: "EPSG:4326",
    					url: "http://192.168.3.85:8080/geoserver/wfs",
    					featureNS :  "http://192.168.3.85:8080/postgis",
    					featureType: "poly4326",
    					featurePrefix:'postgis',
    					geometryName: "geom",
    					formatOptions:{
    						internalProjection: VISU.getMap().getProjection().clone(),
    						externalProjection: new OpenLayers.Projection('EPSG:4326')
    
    					}
    				})
               	 }
           		);
    Alors je sais vu comme ça ca n'a pas l'air propre du tout, une partie du code est dupliquée... bref possible que ca vous fasse un peu mal au yeux désolé...

    Résultat : Mes objets existant s'affichent bien au bon endroit, je peux en rajouter (au bon endroit) et en supprimer !!
    Seul bémol : je n'arrive pas à modifier leur contours... Je ne comprends pas pourquoi... quand j'essaye de les sélectionner en modification les "ronds" ne s'affichent pas...

    Est-ce que cela peut vous aider a trouver d'ou vient le problème dans la synthaxe 2 ...?

  19. #39
    Expert confirmé
    Homme Profil pro
    Ingénieur cartographe
    Inscrit en
    Avril 2009
    Messages
    3 173
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Ingénieur cartographe
    Secteur : Service public

    Informations forums :
    Inscription : Avril 2009
    Messages : 3 173
    Points : 4 224
    Points
    4 224
    Par défaut
    Citation Envoyé par Sigmax Voir le message
    Seul bémol : je n'arrive pas à modifier leur contours... Je ne comprends pas pourquoi... quand j'essaye de les sélectionner en modification les "ronds" ne s'affichent pas...

    Est-ce que cela peut vous aider a trouver d'ou vient le problème dans la synthaxe 2 ...?
    Voici le code issu de ton envoi qui fonctionne (la modification des contours est effective). Les données sont GéoFLA département stockées en Lambert 93 :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
            DeleteFeature = OpenLayers.Class(OpenLayers.Control, {
                initialize: function(layer, options) {
                    OpenLayers.Control.prototype.initialize.apply(this, [options]);
                    this.layer= layer;
                    this.handler= new OpenLayers.Handler.Feature(this, layer, {click: this.clickFeature});
                },
                clickFeature: function(feature) {
                    // if feature doesn't have a fid, destroy it
                    if  (feature.fid == undefined) {
                        this.layer.destroyFeatures([feature]);
                    } else {
                        feature.state= OpenLayers.State.DELETE;
                        this.layer.events.triggerEvent("afterfeaturemodified", {feature: feature});
                        feature.renderIntent= "select";
                        this.layer.drawFeature(feature);
                    }
                },
                setMap: function(map) {
                    this.handler.setMap(map);
                    OpenLayers.Control.prototype.setMap.apply(this, arguments);
                },
                CLASS_NAME: "OpenLayers.Control.DeleteFeature"
            });
    
            var saveStrategy= new OpenLayers.Strategy.Save();
            var vlayer= new OpenLayers.Layer.Vector('deps', {
                strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
                //projection: new OpenLayers.Projection('EPSG:4326'),//useless for vector layers as they are on-the-fly reprojected to map's projection
                protocol: new OpenLayers.Protocol.WFS({
                    version: '1.0.0',
                    srsName: 'EPSG:4326',//send BBOX filter in EPSG:4326
                    url: 'http://localhost:8080/geoserver/wfs',
                    featureNS: 'http://www.ign.fr/',
                    featureType: 'departement',
                    featurePrefix: 'ignf',
                    geometryName: 'the_geom',
                    formatOptions: {
                        internalProjection: viewer.getMap().getProjection().clone(),
                        externalProjection: new OpenLayers.Projection('EPSG:2154')//GML is in EPSG:2154 (native srs)
                    }
                })
            });
            viewer.getMap().addLayer(vlayer);
    
    /* Pour contrôler la même couche en WMS :
            viewer.getMap().addLayer(
                "WMS",
                "Départements",
                "http://localhost:8080/geoserver/wms",
                {
                    layers:'departement',
                    format:'image/png',
                    transparent:true
                },
                {
                    projection:'EPSG:4326',
                    visibility:false
                });
     */
    
            var selectCntrl= new OpenLayers.Control.SelectFeature(vlayer, {
                title: "Select Feature",
                displayClass: "olControlSelectFeature"
            });
    
            var drawCntrl= new OpenLayers.Control.DrawFeature(vlayer, OpenLayers.Handler.Polygon, {
                title: "Draw Feature",
                displayClass: "olControlDrawFeaturePolygon",
                multi: false
            });
    
            var editCntrl= new OpenLayers.Control.ModifyFeature(vlayer, {
                title: "Modify Feature",
                displayClass: "olControlModifyFeature"
            });
    
            var delCntrl= new DeleteFeature(vlayer, {
                title: "Delete Feature",
                displayClass:"gpControlDeleteFeature"
            });
    
            var saveCntrl= new OpenLayers.Control.Button({
                title: "Save Changes",
                trigger: function() {
                    saveStrategy.save();
                },
                displayClass: "olControlSaveFeatures"
            });
    
            var panelCntrl= new OpenLayers.Control.Panel({
                displayClass: "customEditingToolbar"
            });
            panelCntrl.addControls([selectCntrl, drawCntrl, editCntrl, delCntrl, saveCntrl]);
            viewer.getMap().addControl(panelCntrl);
    
            viewer.getMap().setCenterAtLonLat(6.50, 45.833333, 10);
        }
    J'ai retouché les styles pour voir la barre d'édition :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
        <style type="text/css">
        <!--
        .customEditingToolbar {
            left:250px;
            width:120px;
            background-color:#336699;
        }
        .olControlSaveFeaturesItemInactive {
            float:left;
            width:23px;
            height:23px;
        }
        .olControlSaveFeaturesItemActive {
            float:left;
            width:23px;
            height:23px;
        }
          -->
        </style>

  20. #40
    Nouveau membre du Club
    Inscrit en
    Mai 2010
    Messages
    73
    Détails du profil
    Informations forums :
    Inscription : Mai 2010
    Messages : 73
    Points : 33
    Points
    33
    Par défaut
    Citation Envoyé par dgrichard Voir le message
    Voici le code issu de ton envoi qui fonctionne (la modification des contours est effective). Les données sont GéoFLA département stockées en Lambert 93 :
    Bonjour,

    Merci pour ce nouveau code !
    Je me suis re-créer un projet tout propre pour tester et j'ai du oublier quelque chose par ce que j'ai toujours un message d'erreur ...

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    <?xml version="1.0" ?>
    <ServiceExceptionReport
       version="1.2.0"
       xmlns="http://www.opengis.net/ogc"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd">
       <ServiceException>
          java.lang.RuntimeException: Could not decode srs &apos;IGNF:GEOPORTALFXX&apos;
    Could not decode srs &apos;IGNF:GEOPORTALFXX&apos;
    Le type &quot;IGNF&quot; n&apos;est pas reconnu dans ce contexte.
    Le type &quot;IGNF&quot; n&apos;est pas reconnu dans ce contexte.
    </ServiceException></ServiceExceptionReport>
    Il me semble qu'on avait déjà vu ce message et sa cause mais je ne retrouve pas la solution ...

    Mon code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    		
    	function initGeoportalMap() {
    	
    		
    		geoportalLoadVISU("GeoportalVisuDiv", "normal","FXX","IGNF:GEOPORTALFXX");
    		VISU.getMap().setProxyUrl("/cgi-bin/proxy.cgi?url=");
          // On charge les couches de données définies dans le contrat
    		if (VISU.getMap().allowedGeoportalLayers) {
    			VISU.addGeoportalLayer('GEOGRAPHICALGRIDSYSTEMS.MAPS:WMSC',{opacity:1});
    			VISU.addGeoportalLayer('ORTHOIMAGERY.ORTHOPHOTOS:WMSC',{visibility:false});
    			VISU.addGeoportalLayer('CADASTRALPARCELS.PARCELS:WMSC', {'CADASTRALPARCELS.PARCELS':{minZoomLevel:17,maxZoomLevel:18,opacity:1}});
    		}
    
    		DeleteFeature = OpenLayers.Class(OpenLayers.Control, {
                initialize: function(layer, options) {
                    OpenLayers.Control.prototype.initialize.apply(this, [options]);
                    this.layer= layer;
                    this.handler= new OpenLayers.Handler.Feature(this, layer, {click: this.clickFeature});
                },
                clickFeature: function(feature) {
                    // if feature doesn't have a fid, destroy it
                    if  (feature.fid == undefined) {
                        this.layer.destroyFeatures([feature]);
                    } else {
                        feature.state= OpenLayers.State.DELETE;
                        this.layer.events.triggerEvent("afterfeaturemodified", {feature: feature});
                        feature.renderIntent= "select";
                        this.layer.drawFeature(feature);
                    }
                },
                setMap: function(map) {
                    this.handler.setMap(map);
                    OpenLayers.Control.prototype.setMap.apply(this, arguments);
                },
                CLASS_NAME: "OpenLayers.Control.DeleteFeature"
            });
    
            var saveStrategy= new OpenLayers.Strategy.Save();
            var vlayer= new OpenLayers.Layer.Vector('poly2154', {
                strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
                //projection: new OpenLayers.Projection('EPSG:4326'),//useless for vector layers as they are on-the-fly reprojected to map's projection
                protocol: new OpenLayers.Protocol.WFS({
                    version: '1.0.0',
                    srsName: 'EPSG:4326',//send BBOX filter in EPSG:4326
                    url: 'http://192.168.3.85:8080/geoserver/wfs',
                    featureNS: 'http://192.168.3.85:8080/postgis',
                    featureType: 'poly2154',
                    featurePrefix: 'postgis',
                    geometryName: 'geom',
                    formatOptions: {
                        internalProjection: VISU.getMap().getProjection().clone(),
                        externalProjection: new OpenLayers.Projection('EPSG:2154')//GML is in EPSG:2154 (native srs)
                    }
                })
            });
           VISU.getMap().addLayer(vlayer);
    
    /* Pour contrôler la même couche en WMS :
            VISU.getMap().addLayer(
                "WMS",
                "Départements",
                "http://localhost:8080/geoserver/wms",
                {
                    layers:'departement',
                    format:'image/png',
                    transparent:true
                },
                {
                    projection:'EPSG:4326',
                    visibility:false
                });
     */
    
            var selectCntrl= new OpenLayers.Control.SelectFeature(vlayer, {
                title: "Select Feature",
                displayClass: "olControlSelectFeature"
            });
    
            var drawCntrl= new OpenLayers.Control.DrawFeature(vlayer, OpenLayers.Handler.Polygon, {
                title: "Draw Feature",
                displayClass: "olControlDrawFeaturePolygon",
                multi: false
            });
    
            var editCntrl= new OpenLayers.Control.ModifyFeature(vlayer, {
                title: "Modify Feature",
                displayClass: "olControlModifyFeature"
            });
    
            var delCntrl= new DeleteFeature(vlayer, {
                title: "Delete Feature",
                displayClass:"gpControlDeleteFeature"
            });
    
            var saveCntrl= new OpenLayers.Control.Button({
                title: "Save Changes",
                trigger: function() {
                    saveStrategy.save();
                },
                displayClass: "olControlSaveFeatures"
            });
    
            var panelCntrl= new OpenLayers.Control.Panel({
                displayClass: "customEditingToolbar"
            });
            panelCntrl.addControls([selectCntrl, drawCntrl, editCntrl, delCntrl, saveCntrl]);
            VISU.getMap().addControl(panelCntrl);
    
            VISU.getMap().setCenterAtLonLat(6.50, 45.833333, 10);
        }
    EDIT : à priori je suis revenu au point de départ ... http://www.developpez.net/forums/d92...t/#post5244778

    Faut-il ajouter les patchs précédents au dernier code ?

+ Répondre à la discussion
Cette discussion est résolue.
Page 2 sur 3 PremièrePremière 123 DernièreDernière

Discussions similaires

  1. Ajout de couche wfs (BD Carthage)
    Par flobel69 dans le forum IGN API Géoportail
    Réponses: 1
    Dernier message: 16/09/2012, 15h22
  2. Ajout de couche WFS (BD Carthage)
    Par flobel69 dans le forum IGN API Géoportail
    Réponses: 2
    Dernier message: 31/08/2012, 16h23
  3. Ajout couche wfs
    Par Mic75 dans le forum IGN API Géoportail
    Réponses: 3
    Dernier message: 23/08/2012, 15h32
  4. Ajout couche wfs/wms
    Par celem dans le forum IGN API Géoportail
    Réponses: 5
    Dernier message: 01/06/2010, 08h14
  5. intégration couches WFS
    Par EmilieDB dans le forum IGN API Géoportail
    Réponses: 3
    Dernier message: 15/05/2009, 17h18

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo