Git Product home page Git Product logo

geodata's Introduction

Geodata

REST API to get the coordinates of the user by his IP address and get a list of locations by the name of the city.

Technical description:

The database is stored in the geobase.dat file, which is contained in the archive attached to the letter. The database will not change, it is read-only. The database has a binary format. The file is sequentially stored:

60 byte header

int version; // version database
sbyte name[32]; // name/prefix for the database
ulong timestamp; // time of creation of the database
int records; // total number of records
uint offset_ranges; // offset relative to the beginning of the file to the beginning of the list of records with geoinformation
uint offset_cities; // offset relative to the beginning of the file to the beginning of the index sorted by city name
uint offset_locations; // offset relative to the beginning of the file to the beginning of the list of location records
12 bytes * Header.records (number of records) — a list of records with information about IP address intervals, sorted by ip_from and ip_to fields

uint ip_from; // start of IP address range
uint ip_to; // end of IP address range
uint location_index; // index of the location record
96 bytes * Header.records —number of records) - a list of records with location information with coordinates (longitude and latitude)

sbyte country[8]; // country name (a random string with the prefix "cou_")
sbyte region[12]; // name of the field (random string prefixed with "reg_")
postal sbyte[12]; // postal code (a random string with the prefix "pos_")
city sbyte[24]; // the name of the city (random string with the prefix "cit_")
sbyte organization[32]; // name of the company (a random string with the prefix "org_")
float latitude; // latitude
float longitude; // longitude
4 bytes * Header.records —number of records) - a list of indexes of location records sorted by city name, each index is the address of an entry in the file relative to Header.offset_locations

The database is loaded completely into memory when the application starts.

install

make mod
make build

run

bin/geodata --config=config/geodata.yaml

documentation

swagger file

geodata's People

Watchers

Vlad avatar

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.