Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsupported layer className OpenLayers.Layer.Vector #408

Closed
jirik opened this issue Jul 9, 2021 · 2 comments · Fixed by #410
Closed

Unsupported layer className OpenLayers.Layer.Vector #408

jirik opened this issue Jul 9, 2021 · 2 comments · Fixed by #410
Labels
bug Something isn't working
Milestone

Comments

@jirik
Copy link
Member

jirik commented Jul 9, 2021

[2021-07-01 07:34:41,670: WARNING/ForkPoolWorker-2] [2021-07-01 07:34:41,669] INFO in celery: PRE task=layman.map.filesystem.thumbnail.refresh, workspace=jan_vrobel, publication_name=nah2
[2021-07-01 07:34:41,669: INFO/ForkPoolWorker-2] PRE task=layman.map.filesystem.thumbnail.refresh, workspace=jan_vrobel, publication_name=nah2
[2021-07-01 07:34:41,678: WARNING/ForkPoolWorker-2] [2021-07-01 07:34:41,677] INFO in thumbnail: Timgen URL: http://timgen:8080/?map_def_url=http%3A%2F%2Flayman%3A8000%2Frest%2Fworkspaces%2Fjan_vrobel%2Fmaps%2Fnah2%2Ffile&gs_url=http%3A%2F%2Flayman%3A8000%2Fgeoserver%2F&gs_public_url=https%3A%2F%2Fexample.com%2Fgeoserver%2F&editor=jan_vrobel&proxy_header=a0468616f9968eaecdc3377988aba650
[2021-07-01 07:34:41,677: INFO/ForkPoolWorker-2] Timgen URL: http://timgen:8080/?map_def_url=http%3A%2F%2Flayman%3A8000%2Frest%2Fworkspaces%2Fjan_vrobel%2Fmaps%2Fnah2%2Ffile&gs_url=http%3A%2F%2Flayman%3A8000%2Fgeoserver%2F&gs_public_url=https%3A%2F%2Fexample.com%2Fgeoserver%2F&editor=jan_vrobel&proxy_header=a0468616f9968eaecdc3377988aba650
[2021-07-01 07:34:43,924: WARNING/ForkPoolWorker-2] [2021-07-01 07:34:43,923] INFO in thumbnail: waiting for entries
[2021-07-01 07:34:43,923: INFO/ForkPoolWorker-2] waiting for entries
[2021-07-01 07:34:44,431: WARNING/ForkPoolWorker-2] [2021-07-01 07:34:44,431] INFO in thumbnail: browser entry {'level': 'SEVERE', 'message': 'http://timgen:8080/code.aa4d8b38.js 595:1871 "Unsupported layer className OpenLayers.Layer.Vector"', 'source': 'console-api', 'timestamp': 1625124884428}
[2021-07-01 07:34:44,431: INFO/ForkPoolWorker-2] browser entry {'level': 'SEVERE', 'message': 'http://timgen:8080/code.aa4d8b38.js 595:1871 "Unsupported layer className OpenLayers.Layer.Vector"', 'source': 'console-api', 'timestamp': 1625124884428}
[2021-07-01 07:34:44,432: WARNING/ForkPoolWorker-2] [2021-07-01 07:34:44,432] INFO in thumbnail: browser entry {'level': 'SEVERE', 'message': "http://timgen:8080/code.aa4d8b38.js 341:2520 Uncaught TypeError: Cannot read property 'getLayerStatesArray' of undefined", 'source': 'javascript', 'timestamp': 1625124884428}
[2021-07-01 07:34:44,432: INFO/ForkPoolWorker-2] browser entry {'level': 'SEVERE', 'message': "http://timgen:8080/code.aa4d8b38.js 341:2520 Uncaught TypeError: Cannot read property 'getLayerStatesArray' of undefined", 'source': 'javascript', 'timestamp': 1625124884428}
[2021-07-01 07:34:44,432: WARNING/ForkPoolWorker-2] [2021-07-01 07:34:44,432] INFO in thumbnail: browser entry {'level': 'SEVERE', 'message': "http://timgen:8080/code.aa4d8b38.js 174:342 Uncaught TypeError: Cannot read property 'ol_uid' of undefined", 'source': 'javascript', 'timestamp': 1625124884428}
[2021-07-01 07:34:44,432: INFO/ForkPoolWorker-2] browser entry {'level': 'SEVERE', 'message': "http://timgen:8080/code.aa4d8b38.js 174:342 Uncaught TypeError: Cannot read property 'ol_uid' of undefined", 'source': 'javascript', 'timestamp': 1625124884428}
[2021-07-01 07:34:44,558: INFO/ForkPoolWorker-2] Task layman.map.filesystem.thumbnail.refresh[6dd63673-5e06-4b09-8427-d4e03f62df5e] succeeded in 2.8893764168024063s: None

@jirik jirik added the bug Something isn't working label Jul 9, 2021
@jirik jirik added this to the Release 1.14 milestone Jul 9, 2021
@jirik
Copy link
Member Author

jirik commented Jul 9, 2021

Currently, Layman intentionally supports to show only WMS layers in map thumbnail:

case "HSLayers.Layer.WMS":

When Timgen is iterating through layers, it map other layers to undefined:
return layers_json.map(lj => json_to_layer(lj, gs_public_url, gs_url, headers));

And then, it adds each mapped value to the map as layer:
const layers = json_to_layers(map_json.layers, gs_public_url, gs_url, headers);

And that's probably reason of "Uncaught TypeError" messages, because OpenLayers can not add "undefined" layer to the map.

@index-git
To fix this, it could work to change

  const layers = json_to_layers(map_json.layers, gs_public_url, gs_url, headers);
  layers.forEach(layer => {
    ol_map.addLayer(layer);
  });

to

  const layers = json_to_layers(map_json.layers, gs_public_url, gs_url, headers);
  layers.forEach(layer => {
    if(layer) {
      ol_map.addLayer(layer);
    }
  });

@jirik
Copy link
Member Author

jirik commented Jul 9, 2021

Also in such situations when {'level': 'SEVERE', ... 'source': 'javascript', ...} appear or thumbnail is not generated, the celery task should probably raise an exception.

@index-git index-git mentioned this issue Jul 10, 2021
2 tasks
@index-git index-git linked a pull request Jul 10, 2021 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant