-
Notifications
You must be signed in to change notification settings - Fork 122
[IOS] MGLSymbolStyleLayer text will not display if it contains letters or Numbers #122
Comments
@songyuyang0918 have you tried this with Android? /cc @jmkiley |
Hey @songyuyang0918 - Are you still seeing this issue with 5.6.0? Also, are all of the labels missing in that layer or just some of the labels? I was able to partially reproduce this issue with the clustering example. When I set I did not notice the same behavior with the equivalent Android example. |
@julianrex I'm just an IOS developer. I'm not good at Android. @jmkiley And what do I do when you say "set the second string to be a Latin scripted string"? |
Hi @songyuyang0918 - Apologies for the confusion. The code in my comment was intended to help other people to reproduce the issue. Since you already are seeing the issue in your own code, you do not need to use the code in my comment. Can you confirm whether you are seeing the behavior with Maps SDK v5.6.0? Are all labels within the layer missing or just some of the labels? |
Noting that I don't see this issue if I add the following code to the MGLSymbolStyleLayer *stateLayer = (MGLSymbolStyleLayer *)[self.mapView.style layerWithIdentifier:@"state-label"];
stateLayer.text = [NSExpression expressionWithFormat:@"mgl_join:({'%@', '测试'})", [NSExpression expressionForKeyPath:@"name"]];
stateLayer.textAllowsOverlap = [NSExpression expressionForConstantValue:@"true"];
stateLayer.textColor = [NSExpression expressionForConstantValue:[UIColor redColor]]; @songyuyang0918 - Could you also confirm whether you see this issue when |
@jmkiley Thank you very much for your reply! For SDK5.6.0 I use cocoapods to display timeout, I will continue to try tomorrow.
1 figure (test figure using [NSExpression expressionForKeyPath:@"jiedao"]) The corresponding figure 2 The third problem remains. |
Hello @songyuyang0918 - Could you provide a minimal test case that demonstrates the issue you are seeing? This would help us to investigate the issue. |
@jmkiley Here's the example I created that requires you to add your own AccessToken: |
Is there anyone else who can help me with this problem? |
Hi @songyuyang0918 - Thank you for your patience. I haven't been able to repro your issue and am unable to download your sample app. Could you share the example via Github? If you are unable to share the sample app via Github, would you be able to send it to Mapbox support with a link to this issue? |
@jmkiley Thank you very much for your patience. The pods file in my example is too large to share with github. I have sent the problem to Mapbox support. |
@jmkiley, @1ec5, it appears that if the style json is used as the style source, if the feature being referenced for the MGLSymbolLayer text contains mixed-script, none of the labels will show. However, if the tileset is added instead as a rasterSource over a Mapbox default or custom style, regardless of if the feature contains mixed-script, the labels will show with no issue. I've attached screenshots and the sample project I used to reproduce this below. tileset url declared in style.json: Link to sample project with access token removed: https://drive.google.com/open?id=1DlwGjT6l42DJn2HA28NQW2Lc-51koIij Note: if running my example, make sure to comment out the raster source and layer to test the json as a style source by itself. If you're running the example to test the rasterSource, the styleURL will need to be changed from the json or simply removed. |
For clarity, the source.json in the project above is not a source but rather a style. If I understand the discussion above, the issue is that red labels such as “东海街道” and “环西指挥部 abc” appear if the map view is initialized with the Mapbox Streets style and OSM raster tiles are added at runtime, but not if the map view is initialized with a bundled JSON file as the style and that style contains an OSM raster tile layer baked right in. Running the application results in this console output:
The issue is that source.json does not specify a A typical {
"glyphs": "mapbox://fonts/mapbox/{fontstack}/{range}.pbf"
} But if you need to load glyph PBFs locally for some reason, it’s also possible to specify something like - (NSURL *)offlineStorage:(MGLOfflineStorage *)storage URLForResourceOfKind:(MGLResourceKind)kind withURL:(NSURL *)url {
if (kind == MGLResourceKindGlyphs && [url.scheme isEqualToString:@"foobar"]) {
return [[NSBundle bundleForClass:[self class]] URLForResource:@"glyphs" withExtension:@"pbf"];
}
return url;
} |
@1ec5 The problem has been solved successfully. Thank you for your help! |
@1ec5 Hello! Is there any way for me to load the PBF directly locally? As for the mglmapsnaptertests you mentioned, I only found the corresponding MGLMapSnapshotter class in 5.5.0. My understanding is to load the offline map. |
#122 (comment) shows how to load the PBF file directly from a local file URL, but we don’t have any documentation on the PBF file’s format or how to create one yourself. But if you’re interested in viewing the map offline, take a look at MGLOfflineStorage and MGLOfflinePack. By adding an offline pack, you’ll end up downloading all the resources required for a given style, including any glyph PBFs that the map would normally fetch from the Mapbox Fonts API. |
If you have any questions about offline maps, please contact the Mapbox Support team. I’m closing this issue because there doesn’t seem to be a problem with the runtime styling API per se. Feel free to open separate issues about any bugs or missing features as you integrate offline maps. |
Platform: iOS
Mapbox SDK version: 5.5.0
Xcode version: Version 10.1 (10B61)
Devicemodels: iPad mini 3
Steps to trigger behavior:
1.I used GEOSwiftMapboxGL to convert the WKT into the pointAnno object of the MapBox through traversal.
2.The pointAnno data is then converted into an MGLPointFeature object and stored in an array.
3.Display the text label by generating MGLShapeSource and MGLSymbolStyleLayer.
Expected behavior
Display all text on the map.
Actual behavior
1.When mglshapesource.text = @ "测试" shows,
2.When mglshapesource.text = @ "测试 123" does not display
3.When mglshapesource.text = @ "测试 ABC" is not displayed
and
When text can be displayed, it is displayed at level >12, <12 is not displayed.
//1
//2,3
The text was updated successfully, but these errors were encountered: