build me a an interactive map , which let users select cities and shows flights surrounding that area use free api like
URL: https://opensky-network.org/api/states/all and for map use import maplibregl from "maplibre-gl";
import "maplibre-gl/dist/maplibre-gl.css"; and https://nominatim.openstreetmap.org/search?q=${encodeURIComponent(location)}&format=json&limit=1
,
basically maplibre and openstreetmap , minimalist colors for map like black and white
I'll create an interactive map that allows users to search for cities and view flights in the surrounding area using MapLibre GL and the OpenSky Network API.
This interactive flight map allows users to:
The map uses a minimalist black and white theme as requested, with:
You can extend this application by adding features like flight tracking history, filtering options, or additional data visualizations.
Ohh we will also need map tiler right ?
const darkMapStyle = {
version: 8,
sources: {
openmaptiles: {
type: "vector",
url: "https://api.maptiler.com/tiles/v3/tiles.json?key=kd1i2XYmnhBqIbOpdJlb",
},
},
layers: [
{
id: "background",
type: "background",
paint: { "background-color": "#0c1f3f
" },
},
{
id: "water",
type: "fill",
source: "openmaptiles",
"source-layer": "water",
paint: { "fill-color": "#1e3a5f
" },
},
{
id: "landcover",
type: "fill",
source: "openmaptiles",
"source-layer": "landcover",
paint: { "fill-color": "#162b4d
" },
},
{
id: "landuse",
type: "fill",
source: "openmaptiles",
"source-layer": "landuse",
paint: { "fill-color": "#1c3358
" },
},
{
id: "road",
type: "line",
source: "openmaptiles",
"source-layer": "transportation",
paint: {
"line-color": "#2c4c7c
",
"line-width": 1,
},
},
{
id: "building",
type: "fill",
source: "openmaptiles",
"source-layer": "building",
paint: { "fill-color": "#1e3a5f
" },
},
],
} as maplibregl.StyleSpecification;
You can modify colors according to our project
You're right! Let's update the map to use MapTiler for a better-looking minimalist black and white theme. I'll modify the code to incorporate the MapTiler configuration with adjusted colors to match our minimalist black and white aesthetic.
I've updated the flight map to use MapTiler instead of the basic OpenStreetMap tiles. The new map features:
Enhanced Map Details: The MapTiler integration provides better rendering of:
Improved Flight Markers: I've adjusted the flight markers to ensure they stand out against the new map background, with:
The MapTiler integration provides a much more polished and professional look while maintaining the minimalist black and white aesthetic you requested. The vector tiles from MapTiler also offer better performance and smoother zooming compared to the raster tiles we were using before.
All the other functionality remains the same - users can still search for cities, view nearby flights, and get detailed information about each aircraft.
Would you like me to make any additional adjustments to the map style or other aspects of the application?
The code returns the following error:
Error: layers[8].layout.text-field: use of "text-field" requires a style "glyphs" property
at Object.ao [as x] (maplibre-gl)
at nn (maplibre-gl)
at hs._load (maplibre-gl)
at (maplibre-gl)
Revise the code to address the error.