Search Mapbox dataset - mapbox

I use a Mapbox dataset converted to a tileset to show features on a map. I would like to add a search facility which goes through all the features in the dataset (not only the one shown on the screen which I could search locally thanks to queryRenderedFeatures).
I do not see how to do this without implementing my own search facility server side. I would like to avoid that because it would mean my dataset needs to be stored at two different places (on Mapbox and on my server).
In this related question, someone suggested to use querySourceFeatures but it only checks features in the currently visible viewport.
Did I miss any search through dataset facility offered by Mapbox ?

You could use the Datasets API to download you whole GeoJSON dataset to the client, then using the mapbox-gl-geocoder's localGeocoder option implement you own custom search.

Related

Set language in Mapbox Static Image

I am using the Mapbox Static Image API to show users an image of a slice of a map relating to the page they are viewing. Our users are from many countries and expect properly localized country, city names etc.
Question
Is it possible to set the language of all labels in a Mapbox Static Image somehow?
I think I can achieve this by creating a Mapbox Studio Style for each language we want to support, but we have quite a lot of customization in our custom style so I would rather avoid having to manually maintain a version for all supported languages.
I have tried using the playground https://docs.mapbox.com/playground/static/ and also read through the documentation, without finding anything reminiscent of setting the locale
I think your only option is to create multiple styles for each language you want to support.
You probably use a call like this to get your map:
/styles/v1/{username}/{style_id}/static/{overlay}/{lon},{lat},{zoom},{bearing},{pitch}|{auto}/{width}x{height}{#2x}
Use javascript to find your users browser preferred language: How to get the browser language using JavaScript
and change your {style_id} to the requested language.
Another option that comes to mind is to try to use multiple layers.
All the background data and (complex) style in one layer, and make a separate layer with your labels. This way you only need to have different styles for your labels and the maintenance will be less of a hassle.

OpenStreetMap Grayscale tiles?

I'm building up experience with web development and my next projects are some web maps. I've looked into Google Maps and Open Street Maps and would like to use OSM for a project as it contains more detailed information of building footprints.
I've tried styling Google Maps which seemed fairly straightforward, but I'm a little lost with OSM. I've got to the point of trying to create my own renders (with TileMill) but this is crashing my system due to the amount of data.
What I essentially need is this (but for the UK);
http://maps.stamen.com/#terrain/12/37.7706/-122.3782
Are there any resources which you can recommend or how easy/ difficult is this to create myself? I think I would need to create the map (with TileMill or similar and then find my own servers to host), or is there an easy way to convert the standard map to Grayscale?
I want to keep it as simple as possible so please any recommendations?
Turning the standard map to grayscale: I might be very late to this but for anyone else running into this question: I found a very easy solution if you're working with HTML and Javascript using OpenLayers and the standard OpenStreetMap-Tile-Layer in color. I took the solution from here: https://openlayers.org/en/latest/examples/semi-transparent-layer.html
I don't know much about web development but this solution worked for me. Upon creating the map, as done in main.js in the example from the link, a class name is defined ('bw')
className: 'bw',
that can be used in index.html to manipulate the style o f it in the part:
<style>
.bw {
filter: grayscale(100%);
}
</style>
My application was altering a pre-built web-map from the qgis2web extension for QGIS. I was able to turn the tile layers from the background map to grayscale so the results would stand out more.
You could use https://github.com/Zverik/leaflet-grayscale to display any tile layer in grayscale. It's a plugin built upon the leaflet map displaying library.

Leaflet choropleth map - polygon colors linked to spreadsheet?

I'm new to using Leaflet after having made some interactive choropleth maps using Mapbox's TileMill. If I add a custom polygon layer through using geoJSON, is there any way for me to symbolize (i.e. color) polygons based on values in a linked spreadsheet? What I'm trying to do is find a way to create an online interactive choropleth that can be automatically updated with current data just by making changes to a spreadsheet (i.e. Google doc) rather than adding a new geoJSON layer. Thank you for your help!
You can request your Google Spreadsheet data as JSON and then parse the data on the client-side, updating the data inside your geoJSON. Here's some more documentation via Google. Basically you'd call the spreadsheet, pass the spreadsheet data as JSON to a callback function, then have that function update your geoJSON with the new values. The basic API looks like this, where feed is the type of feed (either list or cell) you'd want and key is your Google Spreadsheet's key.
http://spreadsheets.google.com/feeds/feed/key/worksheet/public/basic?alt=json-in-script&callback=myFunc
It seems like you might have two different Qs there, and since I can't comment to ask for clarification, here are answers to both:
If you're referring to updating colors in Tilemill, then (the title of your question shouldn't refer to Leaflet, and) there's a pretty good workflow here for using a google spreadsheet as a Tilemill data source. Unfortunately though, fill colors are not data-driven properties, so you'll still need to assign colors conditionally in CartoCSS.
If you're referring to updating a thematic layer in the Leaflet client, then there are two options:
Write a script to populate this function and this line with values brought in from your google spreadsheet endpoint.
Use CartoDB. It does pretty much all of what your referring to, with live changes on a leaflet map as you update the table and CartoCSS styles. You can also synchronize a CartoDB table with a google spreadsheet.

