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

Expression image operator #994

Open
slaviczavik opened this issue Jan 30, 2025 · 3 comments
Open

Expression image operator #994

slaviczavik opened this issue Jan 30, 2025 · 3 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@slaviczavik
Copy link

slaviczavik commented Jan 30, 2025

Describe the bug
Maybe wrong image operator evaluation?

To Reproduce
Using following expression on icon-image attribute on symbol layer

[
  "coalesce",
  [
    "image",
    [
      "get",
      "subclass"
    ]
  ],
  [
    "image",
    [
      "get",
      "class"
    ]
  ],
  [
    "image",
    "dot"
  ]
]

throwing unwanted console warning.

The expression is working correctly, it picks icon either by subclass value, class value or if the icon does not exist it picks existing dot icon. This behavior is handled by the coalesce expression operator and works really correctly.

But if there is no match by subclass or class value a warning message in web console is shown saying that non matched icon could not be loaded.

Expected behavior
Map Engine should not throw warning about missing icon evaluated by subclass or class value.

Warning

Image "florist" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.

Desktop (please complete the following information):
OS or web browser does not affect the behavior.

Example
https://jsbin.com/mupurasosi/edit?html,output

@slaviczavik slaviczavik added the bug Something isn't working label Jan 30, 2025
@HarelM
Copy link
Collaborator

HarelM commented Jan 30, 2025

Can you please provide a jsbin with minimal repoduction?

@HarelM HarelM added the help wanted Extra attention is needed label Jan 30, 2025
@slaviczavik
Copy link
Author

Can you please provide a jsbin with minimal repoduction?

I have just updated the description with the JS Bin example.

@HarelM
Copy link
Collaborator

HarelM commented Jan 30, 2025

I think the following is working as expected, isn't it:

"icon-image": [
                "coalesce",
                  [
                    "get",
                    "subclass"
                  ],
                  [
                    "get",
                    "class"
                  ],
                  "dot"
              ],

I do see some missing images though, which might cause the console warning in the above expression, not sure it is related though...
Console warnings now:


b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "dry_cleaning" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "interior_decoration" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "lawyer" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "carpet" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "post_office" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "tobacco" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "camera" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "chocolate" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "weapons" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "greengrocer" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "courthouse" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "estate_agent" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "political_party" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "townhall" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "department_store" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "religion" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "tattoo" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "financial" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "locksmith" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "charity" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "bed" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "private_investigator" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "massage" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "consulting" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
b.<computed> @ runner-4.1.8.min.js:1
A @ util.ts:267
_notify @ image_manager.ts:224
getImages @ image_manager.ts:193
getImages @ style.ts:1596
processTask @ actor.ts:241
receive @ actor.ts:179
runner-4.1.8.min.js:1  Image "energy_supplier" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants