Skip to content

Commit

Permalink
Azure Maps Elevation Java SDK (#31279)
Browse files Browse the repository at this point in the history
* Add Azure Maps Elevation Java SDK
  • Loading branch information
khmic5 authored Oct 13, 2022
1 parent b26cdc1 commit c23633a
Show file tree
Hide file tree
Showing 64 changed files with 5,406 additions and 0 deletions.
1 change: 1 addition & 0 deletions eng/versioning/version_client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ com.azure:azure-identity;1.6.1;1.7.0-beta.2
com.azure:azure-identity-perf;1.0.0-beta.1;1.0.0-beta.1
com.azure:azure-iot-deviceupdate;1.0.0;1.1.0-beta.1
com.azure:azure-iot-modelsrepository;1.0.0-beta.1;1.0.0-beta.2
com.azure:azure-maps-elevation;1.0.0-beta.1;1.0.0-beta.1
com.azure:azure-maps-timezone;1.0.0-beta.1;1.0.0-beta.1
com.azure:azure-maps-geolocation;1.0.0-beta.1;1.0.0-beta.1
com.azure:azure-maps-render;1.0.0-beta.1;1.0.0-beta.2
Expand Down
5 changes: 5 additions & 0 deletions sdk/maps/azure-maps-elevation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Release History

## 1.0.0-beta.1 (2022-10-11)

- This package contains the Azure Maps SDK Elevation client library for Java. Package tag 1.0.0-beta.1. For documentation on how to use this package, please see [Microsoft Azure SDK for Elevation SDK](https://docs.microsoft.com/rest/api/maps/elevation).
125 changes: 125 additions & 0 deletions sdk/maps/azure-maps-elevation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Azure Maps SDK Elevation client library for Java

Azure Maps SDK Elevation client library for Java.

This package contains the Azure Maps SDK Elevation client library which contains Azure Maps Elevation APIs. For documentation on how to use this package, please see [Azure Maps Elevation REST APIs](https://docs.microsoft.com/rest/api/maps/elevation).

[Source code][source] | [API reference documentation][docs] | [REST API documentation][rest_docs] | [Product documentation][product_docs] | [Samples][samples]

## Documentation

Various documentation is available to help you get started

- [API reference documentation][docs]

## Getting started

### Prerequisites

- [Java Development Kit (JDK)][jdk] with version 8 or above
- [Azure Subscription][azure_subscription]

### Adding the package to your product

[//]: # ({x-version-update-start;com.azure-maps-elevation;current})
```xml
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-maps-elevation</artifactId>
<version>1.0.0-beta.1</version>
</dependency>
```
[//]: # ({x-version-update-end})

### Include the recommended packages

Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client.

[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation.

### Authentication

By default, Azure Active Directory token authentication depends on correct configure of following environment variables.

- `AZURE_CLIENT_ID` for Azure client ID.
- `AZURE_TENANT_ID` for Azure tenant ID.
- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate.

In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`.

With above configuration, `azure` client can be authenticated by following code:

```java com.azure.maps.elevation.sync.builder.ad.instantiation
// Authenticates using Azure AD building a default credential
// This will look for AZURE_CLIENT_ID, AZURE_TENANT_ID, and AZURE_CLIENT_SECRET env variables
DefaultAzureCredential tokenCredential = new DefaultAzureCredentialBuilder().build();

// Creates a client
ElevationClient client = new ElevationClientBuilder()
.credential(tokenCredential)
.elevationClientId(System.getenv("MAPS_CLIENT_ID"))
.buildClient();
```

The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise.

See [Authentication][authenticate] for more options.

## Key concepts

See [API design][design] for general introduction on design and key concepts on Azure Management Libraries.

## Examples
Get Data For Points
```java com.azure.maps.elevation.sync.get_data_for_points
client.getDataForPoints(Arrays.asList(
new GeoPosition(-121.66853362143818, 46.84646479863713),
new GeoPosition(-121.68853362143818, 46.856464798637127)));
```

Get Data For Polyline
```java com.azure.maps.elevation.sync.get_data_for_polyline
client.getDataForPolyline(Arrays.asList(
new GeoPosition(-121.66853362143818, 46.84646479863713),
new GeoPosition(-121.65853362143818, 46.85646479863713)), 5);
```

Get Data For Bounding Box
```java com.azure.maps.elevation.sync.get_data_for_bounding_box
client.getDataForBoundingBox(new GeoBoundingBox(-121.668533621438, 46.8464647986371,
-121.658533621438, 46.8564647986371), 3, 3);
```

## Troubleshooting
When you interact with the Azure Maps Services, errors returned by the Maps service correspond to the same HTTP status codes returned for REST API requests.

For example, if you search with an invalid coordinate, a error is returned, indicating "Bad Request".400

## Next steps
Several Azure Maps Elevation Java SDK samples are available to you in the SDK's GitHub repository.
[Azure Maps Elevation Samples](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/maps/azure-maps-elevation/src/samples)

## Contributing

For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md).

1. Fork it
1. Create your feature branch (`git checkout -b my-new-feature`)
1. Commit your changes (`git commit -am 'Add some feature'`)
1. Push to the branch (`git push origin my-new-feature`)
1. Create new Pull Request

<!-- LINKS -->
[source]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/maps/azure-maps-elevation/src
[samples]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/maps/azure-maps-elevation/src/samples
[rest_docs]: https://docs.microsoft.com/rest/api/maps
[product_docs]: https://docs.microsoft.com/azure/azure-maps/
[docs]: https://azure.github.io/azure-sdk-for-java/
[jdk]: https://docs.microsoft.com/java/azure/jdk/
[azure_subscription]: https://azure.microsoft.com/free/
[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity
[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty
[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md
[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md

![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fmaps%2Fazure-maps-elevation%2FREADME.png)
35 changes: 35 additions & 0 deletions sdk/maps/azure-maps-elevation/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.

trigger:
branches:
include:
- main
- hotfix/*
- release/*
paths:
include:
- sdk/maps/azure-maps-elevation/
exclude:
- sdk/maps/azure-maps-elevation/pom.xml
pr:
branches:
include:
- main
- feature/*
- hotfix/*
- release/*
paths:
include:
- sdk/maps/azure-maps-elevation/

exclude:
- sdk/maps/azure-maps-elevation/pom.xml

extends:
template: /eng/pipelines/templates/stages/archetype-sdk-client.yml
parameters:
ServiceDirectory: maps
Artifacts:
- name: azure-maps-elevation
groupId: com.azure
safeName: azuremapselevation
104 changes: 104 additions & 0 deletions sdk/maps/azure-maps-elevation/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License. -->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<?m2e execute onConfiguration?>
<groupId>com.azure</groupId>
<artifactId>azure-client-sdk-parent</artifactId>
<version>1.7.0</version> <!-- {x-version-update;com.azure:azure-client-sdk-parent;current} -->
<relativePath>../../parents/azure-client-sdk-parent</relativePath>
</parent>

<groupId>com.azure</groupId>
<artifactId>azure-maps-elevation</artifactId>
<version>1.0.0-beta.1</version> <!-- {x-version-update;com.azure:azure-maps-elevation;current} -->
<packaging>jar</packaging>

<name>Azure Maps SDK Elevation client library</name>
<description>This package contains the Microsoft Azure SDK for Elevation SDK. For documentation on how to use this package, please see https://docs.microsoft.com/en-us/rest/api/maps/elevation. The Azure Maps Elevation API provides an HTTP interface to query elevation data on the surface of the Earth. Elevation data can be retrieved at specific locations by sending lat/lon coordinates, by defining an ordered set of vertices that form a Polyline and a number of sample points along the length of a Polyline, or by defining a bounding box that consists of equally spaced vertices as rows and columns. The vertical datum is EPSG:3855. This datum uses the EGM2008 geoid model applied to the WGS84 ellipsoid as its zero height reference surface. The vertical unit is measured in meters, the spatial resolution of the elevation data is 0.8 arc-second for global coverage (~24 meters). Package tag 1.0-preview.</description>
<url>https://github.com/Azure/azure-sdk-for-java</url>

<licenses>
<license>
<name>The MIT License (MIT)</name>
<url>http://opensource.org/licenses/MIT</url>
<distribution>repo</distribution>
</license>
</licenses>

<scm>
<url>https://github.com/Azure/azure-sdk-for-java</url>
<connection>scm:git:[email protected]:Azure/azure-sdk-for-java.git</connection>
<developerConnection>scm:git:[email protected]:Azure/azure-sdk-for-java.git</developerConnection>
<tag>HEAD</tag>
</scm>
<developers>
<developer>
<id>microsoft</id>
<name>Microsoft</name>
</developer>
</developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<legal><![CDATA[[INFO] Any downloads listed may be third party software. Microsoft grants you no rights for third party software.]]></legal>
<jacoco.min.linecoverage>0.4</jacoco.min.linecoverage>
<jacoco.min.branchcoverage>0.2</jacoco.min.branchcoverage>
</properties>
<dependencies>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
<version>1.33.0</version> <!-- {x-version-update;com.azure:azure-core;dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-netty</artifactId>
<version>1.12.6</version> <!-- {x-version-update;com.azure:azure-core-http-netty;dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-okhttp</artifactId>
<version>1.11.3</version> <!-- {x-version-update;com.azure:azure-core-http-okhttp;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.6.1</version> <!-- {x-version-update;com.azure:azure-identity;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.12.1</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.8.2</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-api;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.8.2</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-engine;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.8.2</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-params;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<version>3.4.23</version> <!-- {x-version-update;io.projectreactor:reactor-test;external_dependency} -->
<scope>test</scope>
</dependency>
</dependencies>
</project>
Loading

0 comments on commit c23633a

Please sign in to comment.