npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

thinkgeocloudclient-js

v1.0.0-beta037

Published

A JavaScript library for ThinkGeo Cloud Server.

Downloads

126

Readme

ThinkGeoCloudClient.js

ThinkGeoCloudClient.js is an open-source JavaScript SDK you can use to interact with the ThinkGeo Cloud, a collection of web-based GIS services that include map tiles, geocoding and reverse geocoding, elevation and more. It simplifies the process of calling ThinkGeo Cloud web APIs from your applications.

Demos

Creating a Basic Web Application with ThinkGeoCloudClient.js

In this walkthrough, you will learn how to create a basic web application with ThinkGeoCloudClient.js. You should have some familiarity with HTML/CSS and JavaScript, but the source code is provided. Any operating system or text editor will work, but you will need an Internet connection while you are working. You'll also need a ThinkGeo Cloud account and an API key to access the ThinkGeo Cloud APIs -- you can get started for free.

Step 1: Create an API Key

Your ThinkGeo Cloud account comes with a pregenerated API key you can use right away, or you can create your own keys by following these guidelines. For general help with the service, see the the ThinkGeo Cloud wiki.

Step 2: Create an HTML Page

We'll start creating a simple sample web application by creating an HTML page.

Start your favorite text editor with a blank HTML document e.g. index.html. Copy and paste the following HTML into it:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>My Cloud Service Sample</title>
  </head>
  <body>
    <div id="response"></div>
  </body>
</html>

The most notable element here is the <div id="response"></div>, which we'll use to display the response we get from the ThinkGeo Cloud.

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>My Cloud Service Sample</title>
  </head>
  <body>
    <div id="response"></div>
  </body>
</html>

Step 3: Add a Reference to the ThinkGeoCloudClient.js Library

To get started using ThinkGeoCloudClient.js, you need to reference the JavaScript library in the <head> section of your HTML page. Both NPM and ThinkGeo's CDN provide a minified version, which is a compressed file that improves performance.

CDN

Reference the library directly from ThinkGeo's CDN:

<!-- Latest minified version of ThinkGeoCloudClient.js -->
<script src="https://cdn.thinkgeo.com/cloudclient-js/1.0.4/thinkgeocloudclient.js"></script>

NPM

First, install the ThinkGeoCloudClient package:

npm i thinkgeocloudclient-js

Next, include it in your HTML page:

<!-- Latest minified version of ThinkGeoCloudClient.js -->
<script src="path/to/lib/thinkgeocloudclient.js"></script>

Step 4: Make a ThinkGeo Cloud Request

At the bottom of your HTML page, add a JavaScript section with the following code. As a demonstration, this will make a request to the ThinkGeo Cloud Reverse Geocoding service to find points of interest near a specified latitude/longitude coordinate. The results will be displayed on your HTML page.

let reverseGeocodingClient = new tg.ReverseGeocodingClient('Your-Cloud-Service-Api-Key');

// Find the ThinkGeo office address by coordinate
reverseGeocodingClient.searchPlaceByPoint(33.128367, -96.809847, function (status, response) {

    if (response.data.bestMatchLocation) {
       let address = response.data.bestMatchLocation.data.address;

       document.getElementById('response').innerHTML = address;
    }
})