Hi all,

I'm using a geoserver to display open layer data through a WMS service and it works correctly with the projection 4326 but apparently everybody is using 900913 for background tiles (google, mapbox, etc..). So I've reprojected all my GIS points in my PostGIS database to 900913, i've added them to the Geoserver, check that the Layer Preview works:

http://gis.domain.org:8080/geoserver/wms?service=WMS&version=1.1.0&reque...

and then created a new Map with the OpenLayers Drupal module and added the newly created layers with 900913. The problem is that the layer is not showing up while the map with the 4326 projection layers and identical configuration works perfectly.

I've looked for logs but the web server is not giving useful information, with the previous version i would see something like:

TYPE openlayers
DATE Wednesday, January 9, 2013 - 11:43
USER admin
LOCATION http://dev.domain.org/admin/structure/openlayers/maps/my_map2/edit
REFERRER http://dev.domain.org/admin/structure/openlayers/maps
MESSAGE Layer my_map2 not found.
SEVERITY error

but since i've updated to the 7.x-2.0-beta3 nothing shows up anymore.

When i define the BaseURL layer i'm using: http://gis.domain.org:8080/geoserver/wms?service=WMS&version=1.1.0&reque... since it was the URL that was working with the 4326 projection.

If i mark the layer as not transparent i will see that the base layer gets hidden and the map becomes blank.

Do you have any suggestions? how can i find more OpenLayers logs? Code points works too!
Thanks!!!

Alex

Comments

AlexanderKocisky’s picture

Priority: Normal » Major
AlexanderKocisky’s picture

Status: Active » Needs work
AlexanderKocisky’s picture

if I publish the layer as a KML file with the correct URL from the geoserver the issue is still present

AlexanderKocisky’s picture

it seems open layer is actually fetching the WMS png files but in the wrong bound box, this is a correct link directly from geoserver: http://gis.site.org:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=MyMap:my_layer&styles=&bbox=0.0,0.0,99.067,97.183&width=512&height=502&srs=EPSG:900913&format=application/openlayers

this one is the wrong one from open layer:

http://gis.site.org:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=MyMap:my_layer&SRS=EPSG%3A900913&TRANSPARENT=true&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fpng&STYLES=&BBOX=10958012.372201,4383204.948401,11271098.440001,4696291.016201&WIDTH=256&HEIGHT=256

if i change the bound box parameter to the same of the geoserver it fetches something, it seems its just looking in the wrong place, any ideas? where is the logic of the bbox parameter?

thanks

g_f’s picture

If i mark the layer as not transparent i will see that the base layer gets hidden and the map becomes blank.

So you are recieving your image, but it seems to be displayed at a wrong place. You could implement a single point with a huge size, so you'd be able to see where the point is displayed - that gives you a hint in which coordinate system the map is shown.

Did you check the display projection? Maybe you are generating wrong bounding box parameter because of you're using a different coordinate system to display your data. Try Map Projection 900913 and Display projection 4326.

AlexanderKocisky’s picture

Hi g_f, thats actually my setting ( Map Projection 900913 and Display projection 4326). With the same data projected in the postgis db as 4326 and setting the map to 4326 projection it works. The same with 900913 gets wrong bbox parameter. Here is the map created by the module:

The map: openlayers-map-cf0776af options are: {
    "projection": {
        "projCode": "EPSG:900913"
    },
    "displayProjection": {
        "projCode": "EPSG:4326"
    },
    "maxExtent": {
        "left": -20037508.34,
        "bottom": -20037508.34,
        "right": 20037508.34,
        "top": 20037508.34
    },
    "units": "m",
    "sphericalMercator": true,
    "maxResolution": "auto",
    "controls": [],
    "theme": "/sites/all/modules/openlayers/themes/default_dark/style.css"
}

These are the layer added to the map

