Skip to content

Commit

Permalink
feat(category-geo): add two new map styles 2022.10 (#11262)
Browse files Browse the repository at this point in the history
* Map Style Add

* Map Style Add
  • Loading branch information
dayjournal authored Nov 10, 2022
1 parent cf81078 commit 77a473e
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ describe('map style construction works as expected', () => {
"RasterEsriImagery",
"VectorHereBerlin",
"VectorHereExplore",
"VectorHereExploreTruck"
"VectorHereExploreTruck",
"RasterHereExploreSatellite",
"HybridHereExploreSatellite"
];

it('parses various supported map styles', () => {
Expand Down
20 changes: 17 additions & 3 deletions packages/amplify-category-geo/src/service-utils/mapParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export enum EsriMapStyleType {
export enum HereMapStyleType {
Berlin = "Berlin",
Explore = "Explore",
ExploreTruck = "ExploreTruck"
ExploreTruck = "ExploreTruck",
RasterSatellite = "RasterSatellite",
HybridSatellite = "HybridSatellite"
}

export type MapStyleType = EsriMapStyleType | HereMapStyleType;
Expand All @@ -44,7 +46,9 @@ export enum MapStyle {
RasterEsriImagery = "RasterEsriImagery",
VectorHereBerlin = "VectorHereBerlin",
VectorHereExplore = "VectorHereExplore",
VectorHereExploreTruck = "VectorHereExploreTruck"
VectorHereExploreTruck = "VectorHereExploreTruck",
RasterHereExploreSatellite = "RasterHereExploreSatellite",
HybridHereExploreSatellite = "HybridHereExploreSatellite"
}

/**
Expand All @@ -67,7 +71,13 @@ export const convertToCompleteMapParams = (partial: Partial<MapParameters>): Map
* Constructs the Amazon Location Map Style from available map parameters
*/
export const getGeoMapStyle = (dataProvider: DataProvider, mapStyleType: MapStyleType) => {
if (dataProvider === DataProvider.Here) {
if (dataProvider === DataProvider.Here && mapStyleType === HereMapStyleType.RasterSatellite) {
return MapStyle.RasterHereExploreSatellite;
}
else if (dataProvider === DataProvider.Here && mapStyleType === HereMapStyleType.HybridSatellite) {
return MapStyle.HybridHereExploreSatellite;
}
else if (dataProvider === DataProvider.Here) {
return `VectorHere${mapStyleType}`;
}
else if (dataProvider === DataProvider.Esri && mapStyleType === EsriMapStyleType.Imagery) {
Expand Down Expand Up @@ -99,6 +109,10 @@ export const getMapStyleComponents = (mapStyle: string): Pick<MapParameters, 'da
return { dataProvider: DataProvider.Here, mapStyleType: HereMapStyleType.Explore };
case MapStyle.VectorHereExploreTruck:
return { dataProvider: DataProvider.Here, mapStyleType: HereMapStyleType.ExploreTruck };
case MapStyle.RasterHereExploreSatellite:
return { dataProvider: DataProvider.Here, mapStyleType: HereMapStyleType.RasterSatellite };
case MapStyle.HybridHereExploreSatellite:
return { dataProvider: DataProvider.Here, mapStyleType: HereMapStyleType.HybridSatellite };
default:
throw new Error(`Invalid map style ${mapStyle}`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ export const mapStyleWalkthrough = async (parameters: Partial<MapParameters>): P
{ name: 'Berlin (data provided by HERE)', value: MapStyle.VectorHereBerlin },
{ name: 'Explore (data provided by HERE)', value: MapStyle.VectorHereExplore },
{ name: 'ExploreTruck (data provided by HERE)', value: MapStyle.VectorHereExploreTruck },
{ name: 'RasterSatellite (data provided by HERE)', value: MapStyle.RasterHereExploreSatellite },
{ name: 'HybridSatellite (data provided by HERE)', value: MapStyle.HybridHereExploreSatellite },
{ name: 'Topographic (data provided by Esri)', value: MapStyle.VectorEsriTopographic },
{ name: 'Navigation (data provided by Esri)', value: MapStyle.VectorEsriNavigation },
{ name: 'LightGrayCanvas (data provided by Esri)', value: MapStyle.VectorEsriLightGrayCanvas },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@
"RasterEsriImagery",
"VectorHereBerlin",
"VectorHereExplore",
"VectorHereExploreTruck"
"VectorHereExploreTruck",
"RasterHereExploreSatellite",
"HybridHereExploreSatellite"
],
"type": "string"
}
Expand Down
4 changes: 3 additions & 1 deletion packages/amplify-headless-interface/src/interface/geo/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,7 @@ export enum AccessType {
RasterEsriImagery = "RasterEsriImagery",
VectorHereBerlin = "VectorHereBerlin",
VectorHereExplore = "VectorHereExplore",
VectorHereExploreTruck = "VectorHereExploreTruck"
VectorHereExploreTruck = "VectorHereExploreTruck",
RasterHereExploreSatellite = "RasterHereExploreSatellite",
HybridHereExploreSatellite = "HybridHereExploreSatellite"
}

0 comments on commit 77a473e

Please sign in to comment.