Skip to content

Commit

Permalink
feat(client-location): Amazon Location Service now allows circular ge…
Browse files Browse the repository at this point in the history
…ofences in BatchPutGeofence, PutGeofence, and GetGeofence APIs.
  • Loading branch information
awstools committed Aug 9, 2022
1 parent 928a5b6 commit c4ac25d
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 26 deletions.
2 changes: 1 addition & 1 deletion clients/client-location/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

AWS SDK for JavaScript Location Client for Node.js, Browser and React Native.

Suite of geospatial services including Maps, Places, Routes, Tracking, and Geofencing
<p>"Suite of geospatial services including Maps, Places, Routes, Tracking, and Geofencing"</p>

## Installing

Expand Down
6 changes: 5 additions & 1 deletion clients/client-location/src/Location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ import {
import { LocationClient } from "./LocationClient";

/**
* Suite of geospatial services including Maps, Places, Routes, Tracking, and Geofencing
* <p>"Suite of geospatial services including Maps, Places, Routes, Tracking, and Geofencing"</p>
*/
export class Location extends LocationClient {
/**
Expand Down Expand Up @@ -540,6 +540,10 @@ export class Location extends LocationClient {
* the routes. This also lets you specify additional route preferences in
* <code>CarModeOptions</code> if traveling by <code>Car</code>, or
* <code>TruckModeOptions</code> if traveling by <code>Truck</code>.</p>
* <note>
* <p>If you specify <code>walking</code> for the travel mode and your data
* provider is Esri, the start and destination must be within 40km.</p>
* </note>
* </li>
* </ul>
*/
Expand Down
2 changes: 1 addition & 1 deletion clients/client-location/src/LocationClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ type LocationClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHand
export interface LocationClientResolvedConfig extends LocationClientResolvedConfigType {}

/**
* Suite of geospatial services including Maps, Places, Routes, Tracking, and Geofencing
* <p>"Suite of geospatial services including Maps, Places, Routes, Tracking, and Geofencing"</p>
*/
export class LocationClient extends __Client<
__HttpHandlerOptions,
Expand Down
4 changes: 4 additions & 0 deletions clients/client-location/src/commands/CalculateRouteCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ export interface CalculateRouteCommandOutput extends CalculateRouteResponse, __M
* the routes. This also lets you specify additional route preferences in
* <code>CarModeOptions</code> if traveling by <code>Car</code>, or
* <code>TruckModeOptions</code> if traveling by <code>Truck</code>.</p>
* <note>
* <p>If you specify <code>walking</code> for the travel mode and your data
* provider is Esri, the start and destination must be within 40km.</p>
* </note>
* </li>
* </ul>
* @example
Expand Down
77 changes: 68 additions & 9 deletions clients/client-location/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,27 @@ export interface BatchGetDevicePositionResponse {
DevicePositions: DevicePosition[] | undefined;
}

/**
* <p>A circle on the earth, as defined by a center point and a radius.</p>
*/
export interface Circle {
/**
* <p>A single point geometry, specifying the center of the circle, using <a href="https://gisgeography.com/wgs84-world-geodetic-system/">WGS 84</a>
* coordinates, in the form <code>[longitude, latitude]</code>.</p>
*/
Center: number[] | undefined;

/**
* <p>The radius of the circle in meters. Must be greater than zero and no
* larger than 100,000 (100 kilometers).</p>
*/
Radius: number | undefined;
}

/**
* <p>Contains the geofence geometry details.</p>
* <p>A geofence geometry is made up of either a polygon or a circle. Can be either a
* polygon or a circle. Including both will return a validation error.</p>
* <note>
* <p>Amazon Location doesn't currently support polygons with holes, multipolygons, polygons
* that are wound clockwise, or that cross the antimeridian. </p>
Expand All @@ -507,8 +526,14 @@ export interface GeofenceGeometry {
* list their vertices in counter-clockwise order around the ring's center, where the left
* side is the polygon's exterior. Inner rings must list their vertices in clockwise order,
* where the left side is the polygon's interior.</p>
* <p>A geofence polygon can consist of between 4 and 1,000 vertices.</p>
*/
Polygon?: number[][][];

/**
* <p>A circle on the earth, as defined by a center point and a radius.</p>
*/
Circle?: Circle;
}

/**
Expand All @@ -521,9 +546,11 @@ export interface BatchPutGeofenceRequestEntry {
GeofenceId: string | undefined;

/**
* <p>Contains the polygon details to specify the position of the geofence.</p>
* <p>Contains the details of the position of the geofence. Can be either a
* polygon or a circle. Including both will return a validation error.</p>
* <note>
* <p>Each <a href="https://docs.aws.amazon.com/location-geofences/latest/APIReference/API_GeofenceGeometry.html">geofence polygon</a> can have a maximum of 1,000 vertices.</p>
* <p>Each <a href="https://docs.aws.amazon.com/location-geofences/latest/APIReference/API_GeofenceGeometry.html">
* geofence polygon</a> can have a maximum of 1,000 vertices.</p>
* </note>
*/
Geometry: GeofenceGeometry | undefined;
Expand Down Expand Up @@ -679,6 +706,11 @@ export interface TruckDimensions {
* <p>For example, <code>15.5</code>.</p>
* </li>
* </ul>
* <note>
* <p>
* For routes calculated with a HERE resource, this value must be between 0 and 300 meters.
* </p>
* </note>
*/
Length?: number;

Expand All @@ -689,6 +721,11 @@ export interface TruckDimensions {
* <p>For example, <code>4.5</code>.</p>
* </li>
* </ul>
* <note>
* <p>
* For routes calculated with a HERE resource, this value must be between 0 and 50 meters.
* </p>
* </note>
*/
Height?: number;

Expand All @@ -699,6 +736,11 @@ export interface TruckDimensions {
* <p>For example, <code>4.5</code>.</p>
* </li>
* </ul>
* <note>
* <p>
* For routes calculated with a HERE resource, this value must be between 0 and 50 meters.
* </p>
* </note>
*/
Width?: number;

Expand Down Expand Up @@ -847,7 +889,8 @@ export interface CalculateRouteRequest {

/**
* <p>Specifies the mode of transport when calculating a route. Used in estimating the speed
* of travel and road compatibility.</p>
* of travel and road compatibility. You can choose <code>Car</code>, <code>Truck</code>,
* or <code>Walking</code> as options for the <code>TravelMode</code>.</p>
* <p>The <code>TravelMode</code> you specify also determines how you specify route
* preferences: </p>
* <ul>
Expand Down Expand Up @@ -1639,7 +1682,7 @@ export interface MapConfiguration {
* <ul>
* <li>
* <p>
* <code>VectorHereBerlin</code> – The HERE Berlin map style is a high contrast
* <code>VectorHereContrast</code> – The HERE Contrast (Berlin) map style is a high contrast
* detailed base map of the world that blends 3D and 2D rendering.</p>
* </li>
* <li>
Expand All @@ -1656,6 +1699,11 @@ export interface MapConfiguration {
* within transport and logistics.</p>
* </li>
* </ul>
* <note>
* <p>The <code>VectorHereContrast</code> style has been renamed from <code>VectorHereBerlin</code>.
* <code>VectorHereBerlin</code> has been deprecated, but will continue to work in
* applications that use it.</p>
* </note>
*/
Style: string | undefined;
}
Expand Down Expand Up @@ -2738,7 +2786,7 @@ export interface GetGeofenceResponse {
GeofenceId: string | undefined;

/**
* <p>Contains the geofence geometry details describing a polygon.</p>
* <p>Contains the geofence geometry details describing a polygon or a circle.</p>
*/
Geometry: GeofenceGeometry | undefined;

Expand Down Expand Up @@ -2892,7 +2940,7 @@ export interface ListGeofenceResponseEntry {
GeofenceId: string | undefined;

/**
* <p>Contains the geofence geometry details describing a polygon.</p>
* <p>Contains the geofence geometry details describing a polygon or a circle.</p>
*/
Geometry: GeofenceGeometry | undefined;

Expand Down Expand Up @@ -2966,9 +3014,11 @@ export interface PutGeofenceRequest {
GeofenceId: string | undefined;

/**
* <p>Contains the polygon details to specify the position of the geofence.</p>
* <p>Contains the details to specify the position of the geofence. Can be either a
* polygon or a circle. Including both will return a validation error.</p>
* <note>
* <p>Each <a href="https://docs.aws.amazon.com/location-geofences/latest/APIReference/API_GeofenceGeometry.html">geofence polygon</a> can have a maximum of 1,000 vertices.</p>
* <p>Each <a href="https://docs.aws.amazon.com/location-geofences/latest/APIReference/API_GeofenceGeometry.html">
* geofence polygon</a> can have a maximum of 1,000 vertices.</p>
* </note>
*/
Geometry: GeofenceGeometry | undefined;
Expand Down Expand Up @@ -3205,7 +3255,7 @@ export interface GetMapGlyphsRequest {
* <p>Valid font stacks for <a href="https://docs.aws.amazon.com/location/latest/developerguide/HERE.html">HERE Technologies</a> styles: </p>
* <ul>
* <li>
* <p>VectorHereBerlin – <code>Fira
* <p>VectorHereContrast – <code>Fira
* GO Regular</code> | <code>Fira GO Bold</code>
* </p>
* </li>
Expand Down Expand Up @@ -4754,12 +4804,21 @@ export const BatchGetDevicePositionResponseFilterSensitiveLog = (obj: BatchGetDe
}),
});

/**
* @internal
*/
export const CircleFilterSensitiveLog = (obj: Circle): any => ({
...obj,
...(obj.Center && { Center: SENSITIVE_STRING }),
});

/**
* @internal
*/
export const GeofenceGeometryFilterSensitiveLog = (obj: GeofenceGeometry): any => ({
...obj,
...(obj.Polygon && { Polygon: obj.Polygon.map((item) => SENSITIVE_STRING) }),
...(obj.Circle && { Circle: SENSITIVE_STRING }),
});

/**
Expand Down
17 changes: 17 additions & 0 deletions clients/client-location/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ import {
CalculateRouteMatrixSummary,
CalculateRouteSummary,
CalculateRouteTruckModeOptions,
Circle,
ConflictException,
DataSourceConfiguration,
DevicePosition,
Expand Down Expand Up @@ -5221,6 +5222,13 @@ const serializeAws_restJson1CalculateRouteTruckModeOptions = (
};
};

const serializeAws_restJson1Circle = (input: Circle, context: __SerdeContext): any => {
return {
...(input.Center != null && { Center: serializeAws_restJson1Position(input.Center, context) }),
...(input.Radius != null && { Radius: __serializeFloat(input.Radius) }),
};
};

const serializeAws_restJson1CountryCodeList = (input: string[], context: __SerdeContext): any => {
return input
.filter((e: any) => e != null)
Expand Down Expand Up @@ -5271,6 +5279,7 @@ const serializeAws_restJson1DevicePositionUpdateList = (

const serializeAws_restJson1GeofenceGeometry = (input: GeofenceGeometry, context: __SerdeContext): any => {
return {
...(input.Circle != null && { Circle: serializeAws_restJson1Circle(input.Circle, context) }),
...(input.Polygon != null && { Polygon: serializeAws_restJson1LinearRings(input.Polygon, context) }),
};
};
Expand Down Expand Up @@ -5603,6 +5612,13 @@ const deserializeAws_restJson1CalculateRouteSummary = (output: any, context: __S
} as any;
};

const deserializeAws_restJson1Circle = (output: any, context: __SerdeContext): Circle => {
return {
Center: output.Center != null ? deserializeAws_restJson1Position(output.Center, context) : undefined,
Radius: __limitedParseDouble(output.Radius),
} as any;
};

const deserializeAws_restJson1CountryCodeList = (output: any, context: __SerdeContext): string[] => {
const retVal = (output || [])
.filter((e: any) => e != null)
Expand Down Expand Up @@ -5654,6 +5670,7 @@ const deserializeAws_restJson1DevicePositionList = (output: any, context: __Serd

const deserializeAws_restJson1GeofenceGeometry = (output: any, context: __SerdeContext): GeofenceGeometry => {
return {
Circle: output.Circle != null ? deserializeAws_restJson1Circle(output.Circle, context) : undefined,
Polygon: output.Polygon != null ? deserializeAws_restJson1LinearRings(output.Polygon, context) : undefined,
} as any;
};
Expand Down
Loading

0 comments on commit c4ac25d

Please sign in to comment.