Looking for geographic topomaps without names of city

for my next project I'm looking for maps, that contains only frontiers of countrys, lakes, hills ans rivers.
Can I get such kind of maps with the OpenStreet-API?
best regards
The "OpenStreetMap API" provides map data, not map images. So, for the imagery you want, you either need to find a source that renders the style you want, or render your own.
I don't know of any services that provide exactly the render that you're looking for. However, it should be very easy to render your own tiles that do this - if you install TileMill and follow through the tutorial, you will find it very easy to delete layers from the default style until no names are included in the style.
Note that if you're planning on running a web service, you'll also need to serve your special new map tiles to your users.

Custom Maps in iPad App

I just want to build a drill down map like this - Drill Down Map
Here I want to show some data on tapping of each regions.I am out of clue. How can I ? What should I use ? From where to start ?
EDIT : In the link it's showing the country name on mouse over, instead of that I want to show some data/info of the country on touch. Please visit the map shown in the link,you'll get the whole idea.
Thanks !!
If you want total control on the map layout, and be able to check which country the users taps, there's no secret : you need to have boundaries of all countries you want to detect.
Here's the global approach I would use to reimplement something that looks like the map you linked to (I can you into more details if you want, but at first, here's the global approach) :
Get the data of the boundaries of the countries you need. This can be done using OpenStreetMap.org data.
[EDIT] I just came accross this website to download countries boundaries as files you can then use with tilemill : http://www.gadm.org/country
Use this data with tilemill (http://mapbox.com/tilemill/) : this tool is able to design maps using a language that looks like CSS but dedicated for maps. The results is great and the tool great as well. This tool also support shapes files, so if you can get the countries boundaries as shapefiles, you'll be able to use them with tilemill, and this will be easier than using .osm files from open street map). Have a look here http://mapbox.com/tilemill/data/ for the supported formats.
Then, with tilemill, export your map as an MBTile file (this file contains all tiles needed to get the map rendered at different zoom levels).
Use the route-me project to display the resulting MBTile file (in its latest version, route-me is able to do that, this feature has been implemented by the mapbox team to support their open format MBTile).
Guys from Mapbox have published a good tutorial "from data to maps" here : http://mapbox.com/demo/making_massredistrict/ this may help as well
Your best bet is to use CloudMade ( http://cloudmade.com/ ). They provide custom map builders program where you can build custom maps and can integrate those maps in your iOS app.
Depends what you are looking for. To implement the linked example it's enough with a giant image that you can split in tiles using CATiledLayer. You'll find examples if you google a little, PhotoScroller is one. If you want to display real maps you have to investigate the route me project.
I don't think that using images could be good option.Check this link - arcgis-iphone api. I am not so sure but you can get some idea from this.
Happy to help..