The layer is {
    "my_wms_layer": {
        "base_url": "http://gis.site.org:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=MyMap:my_layer",
        "params": {
            "isBaseLayer": 0,
            "buffer": 2,
            "ratio": 1.5,
            "singleTile": 0,
            "sphericalMercator": 1,
            "resolutions": [
                156543.0339,
                78271.51695,
                39135.758475,
                19567.8792375,
                9783.93961875,
                4891.969809375,
                2445.9849046875,
                1222.9924523438,
                611.49622617188,
                305.74811308594,
                152.87405654297,
                76.437028271484,
                38.218514135742,
                19.109257067871,
                9.5546285339355,
                4.7773142669678,
                2.3886571334839,
                1.1943285667419,
                0.59716428337097
            ],
            "projection": {
                "projCode": "EPSG:900913"
            },
            "maxextent": [
                -20037508,
                -20037508,
                20037508,
                20037508
            ],
            "drupalID": "my_wms_layer",
            "units": "m",
            "maxExtent": {
                "left": -20037508.34,
                "bottom": -20037508.34,
                "right": 20037508.34,
                "top": 20037508.34
            }
        ...rname": "world-bright",
        "layer_type": "openlayers_layer_type_mapbox",
        "osm": false,
        "baselayer": true,
        "type": "png",
        "resolutions": [
            156543.0339,
            78271.51695,
            39135.758475,
            19567.8792375,
            9783.93961875,
            4891.969809375,
            2445.9849046875,
            1222.9924523438,
            611.49622617188,
            305.74811308594,
            152.87405654297,
            76.437028271484
        ],
        "projection": {
            "projCode": "EPSG:900913"
        },
        "serverResolutions": [
            156543.0339,
            78271.51695,
            39135.758475,
            19567.8792375,
            9783.93961875,
            4891.969809375,
            2445.9849046875,
            1222.9924523438,
            611.49622617188,
            305.74811308594,
            152.87405654297,
            76.437028271484,
            38.218514135742,
            19.109257067871,
            9.5546285339355,
            4.7773142669678,
            2.3886571334839,
            1.1943285667419,
            0.59716428337097
        ],
        "maxExtent": {
            "left": -20037508,
            "bottom": -20037508,
            "right": 20037508,
            "top": 20037508
        },
        "layer_handler": "MapBox",
        "title": "MapBox World Bright",
        "weight": 0,
        "drupalID": "mapbox_world_bright",
        "isBaseLayer": true
    }
}

i've dumped the objects with:

alert("The map: "+map.id+" options are: "+JSON.stringify(options, null, 4));

any ideas?

AlexanderKocisky’s picture

Since the bbox parameter of the 900913 layer is not correct i was wondering which would be the openlayers parameters that would influence that behavior, any ideas?

this is the code generated on the client side:

"openlayers" : {
            "maps" : {
              "openlayers-map-7c9332dd" : {
                "width" : "auto",
                "height" : "400px",
                "image_path" : "sites\/all\/modules\/openlayers\/themes\/default_dark\/img\/",
                "css_path" : "sites\/all\/modules\/openlayers\/themes\/default_dark\/style.css",
                "proxy_host" : "",
                "hide_empty_map" : 0,
                "center" : {
                  "initial" : {
                    "centerpoint" : "88.06640475567313, 31.240984900499544",
                    "zoom" : "6"
                  },
                  "restrict" : {
                    "restrictextent" : 0,
                    "restrictedExtent" : ""
                  }
                },
                "behaviors" : {
                  "openlayers_behavior_attribution" : {
                    "seperator" : ""
                  },
                  "openlayers_behavior_keyboarddefaults" : {
                    "keyboarddefaults" : ""
                  },
                  "openlayers_behavior_layerswitcher" : {
                    "ascending" : 1,
                    "sortBaseLayer" : "0",
                    "roundedCorner" : 1,
                    "roundedCornerColor" : "#222222",
                    "maximizeDefault" : 0,
                    "layerswitcher" : ""
                  },
                  "openlayers_behavior_navigation" : {
                    "zoomWheelEnabled" : 1,
                    "zoomBoxEnabled" : 1,
                    "documentDrag" : 0,
                    "navigation" : ""
                  },
                  "openlayers_behavior_panzoombar" : {
                    "zoomWorldIcon" : 0,
                    "panIcons" : 1
                  }
                },
                "default_layer" : "mapbox_world_bright",
                "layers" : {
                  "my_layer_vms" : {
                    "base_url" : "http:\/\/gis.site.org:8080\/geoserver\/wms?service=WMS\u0026version=1.1.0\u0026request=GetMap\u0026layers=myMap:my_village_layer",
                    "params" : {
                      "isBaseLayer" : 0,
                      "buffer" : "2",
                      "ratio" : "1.5",
                      "singleTile" : 0,
                      "sphericalMercator" : 1,
                      "resolutions" : [ 156543.0339,
                          78271.51695, 39135.758475,
                          19567.8792375,
                          9783.93961875,
                          4891.969809375,
                          2445.9849046875,
                          1222.9924523438,
                          611.49622617188,
                          305.74811308594,
                          152.87405654297,
                          76.437028271484,
                          38.218514135742,
                          19.109257067871,
                          9.5546285339355,
                          4.7773142669678,
                          2.3886571334839,
                          1.1943285667419,
                          0.59716428337097 ],
                      "projection" : "EPSG:900913",
                      "maxextent" : [ -20037508,
                          -20037508, 20037508,
                          20037508 ]
                    },
                    "options" : {
                      "srs" : "EPSG:900913",
                      "TRANSPARENT" : "true",
                      "exceptions" : "application\/vnd.ogc.se_inimage",
                      "format" : "image\/png",
                      "layers" : "",
                      "styles" : ""
                    },
                    "layer_type" : "openlayers_layer_type_wms",
                    "layer_handler" : "wms",
                    "baselayer" : 0,
                    "projection" : [ "900913" ],
                    "title" : "my_layer_vms",
                    "weight" : 0
                  },
                  "google_normal" : {
                    "type" : "normal",
                    "layer_type" : "openlayers_layer_type_google",
                    "numZoomLevels" : "15",
                    "serverResolutions" : [ 156543.0339,
                        78271.51695, 39135.758475,
                        19567.8792375, 9783.93961875,
                        4891.969809375,
                        2445.9849046875,
                        1222.9924523438,
                        611.49622617188,
                        305.74811308594,
                        152.87405654297,
                        76.437028271484,
                        38.218514135742,
                        19.109257067871,
                        9.5546285339355,
                        4.7773142669678,
                        2.3886571334839,
                        1.1943285667419,
                        0.59716428337097 ],
                    "maxExtent" : [ -20037508, -20037508,
                        20037508, 20037508 ],
                    "projection" : [ "900913" ],
                    "layer_handler" : "google",
                    "baselayer" : true,
                    "animationEnabled" : true,
                    "title" : "Google Maps for my Map",
                    "weight" : 0
                  },
                  "mapbox_world_bright" : {
                    "urls" : [
                        "http:\/\/a.tiles.mapbox.com\/mapbox\/",
                        "http:\/\/b.tiles.mapbox.com\/mapbox\/",
                        "http:\/\/c.tiles.mapbox.com\/mapbox\/",
                        "http:\/\/d.tiles.mapbox.com\/mapbox\/" ],
                    "layername" : "world-bright",
                    "layer_type" : "openlayers_layer_type_mapbox",
                    "osm" : false,
                    "baselayer" : true,
                    "type" : "png",
                    "resolutions" : [ 156543.0339,
                        78271.51695, 39135.758475,
                        19567.8792375, 9783.93961875,
                        4891.969809375,
                        2445.9849046875,
                        1222.9924523438,
                        611.49622617188,
                        305.74811308594,
                        152.87405654297,
                        76.437028271484 ],
                    "projection" : [ "900913" ],
                    "serverResolutions" : [ 156543.0339,
                        78271.51695, 39135.758475,
                        19567.8792375, 9783.93961875,
                        4891.969809375,
                        2445.9849046875,
                        1222.9924523438,
                        611.49622617188,
                        305.74811308594,
                        152.87405654297,
                        76.437028271484,
                        38.218514135742,
                        19.109257067871,
                        9.5546285339355,
                        4.7773142669678,
                        2.3886571334839,
                        1.1943285667419,
                        0.59716428337097 ],
                    "maxExtent" : [ -20037508, -20037508,
                        20037508, 20037508 ],
                    "layer_handler" : "MapBox",
                    "title" : "MapBox World Bright",
                    "weight" : 0
                  }
                },
                "layer_weight" : {
                  "custom_map_overlay_openlayers_1" : "0",
                  "openlayers_example_data_overlay_openlayers_1" : "0",
                  "openlayers_geojson_picture_this" : "0",
                  "geofield_formatter" : "0",
                  "my_layer_vms" : "0",
                  "my_village_layer" : "0"
                },
                "layer_styles" : {
                  "my_village_layer" : "0",
                  "my_layer_vms" : "0",
                  "geofield_formatter" : "0",
                  "openlayers_geojson_picture_this" : "0",
                  "custom_map_overlay_openlayers_1" : "0",
                  "openlayers_example_data_overlay_openlayers_1" : "0"
                },
                "layer_styles_select" : {
                  "my_village_layer" : "0",
                  "my_layer_vms" : "0",
                  "geofield_formatter" : "0",
                  "openlayers_geojson_picture_this" : "0",
                  "custom_map_overlay_openlayers_1" : "0",
                  "openlayers_example_data_overlay_openlayers_1" : "0"
                },
                "layer_activated" : {
                  "my_village_layer" : 0,
                  "my_layer_vms" : 0,
                  "geofield_formatter" : 0,
                  "openlayers_geojson_picture_this" : 0,
                  "custom_map_overlay_openlayers_1" : 0,
                  "openlayers_example_data_overlay_openlayers_1" : 0
                },
                "layer_switcher" : {
                  "my_layer_vms" : "my_layer_vms",
                  "my_village_layer" : 0,
                  "geofield_formatter" : 0,
                  "openlayers_geojson_picture_this" : 0,
                  "custom_map_overlay_openlayers_1" : 0,
                  "openlayers_example_data_overlay_openlayers_1" : 0
                },
                "projection" : "900913",
                "displayProjection" : "4326",
                "styles" : {
                  "default" : {
                    "pointRadius" : "6",
                    "fillColor" : "#888888",
                    "strokeColor" : "#222222",
                    "strokeWidth" : "4",
                    "fillOpacity" : "0.5",
                    "strokeOpacity" : "0.7"
                  },
                  "select" : {
                    "pointRadius" : "6",
                    "fillColor" : "#222222",
                    "strokeColor" : "#888888",
                    "strokeWidth" : "4",
                    "fillOpacity" : "0.7",
                    "strokeOpacity" : "0.8"
                  },
                  "temporary" : {
                    "pointRadius" : "6",
                    "fillColor" : "#888888",
                    "strokeColor" : "#222222",
                    "strokeWidth" : "4",
                    "fillOpacity" : "0.5",
                    "strokeOpacity" : "0.7"
                  }
                },
                "map_name" : "my_map_900913_2",
                "id" : "openlayers-map-7c9332dd",
                "errors" : false
              }
            }
          }
pol’s picture

Status: Needs work » Active

Hello,

What is the bbox parameters in these texts you copied ?

liam morland’s picture

Issue tags: -openlayers geoserver wms 900913 4326 postgis +postgis