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

Symbol layer items disappear when text-field is an empty string #6160

Closed
mikkom opened this issue Feb 14, 2018 · 5 comments · Fixed by #6164
Closed

Symbol layer items disappear when text-field is an empty string #6160

mikkom opened this issue Feb 14, 2018 · 5 comments · Fixed by #6164
Assignees
Labels

Comments

@mikkom
Copy link

mikkom commented Feb 14, 2018

mapbox-gl-js version: 0.44.1

Steps to Trigger Behavior

  1. Create a symbol layer with icon-image and text-field.
  2. Conditionally set text-field to empty string.

Expected Behavior

All the symbols are visible.

Actual Behavior

Symbols that have text-field set as empty string disappear on close enough zoom-levels.

Simple example which reproduces the issue: https://jsbin.com/weraqecesa/edit?html,output

See for example the area around Muir Beach where we have one symbol without text which disappears when zooming in. If we change the symbol to have non-empty text-field it stays visible.

@mikkom
Copy link
Author

mikkom commented Feb 14, 2018

The same issue can be seen also with version 0.44.0. However, with version 0.43.0 the symbols stay visible in the JSBin example.

@anandthakker
Copy link
Contributor

Thanks for reporting this @mikkom , and for including an example reproducing it.

Tweaked the jsbin to center on the area: https://jsbin.com/jagugeqele/edit?html,output - you should be able to see the unlabeled dot fade out right after the map loads.

cc @ChrisLoer @ansis

@ansis ansis self-assigned this Feb 14, 2018
ansis added a commit that referenced this issue Feb 14, 2018
Empty text strings do not have any collision boxes so the collision
index check was never done and the text was not counted as "placed".
This fixes that by making "placed" the default when the feature has
text.

fix #6160
ansis added a commit that referenced this issue Feb 14, 2018
Empty text strings do not have any collision boxes so the collision
index check was never done and the text was not counted as "placed".
This fixes that by making "placed" the default when the feature has
text.

fix #6160
@mikkom
Copy link
Author

mikkom commented Feb 15, 2018

That was fast. Thanks @ansis & @anandthakker 🙂

@AzadehY-Dev
Copy link

hi. i have an apposite problem. when i add a text field the symbols disappear. i searched a lot and i used a lot of suggestions. but none of them didn't work for me. please help me. that's my code:

private void addSymbolToMap(String name, LatLng point) {
mapStyle.addImage(name, getResources().getDrawable(R.drawable.mapbox_marker_icon_default));
SymbolManager sampleSymbolManager = new SymbolManager(mapView, map, mapStyle);
sampleSymbolManager.setIconAllowOverlap(true);
sampleSymbolManager.setTextAllowOverlap(true);
sampleSymbolManager.setIconRotationAlignment(ICON_ROTATION_ALIGNMENT_VIEWPORT);
SymbolOptions sampleSymbolOptions = new SymbolOptions()
.withLatLng(point)
.withIconImage(name)
.withIconSize(1.5f);
.withTextField("test")
.withTextFont(new String[] { "Arial Unicode MS Regular"});
Symbol sampleSymbol = sampleSymbolManager.create(sampleSymbolOptions);
}

@ryanhamley
Copy link
Contributor

hi. i have an apposite problem. when i add a text field the symbols disappear. i searched a lot and i used a lot of suggestions. but none of them didn't work for me. please help me. that's my code:

private void addSymbolToMap(String name, LatLng point) {
mapStyle.addImage(name, getResources().getDrawable(R.drawable.mapbox_marker_icon_default));
SymbolManager sampleSymbolManager = new SymbolManager(mapView, map, mapStyle);
sampleSymbolManager.setIconAllowOverlap(true);
sampleSymbolManager.setTextAllowOverlap(true);
sampleSymbolManager.setIconRotationAlignment(ICON_ROTATION_ALIGNMENT_VIEWPORT);
SymbolOptions sampleSymbolOptions = new SymbolOptions()
.withLatLng(point)
.withIconImage(name)
.withIconSize(1.5f);
.withTextField("test")
.withTextFont(new String[] { "Arial Unicode MS Regular"});
Symbol sampleSymbol = sampleSymbolManager.create(sampleSymbolOptions);
}

Hi @azadeh18 it looks like you're using GL Native not GL JS. If you're looking for debugging help, your best bet is to either ask your question on Stack Overflow or contact Mapbox support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants