Where can I find a list of paint properties for mapbox-gl? - mapbox-gl-js

I added some geojson layers to mapbox-gl and have been scrubbing the docs in search of a list of paint properties so I can style the layers. The only thing I found on the documentation page referencing paint is here https://docs.mapbox.com/mapbox-gl-js/style-spec/#layers and is very underwhelming.
Am I missing something?

https://docs.mapbox.com/mapbox-gl-js/style-spec/#layers is the right place to find documentation for available paint properties.
Each layer type has an own secion, e.g. for a layer of type fill:
https://docs.mapbox.com/mapbox-gl-js/style-spec/#layers-fill
or for a layer of type line:
https://docs.mapbox.com/mapbox-gl-js/style-spec/#layers-line

Related

How to get a reference to markers autogenerated by the creation of the symbol layer?

I need to perform automated actions on individual markers on my map, but based on all the answers I'm finding online I will first need to store references to my markers in my script. However, I am not creating the markers explicitly. Instead it seems the markers are being generated when I load a collection of points from geojson using the map.addSource() and map.addLayer() methods.
For an MCVE see here.
How can I get references to the generated markers using this method?
You are confusing Markers (HTML elements that sit above the map) with a symbol layer (graphical elements that exist within the map). Symbol layers don't generate markers, and there are no "references" to get.

I cannot reference a different Visio shape Master on the shapesheet

I'm attempting to create a custom stencil, and one of the ways I want to make developing this easier is to have children reference the dimensions of parent stencils (parametric design).
In the below pictures I'm showing the values I want to refer to on the parent, as well as confirming the Shape Name is Shape.7.
But when I attempt to refer to it on the child shape, I'm told I have an invalid formula, even though the autocompletion in Visio is listing the available fields for me which appears to confirm I'm referencing it correctly:
In this example stencil I have two shapes, Parent and Child. This is the stencil I used to create the screenshots above. I simply want the Child shape to inherit constant values from the Parent shape rather than copying them, so that modifying the parent would automatically update the child.
Instead of Shape.7 I think you need to use the Sheet name e.g. Sheet.5 or similar.
=Masters[Flip-flop]!Sheet.5!Height

Mapbox GL JS ignore property expression

I'm trying to make geojson layer of polygons with diffrent fills. Some of them need to use "fill-patern" so they have "fill-patern" property, but some of them don't. I'm getting both of the "fill-patern" and "fill-color" proreties by expressions:
paint: {
"fill-pattern": ["get", "fill-pattern"],
"fill-color": ["get", "fill-color"],
},
But "fill-patern" property with any value (even null, or undefined) makes layer ignore "fill-color" property of this feature. So is that possible to fully ignore property if feature doesn't have it?
You're correct that, as noted in the documentation for the fill-color property here, fill-color is disabled by fill-pattern. In this scenario, the best approach would be to make two separate layers, one for the polygons that need to use fill-pattern and one for the polygons that don't. You could either use the same source for each layer and apply a filter expression as needed, or break up your original source into two separate sources.

How to position Canvas with agents in classical Agent-Based Modeling in AnyLogic

I'm new to AnyLogic and trying to figure out how Agent-based models should be set there. There is a famous Epidemic model, which I'm trying to reproduce. Most tutorials on classical ABM deal with old GUI settings.
For example, in version 8.5+, which is actual now, the Environment object (that was used for positioning of layouts) has been deprecated.
Now I see that new object Canvas is used to put the layout with agents on the page. But the structure of source code file is a bit unclear for me and I've failed to find relevant description how Canvas can be set for the purpose. (Besides I'm not sure that this is recommended way of doing this task.)
Question: I would love to learn the right way to arbitrary position the area with agents on the page. Below you may see what I get by default.
After some playing around, the 'minimalistic' functionality is as follows.
One should create some population with arbitrary name Person (population name people adds automatically).
The following structure of the Project is to be reproduced (arbitrary names are marked with yellow).
Comment: after adding a Canvas called mapCanvas one adds the function setCanvasCellColor with following body:
mapCanvas.fillCircle(person.getX(), person.getY(), 3, color);
It is clear that former two arguments stand for coordinates of a given point, then its size (i.e. 3) and color. Do not forget to add two arguments used in the body, namely, person as Person and color as Color.
From Entry Action of the statechart named state call the just made function. I've put black color here just for the sake of demonstration; chartreuse constant gets used instead in the Epidemic example.
main.setCanvasCellColor(this, black);
Finally, you may run the model to get the following picture.
Note
If one is reluctant to bother with Canvas, use Main - Presentation - xxx_presentation and click Draw agent with offset to this position checkbox.

How do you add a CIPixellate Core Image Filter to a Sprite Kit scene?

How do you add a CIPixellate Core Image Filter to a Sprite Kit scene?
I have a SpriteKit scene that is an SKScene or subclass of it.
I want to add a Core Image filter to the scene. Specifically a CIPixellate filter, so I can have 8-bit game heaven for free.
How do I do that?
It turns out this is not hard at all. It's just that the Core Image Filter docs are OLD and crufty and in the case of SpriteKit, the docs are flat out misleading or incomplete, including the SKEffectNode docs.
The SKEffectNode docs have this to say (as of this post) on the filter property of SKEffectNode:
The Core Image filter must have a single inputImage parameter and produce a single outputImage parameter. The default value is nil. If
the value is nil and the effect node is enabled, no filtering takes
place. However, its children are still rendered in a separate pass and
blended to the parent’s framebuffer.
Well that's sort of informative, but not terribly informative, because the Core Image Filter catalog says CIPixellate has the following keys for parameters:
inputImage
inputCenter
inputScale
It doesn't say anything about an outputImage or that the inputScale is "how pixellated".
Well, that's that... let's look at how to.
First off, note that SKScene inherits from SKEffectNode.
That means you can add CIFilters to it. Awesome.
All you need to do is this.
First create a CIFilter.
CIFilter *pixellateFilter;
pixellateFilter = [CIFilter filterWithName:#"CIPixellate"];
[pixellateFilter setDefaults]; // Remember to setDefaults...
// We could change some value but for this one we won't.
// [pixellateFilter setValue:#(10.0) forKey:#"inputScale"];
Then configure your SKEffectNode to actually render effects!.
[aScene setShouldEnableEffects:YES];
It's not a bad idea to center the filter. But your mileage may vary.
[aScene setShouldCenterFilter:YES];
Next add the filter.
[aScene setFilter:pixellateFilter];
Note that you can add this before or after it is added to a parent node and before or after it is on screen. You can even build custom SKActions to do this... :)
From all of this, one thing you can note is that the Core Image Filter catalog, as old as it is, does tell you that various filters are members of various CICategory types, even though those are poorly documented as well. But you can basically assume that anything that works in a given category implies that other filters in that category might also work :)