Filtering polygons based on text input in mapbox - mapbox

I'm trying to work out a variation on the mapbox code provided in this tutorial here: https://docs.mapbox.com/mapbox-gl-js/example/filter-markers-by-input/
But instead of filtering individual points, I'm trying to figure out how to filter polygons from a GeoJSON that have names appended based on an integer feature. Basically, I want to be able to enter the appended name of a polygon into a text box and have the map filter to just that polygon. I'm having difficulty identifying which parts of the code in the example to isolate and graft over. Has anyone tried something like this before?

When you say "filter to just that polygon", I think what you mean (in geospatial terms) is "filter to show only points within that polygon".
You will want to use Turf's "booleanWithin" function.
You will want to change this code:
layerIDs.forEach(function(layerID) {
map.setLayoutProperty(layerID, 'visibility',
layerID.indexOf(value) > -1 ? 'visible' : 'none');
});
You will have to iterate over the points themselves (not just their IDs), and use the booleanWithin function to check whether the point is within the polygon that you have somewhere else loaded.

Related

Is there a function to select and show certain features only in print composer?

I have a feature layer with points. I have three pages in my print composer. On one of my pages, I only want to show points that fall within a certain value range. First, I tried locking the style on the pages where I want to display all my points.
Then, I went to the Query Builder of the layer I want to select points from, and I created an expression to display only points from a range:
The problem is that this selection modifies the points shown on all my pages in print composer, even the ones where I locked the layers and style for layers. The only alternative solution I can think of is to select the points I want to show, create a new feature layer with those selected points, and then show that feature layer on my page in print composer. However I'd like to know if there's another way to do this without creating a new feature layer each time I want to filter the points I show in print composer.
There's another way. The points change because when you define a query, basically you define what features will be loaded to the project. So if you use categorized symbology you can define that some feature will be not displayed, but they will stay loaded in the project.
Here you can find how to use this type of symbology: Classifying Nominal Data

How to get region of interest in images

I need to train R-CNN on my dataset. Above Image is an example in which first column contain path to that image and second column contain coordinates of bounded box(ROI). How to get those coordinates in matlab. As my dataset is large so how those coordinates can be extracted by pointing manually.
for example if i am training R-CNN foe stop signs then second column contain coordinates of bounded box containing stop sign in whole image.
I do not know which version of MATLAB you are running, but I'm assuming it is fairly new (R2017a and later). Also, by 'how to get the coordinates', I assume you mean 'how to determine' or 'how to assign' the coordinates.
I believe what you need to do is to use one of the image labeling Apps called
imageLabeler
to annotate rectangles in your training images. You either do this manually if that's amenable, or you need to use automation algorithms if you already have a detector that does something similar. See this page for more details:
https://www.mathworks.com/help/vision/ug/create-and-import-an-automation-algorithm-for-ground-truth-labeling.html
Once you have the results of labeling stored in a groundTruth object, you would need to use something like objectDetectorTrainingData to create the table you are looking for.
See https://www.mathworks.com/help/vision/ug/train-an-object-detector-from-ground-truth-data.html for more details.

Paraview visualization help ("density/mist" plot?!)

I am trying to visualize a data set (x,y,z,scalar) in comma separated values format. The style I want to recreate is something like a transparent 3d heat map. The value of scalar at coordinate (x,y,z) will determine the "mist density". No idea what the name of the style is. Links below give examples of what I mean:
https://www.paraview.org/wp-content/uploads/2014/04/densityoverlay.png
or
http://www.scidac.gov/Conference2006/speaker_abs/AhrensPic.jpg
Any references would be most useful as I am new to data visualizing.
Take a look at the Point Volume Interpolate filter with Kernel set to GaussianKernel.

Matching two distinct images with similar SURF features matlab

We are working upon gesture to text conversion using matlab and want the input gesture from user to be mapped with a predefined database. Using detectsurffeatures function, we extract the features, but proper matching is not taking place unless input is a part of the reference image
How to map the features the pairs like...
input hand and database
We are not getting any error, yet the images are not mapped.
Please suggest a solution.

Place a marker in each country with mapbox

I am using Mapbox to build a multiple choropleth map.
Something along the lines of this example, https://www.mapbox.com/mapbox.js/example/v1.0.0/choropleth-joined-data-multiple-variables/
I am using countries instead of US states however.
I've got the map working and I can switch between layers
I have an extra requirement however to add a marker in each country that displays how many projects are active in that country.
I found out how I can add custom markers to the map with this example, https://www.mapbox.com/mapbox.js/example/v1.0.0/divicon/
The problem is I need to put a marker in the center of each country.
Does anybody know a way to put a marker in the middle of each country?
I tried to use the natural earth admin 0 label points data but that has multiple points per country. It looked like the 'scalerank=0' points were the middle of the countries but if I filter on these points, I still get multiple points for some countries (russia has 4 for instance, but Belgium has 4 as well).
If you plot all scalerank 0 points on a map you get the following result:
https://a.tiles.mapbox.com/v4/persyval.jg5p7gm7/page.html?access_token=pk.eyJ1IjoicGVyc3l2YWwiLCJhIjoiX3lrSTNYYyJ9.6Ps4OlBCYmlkxQksKsGb7A#6/45.159/12.206
Does anybody know about a dataset that has one point per country or another way to put a marker in the center of each country with mapbox?
It seems it's hard to find a list of country points for the placing of markers.
So I took the mentioned admin labal 0 points and tried to sanitize it to have only one appropiate marker per country.
The result can be downloaded here in GEOJSON format:
https://drive.google.com/file/d/0B6IQhfb-UYeUYk1mcUZaMmV0S1U/edit?usp=sharing
If you want to have a visual representation of the points take a look at this map:
https://a.tiles.mapbox.com/v4/persyval.jgk4767c/page.html?access_token=pk.eyJ1IjoicGVyc3l2YWwiLCJhIjoiX3lrSTNYYyJ9.6Ps4OlBCYmlkxQksKsGb7A#4/36.49/34.32
I needed this points for a proof of concept project so I haven't checked all markers meticulously, I also haven't taken account some of the more political sensitive country borders.
If you have a project in which this is of importance please check the file before using, but the points in this file can be easily edited to your own preferences.