generated from amosproj/amos202Xss0Y-projname
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrated new states and map markers (#141)
- Loading branch information
Showing
7 changed files
with
224 additions
and
33 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { FeatureCollection, Geometry } from "geojson"; | ||
import data from "./FeatureCollection.json"; | ||
import { LatLngBounds } from "leaflet"; | ||
import { useEffect, useState } from "react"; | ||
const geojsonData: FeatureCollection = data as FeatureCollection; | ||
|
||
const useGeoData = ( | ||
bounds: LatLngBounds, | ||
zoom: number | ||
): FeatureCollection<Geometry> | undefined => { | ||
const [data, setData] = useState<FeatureCollection<Geometry>>(); | ||
|
||
useEffect(() => { | ||
/* eslint-disable */ const fetchData = async (_bounds: LatLngBounds) => { | ||
/* eslint-enable */ | ||
// Uncomment and adjust the following lines to fetch data from an API | ||
// const url = `https://example.com/api/geo?bounds=${bounds.toBBoxString()}&zoom=${zoom}`; | ||
// const response = await fetch(url); | ||
// const result = await response.json(); | ||
setData(geojsonData as FeatureCollection<Geometry>); | ||
}; | ||
|
||
fetchData(bounds); | ||
console.log( | ||
`Data fetched for bounds: ${bounds.toBBoxString()} and zoom: ${zoom}` | ||
); | ||
}, [bounds, zoom]); | ||
|
||
return data; | ||
}; | ||
|
||
export default useGeoData; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
{ | ||
"type": "FeatureCollection", | ||
"features": [ | ||
{ | ||
"type": "Feature", | ||
"properties": { | ||
"name": "Berlin", | ||
"amenity": "Capital City", | ||
"popupContent": "This is Berlin, the capital of Germany!" | ||
}, | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [13.4050, 52.5200] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"properties": { | ||
"name": "Munich", | ||
"amenity": "City", | ||
"popupContent": "This is Munich, known for Oktoberfest!" | ||
}, | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [11.5820, 48.1351] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"properties": { | ||
"name": "Hamburg", | ||
"amenity": "City", | ||
"popupContent": "This is Hamburg, a major port city in northern Germany!" | ||
}, | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [9.9937, 53.5511] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"properties": { | ||
"name": "Frankfurt", | ||
"amenity": "City", | ||
"popupContent": "This is Frankfurt, a major financial hub in Germany!" | ||
}, | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [8.6821, 50.1109] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"properties": { | ||
"name": "Dortmund", | ||
"amenity": "City", | ||
"popupContent": "This is Dortmund, known for its football team!" | ||
}, | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [7.4660, 51.5149] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"properties": { | ||
"name": "Cologne", | ||
"amenity": "City", | ||
"popupContent": "This is Cologne, known for its impressive cathedral!" | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"properties": { | ||
"name": "Leipzig", | ||
"amenity": "City", | ||
"popupContent": "This is Leipzig, known for its vibrant cultural scene!" | ||
}, | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [12.3731, 51.3397] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"properties": { | ||
"name": "Hannover", | ||
"amenity": "City", | ||
"popupContent": "This is Hannover, known for its trade fairs!" | ||
}, | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [9.7320, 52.3759] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"properties": { | ||
"name": "Würzburg", | ||
"amenity": "City", | ||
"popupContent": "This is Würzburg, known for its baroque and rococo architecture!" | ||
}, | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [9.9937, 49.7945] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"properties": { | ||
"name": "Augsburg", | ||
"amenity": "City", | ||
"popupContent": "This is Augsburg, one of Germany's oldest cities!" | ||
}, | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [10.8983, 48.3715] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.