banniere

Le portail francophone de la géomatique


Toujours pas inscrit ? Mot de passe oublié ?
Nom d'utilisateur    Mot de passe              Toujours pas inscrit ?   Mot de passe oublié ?

Annonce

Pour sécuriser votre compte sur les forums du GeoRezo, nous demandons de changer votre mot de passe.

Vous allez recevoir un message pour effectuer ce changement de mot de passe.

Merci de bien respecter les règles préconisées.

#1 Tue 13 January 2015 17:19

geobrie
Participant actif
Date d'inscription: 31 Jan 2010
Messages: 120

Petite correction merci reprojection pour un affichage sur google map

Bonjour,

J'ai encore et encore besoin de votre aide car malgré les multiples sujets qui traitent de ce problème, je n'arrive pas a faire apparaitre mes différentes couches. Je pensais avoir fait les choses dans les règles. Avant de vouloir insérer une couche google et de tenter une re projection tout fonctionnait :

Code:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="http://dev.openlayers.org/theme/default/style.css" type="text/css">
<link rel="stylesheet" href="http://dev.openlayers.org/examples/style.css" type="text/css">
<title>Domaine de Bonchamp</title>
<style type="text/css">
            html, body, #map {
                margin: 0;
                width: 100%;
                height: 100%;
            }

            #text {
                position: absolute;
                bottom: 1em;
                left: 1em;
                width: 512px;
                z-index: 20000;
                background-color: white;
                padding: 0 0.5em 0.5em 0.5em;
            }
        </style>

<script src="http://dev.openlayers.org/OpenLayers.js";></script>
<script type="text/javascript"> 
 
 var map, layer;       
function init(){

                var bounds = new OpenLayers.Bounds(574066,2394000,574945,2395073); //Extent en L93
                var proj_spherMerc = new OpenLayers.Projection("EPSG:900913"); //Proj Google map
                var proj_L93 = new OpenLayers.Projection("EPSG:2154");
                bounds.transform(proj_L93, proj_spherMerc); //Extent transformé en Spherical Mercator                
                var options = { 
                projection: proj_spherMerc,
                units: "m",                    
                maxExtent: bounds,     
                 
            };

map = new OpenLayers.Map('map', options);

var vlayer = new OpenLayers.Layer.Vector( "Editable",{isBaseLayer: true, visibility: true} );

var gmap = new OpenLayers.Layer.Google("Google Streets", {visibility: false, projection: proj_spherMerc});

var carte1 = new OpenLayers.Layer.WMS("carte1","http://site.web.net/cgi-bin/mapserv?map=/home/site/www/site/htdocs/propriete.map&",


                       { projection: proj_L93,                       
                        layers: 'carte1',
                        transparent: true,
                        format:'image/png',
                        },
                        {isBaseLayer: false, visibility: true}

                    );        
                
                

var carte2 = new OpenLayers.Layer.WMS("carte2","http://site.web.net/cgi-bin/mapserv?map=/home/site/www/site/htdocs/propriete.map&",


                       { projection: proj_L93,                       
                        layers: 'carte2',
                        transparent: true,
                        format:'image/png',
                        },
                        {isBaseLayer: false, visibility: true}

                    );                
            
                    
                    map.addLayers([gmap, carte2]);
                    map.addControl(new OpenLayers.Control.LayerSwitcher());    
                    map.addControl(new OpenLayers.Control.EditingToolbar(vlayer));                    
                    map.zoomToMaxExtent();
}


</script>
</head>
<body onload="init()">
    <h1 id="title">CARTE</h1>
    <div id="map"></div>    
  </body>
</html>

Merci

Hors ligne

 

#2 Thu 15 January 2015 16:37

geobrie
Participant actif
Date d'inscription: 31 Jan 2010
Messages: 120

Re: Petite correction merci reprojection pour un affichage sur google map

Bonjour,

J'ai vramenti besoin d'un petit peu d'aide malgré les exemples multiples sur internet et notamment ce post : http://georezo.net/forum/viewtopic.php?id=89056, je n'ai toujours pas trouvé la solution pour projeter ma couche WFS 2154 en 900913 afin de superposer avec une couche google. Y a-t-il des choses que j'ai pu oublier.

