[OpenLayers-Users] I'm stupid?

David Martinez Morata damarmo at gmail.com
Tue Jul 1 09:30:03 EDT 2008

OK, I think I start to understad.

I modify my code like this (with spherical mercatro proyection in
googlelayer, were I think it's ok)
And change the code of EPSG code for my layer.
Now my code it's:

        <script type="text/javascript">

        // make map available for easy debugging
        var map;

        // avoid pink tiles
        OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
        OpenLayers.Util.onImageLoadErrorColor = "transparent";

        function init(){
            var options = {numZoomLevels: 20,
               projection: new OpenLayers.Projection("EPSG:900913"),
               displayProjection: new OpenLayers.Projection("EPSG:4326")};

              // Create a map Object
            map = new OpenLayers.Map('map', options);

            // Create Google Mercator layers
            var gmap = new OpenLayers.Layer.Google("Google Streets",{type:
G_NORMAL_MAP,"sphericalMercator": true});
            var gsat = new OpenLayers.Layer.Google("Google Satellite",{type:
G_SATELLITE_MAP,"sphericalMercator": true});
            var ghyb = new OpenLayers.Layer.Google("Google Hybrid",{type:
G_HYBRID_MAP,"sphericalMercator": true});
            var gphy = new OpenLayers.Layer.Google("Google Physical",{type:
//                Create a WFS Sites Layer
               var sites = new OpenLayers.Layer.WFS( "Sites",
               {typename: "Sites",maxfeatures: 100 },{
               featureClass: OpenLayers.Feature.WFS

           map.addLayer(new OpenLayers.Layer.GML("GML",
            {format: OpenLayers.Format.GML,
            formatOptions: {
                extractStyles: true,
              extractAttributes: true},
              projection: new OpenLayers.Projection("EPSG:4326")}

            map.addControl(new OpenLayers.Control.LayerSwitcher());
            map.addControl(new OpenLayers.Control.ScaleLine);
            map.addControl(new OpenLayers.Control.MousePosition());
           if (!map.getCenter()) {map.zoomToMaxExtent()}

    function changezoom(x,y,z)
    map.setCenter(new OpenLayers.LonLat(x, y), z);
    function showAddress(address) {
       var geocoder = new GClientGeocoder();
     if (geocoder) {
         function(point) {
           if (!point) {alert(address + " not found");}
           else {map.setCenter(new

And I have new problems :S!
1 the scale or units in my gml and wfs layers are wrong. (normaly my points
an lines must be in france, and i show it in the midle of atlantic ocean, in
a very small zoom (google don't have images for this area :S)
I try to define units: "m" and units:"dd". But that don't works.

The answer for gml layer gives the correct lat lon wgs84 coordinates for
lines, but I dont show it :S

Thanks for your patient and your help!

2008/6/26 Eric Lemoine <eric.c2c at gmail.com>:

> On Thu, Jun 26, 2008 at 4:48 PM, Christopher Schmidt
> <crschmidt at metacarta.com> wrote:
> > On Thu, Jun 26, 2008 at 03:20:45PM +0200, David Martinez Morata wrote:
> >> Hy list, I start With OL " dais ago :S and I don't know javascript :SS!!
> >> But I start to developing some simple application... And at the first
> time
> >> was easy to  start (copy paste the code)...
> >> But now I have some problems with a gml layer, and I have the impression
> tha
> >> OL it's not more stable (maybe because I don't know javascript)...
> >> It's my 5 or 6 email to the list asking for a the same question. Problem
> >> with GML layer pan, they change the coordinates?!!!
> >> I start to play with projections and now the problem it's bigger.
> >> When I change the base layer... the map changes too!!!
> >
> > You didn't follow the instructions previously given to you in email,
> > of moving the spherical mercator option into the correct place in your
> > GOogle Layer init. Until you do this, you will continue to have
> > problems.
> The same comment applies to the options passed to the GML object
> constructor - the 'projection' option must be in the same same object
> as the 'format' and 'formatOptions' options. Moreover, you certainly
> want to use EPSG:4326 rather than EPSG:4623!
> Regards,
> --
> Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080701/d1021e7d/attachment.html

More information about the Users mailing list