Sign inSign up

wutichai/geography

By wutichai

Updated 10 months ago

Thai Geography API Service

Image
Machine learning & AI
0

1.2K

wutichai/geography repository overview

version: '3.8'

services:
  redis:
    image: redis:7-alpine
    container_name: geography-redis
    restart: unless-stopped
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data
    networks:
      - geography-net
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5

  geography:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: geography-service
    restart: unless-stopped
    ports:
      - "8080:8080"
    environment:
      - HTTP_ADDR=:8080
      - REDIS_ADDR=redis:6379
      - REDIS_DB=0
      - REDIS_PASS=
      - LOAD_EMBEDDED=1
    depends_on:
      redis:
        condition: service_healthy
    networks:
      - geography-net
    healthcheck:
      test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/healthz"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s

networks:
  geography-net:
    driver: bridge

volumes:
  redis_data:
    driver: local

Load geography data

curl -X POST http://localhost:8080/geo/load -F "file=@/mnt/data/geography.json"

Province id by name

curl "http://localhost:8080/geo/resolve/province?name=เชียงใหม่"

District id by province + district names

curl "http://localhost:8080/geo/resolve/district?province=เชียงใหม่&district=สารภี"

Subdistrict id by province + district + subdistrict names

curl "http://localhost:8080/geo/resolve/subdistrict?province=เชียงใหม่&district=สารภี&subdistrict=ขัวมุง"

If a name isn’t found you’ll get 404 with: { "ok": false, "error": "district not found in province "เชียงใหม่": "สารภี"" }

Tag summary

Content type

Image

Digest

sha256:289010832

Size

14.5 MB

Last updated

10 months ago

docker pull wutichai/geography