Code:

MAP
  NAME "couche_map" 
  IMAGETYPE PNG24
  EXTENT 220727 6197820 222617 6199558
  
  SIZE 1000 1000
  UNITS meters  
  IMAGECOLOR 255 255 255
  IMAGEQUALITY 95

  FONTSET './fonts.txt'
  SYMBOLSET './symbols.txt'  
  
    WEB  
      IMAGEPATH "/home/web/www/site/htdocs/tmp/"
      IMAGEURL '../tmp/'

      # WMS server settings
        METADATA
          'wms_title'           "propriete"
          'wms_onlineresource'  "http://web/cgi-bin/mapserv?map=/home/site/www/site/htdocs/propriete.map&"
          'wms_srs'             "EPSG:900913 EPSG:2154" 
         
         'wfs_title'           "propriete"
         'wfs_onlineresource'  "http://web/cgi-bin/mapserv?map=/home/site/www/site/htdocs/propriete.map&"
         'wfs_srs'             "EPSG:900913 EPSG:2154"
         
        END###### Fin de METADATA ######   
    END###### Fin de WEB######
    
    PROJECTION
      "init=epsg:2154"
    END###### Fin de PROJECTION ###### 

    
###### Layer 1 #######################
  LAYER
    NAME propriete
    STATUS ON
    TYPE POLYGON    
    DUMP TRUE
    CONNECTIONTYPE postgis
    CONNECTION "dbname='base' host=web.com port=5432 user='user' password='pass' sslmode=disable"
    DATA "the_geom from propriete"    
                METADATA
                ### WMS 
                "wms_title"    "couche" 
                ### WFS 
                "wfs_title"    "couche" 
                "gml_featureid" "gid" 
                "gml_include_items" "all"
            END   
  END

Code:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="http://dev.openlayers.org/theme/default/style.css" type="text/css">
<link rel="stylesheet" href="http://dev.openlayers.org/examples/style.css" type="text/css">

<script src="http://dev.openlayers.org/OpenLayers.js";></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3.6&sensor=false"></script>
<script type="text/javascript" src="./proj4js-1.1.0/proj4js/lib/proj4js-combined.js"></script>
<script type="text/javascript"> 

function init(){

                var bounds = new OpenLayers.Bounds(220727,6197820,222617,6199558);            
                var options = {                
                projection: 'EPSG:900913',
                displayProjection : new OpenLayers.Projection("EPSG:2154"),
                hover: false,                
                units: "m",                    
                maxExtent: bounds,
                allOverlays: true,
            };
map = new OpenLayers.Map('map', options);

var coucheGMaps = new OpenLayers.Layer.Google('Google Streets',{type:google.maps.MapTypeId.ROADMAP, 'maxExtent': new OpenLayers.Bounds(220727,6197820,222617,6199558)});

var couche = new OpenLayers.Layer.WFS("couche","http://web/cgi-bin/mapserv?map=/home/site/www/site/htdocs/propriete.map&",
                       { typename: "couche"},{isBaseLayer: false, extractAttributes: true,
                       styleMap: new OpenLayers.StyleMap({
                       strokeColor: "green",
                       projection : new OpenLayers.Projection("EPSG:900913"),
                       fillColor : "black",
                       strokeWidth: 2,
                       strokeOpacity: 1,
                       fillOpacity: 0,})
                       });        
                       
                    map.addLayers([coucheGMaps, couche]);
                    map.addControl(new OpenLayers.Control.LayerSwitcher());    
                    map.addControl(new OpenLayers.Control.EditingToolbar(vlayer));                    
                    map.zoomToMaxExtent();

MERCI

Hors ligne

 

#3 Thu 22 January 2015 08:52

geobrie
Participant actif
Date d'inscription: 31 Jan 2010
Messages: 120

Re: Petite correction merci reprojection pour un affichage sur google map

Bonjour,

Auriez-vous une petite piste svp.

Un grand merci pour votre aide

Hors ligne

 

Pied de page des forums

Powered by FluxBB