I'd like to query all objects that are taller than 20m within a bounding box on OSM?
Is this possible so I can place them on a map or even generate a map tile with them drawn on it.
You can query Overpass API for all objects that do have a height tag in the first place and then filter the results yourself in any language that can process JSON or XML (Overpass cannot compare tag values with >).
Related
I'm looking to create a packed bubble graph like the below (size of the bubble corresponds to population, and the color of the bubble corresponds to number of widgets sales). The graph is exactly the way I need it, except that I would like to arrange the countries so that they are grouped by continent. Is there a way to do this in Tableau?
I've tried to recreate a similar scenario even though it's not clear if the bubble color should (or not) be related to a specific field.
That being said, using the superstore dataset, I've "grouped" customers by region (color) so they are some how aligned through inner circles.
In order to do so, I just sorted the region pillow in the detail section.
See below.
I have a vector tileset (e.g. all the countries in the world).
Separately, I am running a query that gets a count for each country (e.g. how many times has X occurred in a given country).
Using the query response data, I create a choropleth of the result by correlating the country ids in the query with the country ids in the tiles.
Oftentimes, only a handful of countries are styled (other countries have a zero count). I would like to initialize the viewport to only those countries that have been styled, however...
I do not know how to obtain the geographic data (e.g. bounding box) of the countries that have been styled. The query only responds with the country codes and a count (no geographic data).
Is it possible to get the geographic data from the vector tiles themselves?
UPDATE:
I added the bounding box data to each feature in the vector tileset, but I'm still not sure how I would query the tiles to get the list of relevant bounding boxes (e.g. get a list of all features that have a count > 0).
Maybe with something like queryRenderedFeatures...? (not clear how to use this within the context of react-map-gl)
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.
I want to use mapbox's queryRenderedFeatures API which will give me the set of "visible" features satisfying the given query parameters.
Does this gives the feature set from current map viewport only? If not then how do I fetch the features from current viewport only?
Is there any way where I can provide x,y coordinate bounds of a map viewport to queryRenderedFeatures API?
Yes this gives the features from the current viewport only.
You can get a subset of those features by giving a bounding box with the geometry parameter. See the documentation for this functon.
Omitting this parameter (i.e. calling Map#queryRenderedFeatures with zero arguments, or with only a options argument) is equivalent to passing a bounding box encompassing the entire map viewport.
There is code which get from database points in bounding box for rendering on browser. Also displays list of points with attributes (name etc.)
But, when filter will be applied to the dataset I may get big count points (example around 50000). Rendering 50000 points by browser may cause performance problem. Therefore in my opinion need to apply paging algorithm (by LIMIT and OFFSET). But, first need render filtered points within browser box and then all the other.
UPD:
I found this variant:
SELECT gs.id, gs.name, ST_Contains(ST_GeomFromText('POLYGON(...)', 4326), gs.point) as contains
FROM geoms as gs
WHERE gs.name LIKE '%Berlin%'
ORDER BY contains DESC
LIMIT 50
The query you have will work for what you need but are you sure you need to display 50k points most of which are outside of the window? The standard aproach would be querying the points inside the browser box and a little around it and then load the rest when the position changes.