/locately

a pocket atlas for your browser! locately is a project for Hack the Map 5.

Primary LanguageJupyter Notebook

locately

a pocket atlas for your browser

👋 Hey, Hack the Map 5 Judges!

Welcome to locately. If you haven't installed it yet, you can find instructions here: https://esrips.github.io/locately.

If you're looking to pop the hood and see how locately works, here's a quick overview with some helpful links to source code.

On the frontend...

The user interface of locately is implemented as a browser extension (just supporting Chrome for now). Once installed by an end-user, it works right out-of-the-box thanks to some default settings, allows end-users to set their own preferences, and does some pretty interesting things with the DOM, including traversing all elements to find text, reacting to DOM updates via the MutationObserver API.

The page's text is sent to the backend for some natural language processing (NLP) goodness (more on that later), then returned as recognized place entities. The extension takes over again and matches all these entities with the DOM nodes where they're mentioned, adds some styling to alert users they've been recognized, and waits for user interaction. Finally, when a user interacts with a locately place, the extension talks to Wikipedia and ArcGIS Platform (see below) and constructs a beautiful popover with relevant information.

The backend is pretty rad, too...

Once the backend receives text, it uses the SpaCy library to execute NLP. NLP is a form of deep learning that understands linguistic context and dependencies between words to split text into meaningful tokens, and then names them as real-world objects (e.g., person, date, or place). The trained model leveraged by the backend has learned from conversational phone speech, news articles, blogs and more to complete this task.

From the collection of meaningful tokens identified, just the location-types are isolated. The location tokens are then supplemented with additional spatial information. The ArcGIS Python API is used to Geocode and match location entities with geographic keywords that can be used as inputs to the Geoenrichment API.

Enter ArcGIS Platform...

TL;DR: locately uses the following ArcGIS Platform services, APIs, and tools:

locately uses ArcGIS Platform in a few distinct ways:

  1. After the backend runs the NLP to identify place entities, it uses the Geocoding service to gather more details [view code]

  2. Back on the frontend, the browser extension uses both the Standard geography query and Enrich tasks from the GeoEnrichment service in order to fetch data variables for displaying to the end user. All the heavy lifting here is done by one of our favorite ArcGIS Platform APIs, ArcGIS REST JS. [view code]

  3. Finally, the map users see in the locately popover is built with another ArcGIS Platform API, the ArcGIS API for JavaScript. The JSAPI leverages the geometry returned by the GeoEnrichment service as well as ArcGIS Platform's basemap layer service to show a contextual map to users. Users can even click the map to go directly to that place in the Map Viewer! [view code]

Solution Overview

locately solution overview

Roadmap

locately roadmap