SDKs overview

The Hong Kong GeoData Store provides access to geospatial data for Hong Kong, primarily through its Geocoding API and Map API. Unlike some platforms that offer dedicated, language-specific Software Development Kits (SDKs), Hong Kong GeoData Store emphasizes an API-first approach. This means that direct integration is typically performed by making HTTP requests to the RESTful endpoints, as detailed in the Hong Kong GeoData Store Geocoding API specification.

Developers integrate by sending structured requests and parsing JSON responses. For common programming languages, standard HTTP client libraries are used to interact with the API. While there are no officially published SDKs in the traditional sense (e.g., installable packages for Python, Java, or Ruby), the official documentation provides examples that illustrate API usage patterns, particularly for JavaScript within web applications. Community contributions and general-purpose HTTP libraries serve as the de facto method for integration across various development environments.

The API is designed to convert Hong Kong addresses into geographical coordinates (geocoding) and vice-versa (reverse geocoding), and to display map data. The Hong Kong GeoData Store homepage emphasizes ease of use and accessibility for developers building applications that require precise location data within Hong Kong. The platform is free to use for both non-commercial and commercial purposes, subject to its published terms and conditions.

Official SDKs by language

The Hong Kong GeoData Store does not currently offer officially maintained, language-specific SDKs (Software Development Kits) as installable packages. Instead, integration is conducted directly via its RESTful API endpoints. This approach provides flexibility for developers to use any programming language or framework capable of making HTTP requests. The official documentation for the Hong Kong GeoData Store Geocoding API provides detailed specifications for request formats, parameters, and response structures, primarily using JSON.

Developers are expected to use generic HTTP client libraries available in their chosen programming language to interact with the API. For example, in JavaScript, the built-in fetch() API or libraries like Axios can be used. In Python, libraries such as requests are common. This API-first strategy aligns with common web service integration practices, allowing for broad compatibility without requiring specific SDK maintenance overhead for various programming languages.

Comparison of Official SDKs

Given the API-first strategy, there are no official SDK packages to compare. The interaction model is uniform across all languages: make an HTTP request to a specified endpoint with appropriate parameters and an API key if required, and process the JSON response.

Language Package/Approach Install Command/Method Maturity
JavaScript Direct API via fetch or Axios npm install axios (for Axios) or built-in browser API Stable (API is stable)
Python Direct API via requests pip install requests Stable (API is stable)
Java Direct API via OkHttp or Java's HttpClient Add dependency (e.g., Maven/Gradle for OkHttp) Stable (API is stable)
C# Direct API via HttpClient Built-in .NET library Stable (API is stable)

Installation

Since the Hong Kong GeoData Store operates on an API-first model without dedicated SDKs, installation involves setting up an HTTP client in your preferred programming language. The method varies based on the language and environment.

JavaScript (Browser/Node.js)

For web browsers, the native Fetch API is available without any installation. For Node.js environments or if you prefer a more feature-rich HTTP client in the browser, Axios is a common choice.

# For Node.js or bundlers like Webpack/Vite
npm install axios
# or
yarn add axios

Python

The requests library is the de facto standard for making HTTP requests in Python.

pip install requests

Java

For Java, popular choices include OkHttp or the built-in HttpClient introduced in Java 11. If using Maven, add OkHttp as a dependency:

<dependency>
    <groupId>com.squareup.okhttp3</groupId>
    <artifactId>okhttp</artifactId>
    <version>4.12.0</version>
</dependency>

C# (.NET)

The .NET framework includes the HttpClient class for making HTTP requests, which requires no additional installation.

Quickstart example

This example demonstrates how to perform a geocoding request to the Hong Kong GeoData Store Geocoding API using JavaScript in a web browser. The goal is to convert an address string into geographical coordinates.

JavaScript Example (Browser)

This snippet uses the native fetch API to make a GET request to the GeoData Store Geocoding API. Replace YOUR_ADDRESS_QUERY with the actual Hong Kong address you wish to geocode. No API key is typically required for public access to the Hong Kong GeoData Store APIs, but always refer to the official Geocoding API documentation for the most current requirements and usage policies.

async function geocodeAddress(address) {
  const encodedAddress = encodeURIComponent(address);
  // The base URL and parameter structure are based on GeoData Store's Geocoding API spec.
  // Example URL structure from documentation: https://www.geodata.gov.hk/gs/api/v1.0.0/geocode
  const apiUrl = `https://www.geodata.gov.hk/gs/api/v1.0.0/geocode?q=${encodedAddress}`;

  try {
    const response = await fetch(apiUrl);

    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }

    const data = await response.json();
    console.log('Geocoding Result:', data);

    // Example of accessing coordinates from the response structure
    if (data && data.results && data.results.length > 0) {
      const firstResult = data.results[0];
      console.log('Latitude:', firstResult.latitude);
      console.log('Longitude:', firstResult.longitude);
    } else {
      console.log('No geocoding results found.');
    }

  } catch (error) {
    console.error('Error during geocoding:', error);
  }
}

// Call the function with an example Hong Kong address
geocodeAddress('1 Expo Dr, Wan Chai, Hong Kong');

This code performs the following steps:

  1. Defines an asynchronous function geocodeAddress that takes an address string.
  2. Encodes the address to ensure it's URL-safe.
  3. Constructs the API URL, appending the encoded address as a query parameter.
  4. Uses fetch to send a GET request to the API endpoint.
  5. Checks if the HTTP response was successful.
  6. Parses the JSON response.
  7. Logs the full response and extracts latitude and longitude from the first result if available.
  8. Includes error handling for network issues or API errors.

Community libraries

While Hong Kong GeoData Store does not publish official language-specific SDKs, the developer community often creates libraries or wrappers to simplify interaction with RESTful APIs. For the Hong Kong GeoData Store, such community efforts would typically focus on abstracting the HTTP request details and simplifying data parsing.

As of late 2026, there is no widely recognized, officially endorsed community SDK specifically for the Hong Kong GeoData Store API. Developers commonly rely on general-purpose HTTP client libraries (e.g., axios for JavaScript, requests for Python, OkHttp for Java) to interact with the API. These libraries provide a robust and well-documented foundation for making web requests in various programming languages, as outlined by resources such as the Mozilla Developer Network's HTTP overview.

Developers interested in contributing to or finding community-driven abstractions for the Hong Kong GeoData Store API could explore platforms like GitHub, searching for repositories that reference the API endpoints (e.g., geodata.gov.hk/gs/api). Such libraries would typically be open-source and maintained independently by their creators. When using community-contributed code, it is advisable to review its source, documentation, and maintenance status to ensure it meets project requirements for reliability and security.

For example, a community library might provide helper functions like hkGeocode(address) that internally handle URL construction, HTTP requests, and JSON parsing, returning a simplified object containing coordinates. However, without official endorsement, the stability, feature completeness, and long-term support of such libraries can vary.

Given the straightforward nature of the Hong Kong GeoData Store's RESTful API, many developers may find that direct use of standard HTTP client libraries is sufficient without the need for an additional abstraction layer provided by a dedicated SDK or community wrapper.