generated from api-platform/api-platform
-
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.
- Loading branch information
Stephane MEAUDRE
committed
Mar 26, 2024
1 parent
1627201
commit cd9caac
Showing
8 changed files
with
290 additions
and
185 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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,61 @@ | ||
interface Properties { | ||
name?: string | null, | ||
type?: string | null, | ||
mag?: number | null | ||
} | ||
interface Feature { | ||
type: string, | ||
geometry: Geometry, | ||
id: string | ||
properties: Properties | ||
} | ||
|
||
interface FeatureCollection { | ||
type?: string, | ||
features?: Feature[] | ||
} | ||
|
||
const geoJsonConstellation = (constellation: Constellation): FeatureCollection => { | ||
const feature: Feature = { | ||
id: constellation.id, | ||
type: "Feature", | ||
geometry: constellation.geometryLine, | ||
properties: { | ||
name: constellation.alt | ||
} | ||
} | ||
|
||
return { | ||
'type': 'FeatureCollection', | ||
'features': [ | ||
feature | ||
] | ||
} | ||
} | ||
|
||
const geoJsonDso = (dsos: Dso[]): FeatureCollection => { | ||
const features: Feature[] = dsos.map((dso: Dso): Feature => { | ||
return { | ||
type: 'feature', | ||
id: dso.id, | ||
geometry: dso.geometry, | ||
properties: { | ||
name: dso?.fullNameAlt, | ||
type: dso?.type, | ||
mag: dso?.magnitude | ||
} | ||
} | ||
}); | ||
|
||
return { | ||
'type': 'FeatureCollection', | ||
'features': features | ||
} | ||
} | ||
|
||
export const useGeoJsonServices = () => { | ||
return { | ||
geoJsonConstellation, | ||
geoJsonDso | ||
} | ||
} |
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
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