Code Monkey home page Code Monkey logo

mapatlapi's Introduction

About MapATL

MapATL is a web service provided by the City of Atlanta. Users may enter a street address and recieve information about the area, such as council district, nearby parks, transport, tax and emergency services. The service is useful, but lacks an API.

MapAtlApi

This repository provides an (unofficial) API to MapATL. It has three aspects:

CLI

The CLI exposes the API as commandline arguments. For example:

docker run abriedev/mapatlapi to see the help screen.

  1. docker run abriedev/mapatlapi geocoder -address="55 Trinity Ave SW" returns JSON with candidate Ref_IDs.
  2. docker run abriedev/mapatlapi location -id=490131 Uses Ref_ID to retrieve the location.
  3. docker run abriedev/mapatlapi places -id=490131 -category=PL_PARKS Returns parks nearby.

Microservice

The app may also be run as a webserver, for example:

docker run -p 8888:8000 abriedev/mapatlapi:latest server -port 8000

Exposes a server under http://localhost:8888 with these routes:

  1. /geocoder?address=55+Trinity+Ave+SW
  2. /locations?id=490131
  3. /places?id=490131&category=PL_PARKS

Go Module

To import the module: import "https://github.com/abrie/mapatlapi"

The module exposes three functions mirroring the commandline/microservice interface

func SearchByAddress(ctx context.Context, address string, maxLocations int64) (*geocoder.Response, error)
func FetchLocation(ctx context.Context, refId int) (*location.Response, error)
func FetchPlaces(ctx context.Context, refId int, category string) (*places.Response, error)

Build Instructions

make all to test, build, and containerize.

Technical Background

Internally, the MapATL website performs three interesting RPC calls.

  1. Geocoder:
    • Input: An address, ex. "123 Peachtree St."
    • Output: A list of candidate locations, each with a Ref_ID number.
  2. Location:
    • Input: A Ref_ID number
    • Output: Information about the location. See this definition for details.
  3. Places (of interest):
    • Input: A Ref_ID and a Category, which can be one of two values: "PL_PARKS" or "TRANS_MARTA_RAIL_STATIONS".
    • Output: A list of places matching the category. See this definition for details.

Unfortunately some of these calls are POST's and therefore subject to CORS restrictions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.