What does this solution do?
This Solution Architecture provides an easy-to-use template to tag your content with location context, store it, and then retrieve it based on end-user searches.
Digital content libraries from photos to social media posts are enormous and growing larger every day, making it impossible for users to find and retrieve the content they need quickly. Location is a common way that people search for content, whether they are looking for photos based on where they were taken, or searching an evidence library for documents found at a scene.
Users searching for content “near me” has increased by 150% year-on-year, and companies - from social networks to news outlets - find that they can increase user engagement by enabling users to interact with posts or articles based on where that content is located.
This template provides an easy-to-deploy solution that solves the common steps needed to search and tag by location:
- Search geotagged content by place name: Show me all photos of San Francisco.
- Label content with the place it was created to increase user engagement: Posted from Shibuya, Tokyo at 300m elevation.
- Put documents on the map and in a hierarchy: This piece of evidence is about 50 Main Street, San Francisco, CA, USA.
This three-part architecture allows you to tag, store, and retrieve content using location. It does this by adding human-readable and searchable geographic labels to place-based content, combined with a way to search and display those labels.
The three components include: a NodeJS API layer to simplify queries and perform content tagging, an Elasticsearch backend for storage and indexing, and a UI for searching and rendering geotagged images. The UI is configured to support the upload, tagging, and search of JPEG images that have location embedded in their EXIF metadata. The ingest endpoint supports indexing any type of content with coordinates, from videos to pdfs to social media posts.
Part one: Tag content
The first part of the architecture is a NodeJS API server. The upload endpoint supports the direct upload of JPEG images with embedded location, which are tagged and stored. All submitted content is augmented with location hierarchy by the Mapbox Geocoding API, and with elevation in meters by querying Mapbox Terrain RGB. Elasticsearch then indexes the content, along with its metadata.
You can augment this tagging in a few ways:
- Tag content using custom geometry like regions or service areas using the Mapbox Tilequery API.
- Put text documents on the map - tag location extracted from text documents like news articles or ancestral records using forward geocoding.
Part two: Storing content
The second part of the architecture is an Elasticsearch backend that handles the indexing of content along with metadata. Elasticsearch is a search engine that enables flexible querying using wildcard full-text search.
Component three: Retrieving content
The third part is a UI client that allows you to upload images and search for tagged content using wildcard text queries. It consists of several components: an image uploader, a search bar, and an image renderer. The search bar passes queries to the search API endpoint and passes the results back to be rendered as a list of images labeled with location and elevation.
What you’ll need:
- Current Mapbox account and valid token: You will need a public token with access to the Mapbox Permanent Geocoding API. If you don’t have access to the endpoint for permanent geocoding, contact Mapbox sales.
- Elasticsearch installed locally via Docker (included below) or configured with a cloud provider such as Elastic.co or AWS
You will be consuming services from Mapbox and Elastic. You are responsible for any associated costs.
- Mapbox usage
Each message ingested into the pipeline will make a call to the Geocoding and Raster Tiles API. Permanent geocodes are required for this solution to run. To enable these on your account, please reach out to Mapbox sales by clicking here.
- Elasticsearch usage
There is no charge for running Elasticsearch in a local Docker container.
For more Mapbox pricing details, consult our pricing documentation.