creating a map using EPSG 31370 leads to the following JS error: "TypeError: this.resolutions is undefined"

Approach:

I defined myself an additional projection EPSG 31370 with following projection definition:
+proj=lcc +lat_1=51.16666723333333 +lat_2=49.8333339 +lat_0=90 +lon_0=4.367486666666666 +x_0=150000.013 +y_0=5400088.438 +ellps=intl +towgs84=106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1 +units=m +no_defs

I also completed the projected bounds info in this tab.

Next I defined a WMS layer based on a AGIV WMS service = http://wms.agiv.be/inspire/wms/administratieve_eenheden?

then I tried to configure a map where map and display projection are EPSG 31370. Unfortunately I don't succeed in visualising the map in the Openlayers UI. I tried to define my layer as a baselayer and overlay layer, and I have even added more layers of the same service, still the map is not working.

However, when I configure my WMS layer in another EPSG e.g. the google one, I can perfectly add the WMS service on top of google maps based on the 3857 map and display projection. That works perfect. So it seems a projection issue in the Openlayers UI.

CommentFileSizeAuthor
#6 drupalsettings.txt14.4 KBdtirry
#4 layer1.txt2.17 KBdtirry
#4 layer2.txt2.18 KBdtirry
#4 map.txt2.54 KBdtirry

Comments

pol’s picture

Hello Diederik,

Could you post the export of your map and layer please ?

Thanks !

dtirry’s picture

What do you exactly mean? the values of the variables?
Unfortunately, I'm not a professional debugger. Please tell me exactly what info you want.

pol’s picture

When you're in admin/structure/openlayers/layers, clic the layer 'export' link.

Same stuff for the map.

Then, post the two files as attachement, see example here: http://drupal.org/node/1958706#comment-7277194

dtirry’s picture

StatusFileSize
new2.54 KB
new2.18 KB
new2.17 KB

Here they are.

pol’s picture

Thanks, could you also post the Drupal.settings JSON from the page source:

jQuery.extend(Drupal.settings, {})

I will pass it through jsbeautifier.org to read it.

dtirry’s picture

StatusFileSize
new14.4 KB

Here you are.
FYI, I downloaded the openlayers library to have it local.

Diederik

pol’s picture

Thanks.

I tried to reproduce it locally without success, the map is blank and Chrome return a JS error:

TypeError: Cannot call method 'getCenterLonLat' of null in openlayers.js:455

augustus.kling’s picture

Thanks a lot for this report.

Due to a change that was mistaking one variable for the other the projection's boundaries have been ignored. The problem should be gone with commit 0c32f4fe07c97eac49fbce3d88dc55688f97c92c and your layer1 displayed fine for me.

I left the if of commit ca7161275a62ccece00efa7cb7f9a4cec90f1aa9 even though I don't understand why it's needed. The maxExtent gets set in openlayers_build_map for all map configurations so maxExtent is guaranteed to be sensibly set. Is there anything I'm overlooking like the possibility to render maps without calling openlayers_build_map?

pol’s picture

Hi all,

Due to a change that was mistaking one variable for the other the projection's boundaries have been ignored. The problem should be gone with commit 0c32f4fe07c97eac49fbce3d88dc55688f97c92c and your layer1 displayed fine for me.

Sorry for that, it's my bad, thanks Augustus for spotting it.

I left the if of commit ca7161275a62ccece00efa7cb7f9a4cec90f1aa9 even though I don't understand why it's needed. The maxExtent gets set in openlayers_build_map for all map configurations so maxExtent is guaranteed to be sensibly set. Is there anything I'm overlooking like the possibility to render maps without calling openlayers_build_map?

The link is about a change on the WMTS layer, not on the map, are you sure this is the good commit ? (there's a small typo in your link, remove the 2 at the end!)
Anyway, to reply to your question, you're perfectly right, as usual.

This is the part who fill in the maxExtent property:

  // Restrict map to its projection extent (data outwith cannot be represented).
  // Layer can additionally specfiy their maxExtent in case they use
  // non-default grids.
  $projection = openlayers_get_projection_by_identifier($map['projection']);
  $map['maxExtent'] = $projection->getProjectedExtent();

And this part cannot be overidden by the user, because openlayers_build_map() will always be called, so, there's no need to add a check. I just removed it.

@Diederik, would you test and report to use if everything's ok ?

@Augustus, many thanks again!

augustus.kling’s picture

Sorry, I copied the wrong commit. The second link should have pointed to 745409a4205726712a5dc26c74297c792da1e9d0 but you figured out what I meant nevertheless.

pol’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.