Closed Niklas81 closed 2 years ago
That isn't how you set up a shader, I'm afraid, and the MapboxVectorStyleSet has its own shaders in any case.
You want to look at the VectorMBTilesTestCase in the AutoTester app. That sets up a MaplyVectorStyleSimpleGenerator which provides a simple mapping from attribute data to visual representation. You'll want to make your own version of that object eventually, which returns custom MaplyVectorStyle objects based on attributes in the data.
VectorMBTilesTestCase doesn't seem to demonstrate how to set a shader. However, doing this allows me to do just that:
let shader = context.coordinator.control?.getShaderByName(kMaplyShaderDefaultLine)
print(":: VALID shader? \(shader!.valid())") // outputs :: VALID shader? true
imageLoad!.setShader(shader!)
However, the problem with some countries being seen through the globe persists. I've looked at other issues here, that suggests this is because some objects are to large, and needs to be tessellated. I'm currently trying this approach, which is now giving me the opposite problem: the tessellation tool I'm using (tesselate in python library turfpy.transformation
) for pre-processing geoJson and producing tessellated polygons are making them too tiny, so they are dropped by tippecanoe when producing tiles. As an example, when Bolivia is tesselated, the one single polygon representing it in the geoJson becomes 1488 polygons when tesselated. One way of fixing this may be to just find a better command to run tippecanoe with, but I haven't found it..
Can you suggest a better method/workflow for pre-processing? This seems to be a fairly common problem. I've seen some issues here giving examples, but they all seem to relate to adding countries using .addVector
rather than using vector mbtiles.
The shader for an image loader just affects the images. If you're using vectors, you need to use another mechanism, like what the MaplyVectorStyleSimpleGenerator does.
For tiles that end up heavily curved on the map, we've taken to rendering them into a background image. If you look at the MapboxKindaMap class, you'll see logic in there for "backgrounding" polygons.
Ok, thanks. I found a way to make a form of tessellation work, so taking that route.
I'm having the same issue as described in #1173. The solution works for me if adding the vectors using
addVectors(_ vectors: [Any], desc: [AnyHashable : Any]?)
, by passing[kMaplyShader: kMaplyShaderDefaultLine]
asdesc
argument.However, I would like to load my maps using tiles, specifically vector tiles, thus leveraging all the benefits of
MapboxVectorStyleSet
. There seems to be at least two ways of telling this to usekMaplyShaderDefaultLine
, however, none of them has any effect.This roughly sums up what I'm doing:
Am I missing something, or is this a bug? Using XCFramework 3.5 as distributed here on Github.