Exclude labels that are outside a designated region in Mapbox Studio - data-visualization

I'm currently working on a visualization on Mapbox that's focused on a given region, let's say Texas for the sake of this example. I want to make it so this region is emphasized on the map, with everything else faded to the background.
So far I've managed to import Natural Earth's shapefiles into Mapbox Studio in order to make everywhere outside of Texas a shade darker:
This is great, but ideally I'd like to hide all of Mapbox's labels that are outside of Texas. I've been trying to use filters in Mapbox studio to "filter out" all of the items on each layer, but it appears their layer settings don't allow me to filter based on a geospacial attribute (only data attributes).
Does anyone know of a way for me to hide all city labels outside of Texas; either programatically on the js Mapbox GL library, or ideally via Mapbox Studio?

In Mapbox Studio, select the layer. Then click 'select data' and then 'filter'. There should be an option to filter the layer by the ISO/parent. I've done the same with admin-1 labels to restrict to only US

Related

Custom Tileset won't appear on Android - mapboxsdk

I have created a custom tile on mapbox studio and it is visible correctly on the studio but when I use that tile ID in my kotlin code using the Vector source, it does not show, although the logcat shows the request is successful. The tileset I created is also set to public. Even though I've tried loading the built in tile of mapbox "mapbox://mapbox.mapbox-terrain-v2" which is taken from the github repository of mapbox here. This one shown below is also not visible on android although it is visible on mapbox studio.
style.addSource(
VectorSource("terrain-data", "mapbox://mapbox.mapbox-terrain-v2")
)
style.addLayer(
LineLayer("terrain-layer", "terrain-data")
.withProperties(
PropertyFactory.lineJoin(Property.LINE_JOIN_ROUND),
PropertyFactory.lineCap(Property.LINE_CAP_ROUND),
PropertyFactory.lineColor(Color.parseColor("#ff69b4")),
PropertyFactory.lineWidth(1.9f)
)
)
Any help would be appreciated. Thanks!!
I got it working after adding the name of source layer (that can be found on the top left corner, when you open the custom tileset), like below:
Custom Tileset
LineLayer("terrain-layer", "terrain-data").withSourceLayer("name_of_source_layer")

MapKit how to get the Bezier path of a State

When i look at apple's Map, I can see the different bezier path of a specific place. I would like to know how to extact that information directly from the map. So let's say the user selects New York, I would like to highlight NEW York's Bezier path directly on the map. can this be done?
You will need an alternative form of data that ideally is very close to or exactly the same as the border being drawn by MapKit. You aren't going to get this from Apple.
Take a look at this blog post, where I accomplish the same thing with an open source framework (Mapbox GL) on the web:
http://justinmiller.io/posts/2015/01/20/anatomy-of-a-travel-map/
The ability to highlight areas like this should work in the iOS version of the toolkit as well (https://github.com/mapbox/mapbox-gl-cocoa) though you will not be able to do the interactivity directly in that framework.

generate geo tiles from vector data

i am facing this problem : I have in my database some vector data (polylines ...) which describe many world/country/region/cities boundaries.
I would like to have an interactive map on thoses areas.
When i render those data in the browser (data are sent in geojson) this is slow (i'am not surprised).
The next reason, is to generate some raster tiles to represent the areas at different zoom level and to have a way to make the relation between a click on a area and the area selected (to display more info).
I am a newbie in geo tiles :
What is the best tool to generate png/jpg tiles from vector data?
How to make relation between an area clicked and a "id" in database?
I know my questions are very large, but if you have some advices ...
Thanks!
I recently wrote a blog posting on how to improve the rendering speed of raster tiles:
http://blog.webfoot.com/2013/03/12/optimizing-map-tile-generation/
As for connecting a click to a jurisdiction ID, I don't think there is a shortcut: you need to translate the click into lat/lng (or Vast Coordinate System, as I describe in the blog post) and then do a point-in-polygon check. If you are using PostGIS, then you can do an ST_Intersects.
NOTE: if you are using MySQL, the intersection is done with bounding boxes, not the polygons. It still is possible: you just need to grab a point-in-polygon function from somewhere to check which polygon if a bounding-box check gets you more than one.
Here is an example of dots you can click on:
http://maps.webfoot.com/demos/CanadianStimulus/CanadianStimulus.html
Note that because people aren't precise with clicking (especially with tiny dots), I actually make a few pixels around the dots "live" as well as the single-pixel dots. You can also click away from the dot, and then it will show the polygon (which in this example's case, is the federal electoral district).
There is a MongoDB Plugin datasource for Geoserver, a full featured WebGIS Server. You can use it to build up a map rendering service (a WMS actually) ofyour data. Then use Geowebcache to generate tiles of your map.
This way you can use fully featured WebGIS stack, which allows you to manage additional datasources, and easy tile subset recreation if portions of your data get updated.
Also querying features on a map (relation map position to element in database) is provided through Geoservers WFS implementation.

Multiple viewports in ToggleWindow

I have a toggle window (with 2D graphic) with several Viewports. How do I now which Viewport that is active? Is there an API where I can get access to the Viewports? I haven't found any documentation about this.
There is no Ocean API yet to access the Viewports. There is, however a new API introduced in Ocean 2012.1 which makes it possible to extend available Viewports, i.e. add your custom toggle windows to 2D Plot window.

3D animation programatically rendered in Blender

I have a project in which I would like to programatically create and render a 3d animation based upon input. I originally asked here on stackoverflow if Blender was right for the job, and the response was yes, but upon looking at the API, it says this:
Python was embedded in Blender, so to access BPython modules you need to run scripts from the program itself: you can't import the Blender module into an external Python interpreter.
I want to be able to create and render this scene without having to ever open another program like Blender. Is this possible, and is Blender still the right choice?
Thanks in advance!
At work me and colleague worked on a project that rendered 3d scenes altered externally. We used Python to modify/create scenes, and did the rending on server through the command line interface (no GUI).
You can pass a python script as an argument to Blender in the command line options to
generate your scene objects and do the rendering.
I don't see how you can render in Blender without using Blender.
You can use Blender if you want, obviously this is not your only option.
If you need to
create and render a 3d animation based upon input.
You can go as simple or as you complex as you'd like.
You can use OpenGL in your language of choice (C++, Java, Python, etc.)
and display the animation (with or without fancy renderings).
It's up to what 'render' means to your context.
If you need some nice shading(light, soft shadows, reflections, etc. - ray tracers basically), you can still show an interactive preview to your users and generate the scene
for a 3rd party renderer(like Yafaray, Sunflow, LuxRender, etc. - I've put together a short list of free renders), and show the progress to the users after they've chosen the external render option.
On a similar note, have a look at joons.
HTH
Cart by Suomi - Yafaray Gallery image
Julia quaternion fractal - Sunflow Gallery image
Klein Bottle - LuxRender Gallery image