Mapbox GL JS - Highlight Country Polygon - maps

I have a select2 option where a user can select a Continent, Region, Country, City or Airport. I integrated mapbox to add markers to the map on selecting a location.
In case of Country and continent selection I would like to select the whole country/continent instead of just a marker.
I tried using the Mapbox Geocoding API like https://api.mapbox.com/geocoding/v5/mapbox.places/germany.json?types=country&access_token=**** but I noticed it only returns a 'Point' coordinates.
I would like to use a service where I provide the country/continent name and it returns a polygon with all the border coordinates in order to be able to highlight on the polygon on the map.
Does mapbox have a built-in service for such functionality? Or do I need to use a third-party service or json file?

while the Mapbox Geocoding API doesn't return the full polygon geometry for a feature, you can use the Geocoding API in combination with a few other open source data sources and tools.
Here's the beginnings of a workflow you could try out:
query the geocoding api with the text for the country name like "germany" and grab the lon,lat coordinates from the coordinates property of the API response.
use polygon data in geojson format from an open source like Natural Earth: https://www.naturalearthdata.com/downloads/
pass the coordinates and polygon data into this turf.js function: http://turfjs.org/docs/#booleanPointInPolygon
identify the polygon the point lies within and highlight those boundaries on the map. For more on how to use GL JS for the highlighting portion, check out the examples page: https://docs.mapbox.com/mapbox-gl-js/example/query-similar-features/

Related

Is there a way to get data from a PNG map to a GeoJSON

I have a map which was published in PNG format without its underlying data :
Map produced by the French Gov
I also have this GeoJson of every district in France.
Visualisation of GeoJson file
I need a file that would contain the content of the map in a format I can exploit (Shapefile, GeoJSON, TIFF, etc.). To do that I need to select the districts that are in each of the tiles.
Do you have any idea of a solution that would allow to use the GeoJSON as an overlay over the image to select the districts to put in each category ?
I have tried to georeference the image but that's about as far as I have succeeded.
Thank you

integrating road signs in Here maps

Hi I am new to React and Here maps, I am using Here maps for maps. Currently I am able to show live marker position, I want to show road signs as well.
For that I am constructing a request as specified here documentation
https://image.maps.ls.hereapi.com/mia/1.6/roadsign?apiKey=H6XyiCT0w1t9GgTjqhRXxDMrVj9h78ya3NuxlwM7XUs&region=USA&category=0&label=I-80&w=100&h=100&f=0
In the documentation , only highways signs are mentioned. Is it possible to query traffic,speed limit signs as well? And the response returns image(PNG) , I am thinking to put that image onto map at specific lat and long position. Is this the right way to do?
The roadsign feature of the Map Image API has a very limited selection of signs and is in maintenance. You will have to create or source these images yourself. Fortunately there are many free icon collections available on the web.
Once you have the images, you can use a MapMarker to place these on the map.

is there a way to create a zip code level Geo Map in Google Data Studio?

I'm using the Geo Map chart in Google Data Studio.
I'm able to plot data at the state and the city level but not at the zip code level. I'm getting a map with no data as well as the 'This map needs a valid geo dimension' error.
I've filtered all the zip codes to match bigquery-public-data.utility_us.zipcode_area.zipcode so it's not a data issue. I've also flagged the data as 'Postal Code' and 'Text' type but this is not resolving the issue.
Has anyone been able to plot a Geo Map at the zip code level?
I do not want to use Google Maps chart, I'd like to achieve this with the Geo Map chart.
Thanks

Datastudio Geomap Drilldown vs GoogleMap visualize issues

I was playing with DataStudio GeoMap and GoogleMap features, I used Covid US datased. I made some research what is best for showing charts via GeoMap & GoogleMap, I made report with 6 slides, each slide has Title with used method and I found below issues:
1) Drill down for GeoMap not working often, state/regions not showed,
2) in slide #2 GeoMap: used 3 Geo Dimension: Lat/Long, City, Region : how to show City names ? (and disable Latitude?)
Seems that best way is showing via GoogleMap (slide #6) with Bubble dimension :Lat/Long with Tooltip: City > then values are showing to Cities,
only issue is how to setup default zoom region US, to avoid showing whole world ?
Here is report:
https://datastudio.google.com/reporting/f0201b38-c2ae-400c-8ca0-d65d001c9e3a/page/DOdRB
One note: in My old report from today somehow I was able to create report with drill down 2-layer GeoMap, used Dimension: City+Region > not accurate, many cities are missing:
https://datastudio.google.com/u/0/reporting/a729972f-97ec-4faf-8311-a49719d0826c/page/TeaRB
Trying to import GoogleMap via embded frame, but I got this error>>
Google Maps cannot yet be displayed in embedded reports.
Question 1: Google Maps & Filters
Opened the Report above, exported the Google Maps data to Goggle Sheets, recreated a Data Source and Report, and then had a look through; it seems that the data in the City field is sorted, classifying values outside the United States as NA, in addition, removed 0,0 values in the Latitude_Longitude field, thus this Filter does the trick:
Exclude City RegExp Match (NA)
AND
Exclude Latitude_Longitude RegExp Match (0,0)
Editable Google Data Studio Report and GIF to demonstrate (Feel free to have a look through and edit the Report as required):
Question 2: Geo Maps & Drill-down
The updated Filter in Question 1 should do the trick when using the Geo Maps Chart Type, with all three Geo Types - Latitude_Longitude City and Region working as expected using the Drill-down and the Zoom area set to United States; adding an image of the Filter above for clarification:
Google Data Studio Report and a GIF to elaborate:
Question 3: Embedding Map Charts
Geo Maps can be displayed on embedded reports.
Currently, Google Maps won't appear in embedded reports.

Displaying house numbers with nokia map image API

Is there a way to display house numbers when using the Nokia Map Image API (the one for static maps)?
Currently the display of house numbers in an image is restricted to the Enterprise version of the Map Image API - this will display when the zoom level is 18 or greater.
On order to obtain enterprise access click on 'contact us' at the bottom of the plans page. Adding house numbers to the free public service is currently under consideration, but isn't available just yet.
Meanwhile, the best alternative would be to use the i parameter e.g. http://m.nok.it/?c=52.4998375,13.3924&nord&i&z=18 - this will geocode the address at the centre of the image.

Resources