GithubHelp home page GithubHelp logo

iotaledger / iota-area-codes Goto Github PK

View Code? Open in Web Editor NEW
19.0 34.0 3.0 2.68 MB

IACs are a proposed standard for tagging IOTA transactions with a geo-location, which allows them to be fetched based on their location.

Home Page: https://iota-poc-area-codes.dag.sh

License: MIT License

JavaScript 3.24% TypeScript 96.76%
iota geocoding distributed-ledger olc

iota-area-codes's Introduction

Geo-location tags for IOTA transactions

This repository is now deprecated as it can only be used with the legacy IOTA network.

Discord StackExchange MIT license

AboutPrerequisitesInstallationGetting startedAPI referenceSupporting the projectJoining the discussion


About

IOTA area codes (IAC) are a proposed standard for tagging IOTA transactions with a geo-location, which allows you to be filter them by location.

IACs are a clone of Open Location Codes with some minor changes to make them compatible with tryte encoding:

  • The numbers and letters that make up an IAC include the following: FGHJKLMNOPQRSTUVXWYZ
  • The separator that comes after the eighth tryte in an IAC is a 9 instead of a +
  • The A tryte is used for padding IACs instead of a 0

A demonstration of the API is available here.

See a more detailed explanation of IACs.

This is beta software, so there may be performance and stability issues. Please report any issues in our issue tracker.

Prerequisites

To use IACs in your own applications, you need Node.js installed on your device.

To check if you have Node.js installed, run the following command:

node -v

If Node.js is installed, you should see the version that's installed.

Installation

To install this package, use one of the following commands:

  • npm install @iota/area-codes

  • yarn add @iota/area-codes

Getting started

For a tutorial on getting started with IACs, see our documentation portal.

To jump in now, see the following code sample:

const iotaAreaCodes = require('@iota/area-codes');

const iac = iotaAreaCodes.encode(52.529562, 13.413047);
console.log("IOTA Area Code", iac);

const iacHighPrecision = iotaAreaCodes.encode(52.529562, 13.413047, iotaAreaCodes.CodePrecision.EXTRA);
console.log("IOTA Area Code High Precision", iacHighPrecision);

const codeArea = iotaAreaCodes.decode('NPHTQORL9XKP');
console.log("IOTA Code Area", codeArea);

const olc = iotaAreaCodes.toOpenLocationCode('NPHTQORL9XKP');
console.log("Open Location Code", olc);

const iac2 = iotaAreaCodes.fromOpenLocationCode('X4HM+MM');
console.log("IOTA Area Code", iac2);

const isValid1 = iotaAreaCodes.isValid('JAHAS0');
console.log("isValid1", isValid1);

const isValid2 = iotaAreaCodes.isValid('NPHTQORL9XKP');
console.log("isValid2", isValid2);

const isValidPartial1 = iotaAreaCodes.isValidPartial('JAHAS');
console.log("isValidPartial1", isValidPartial1);

const isValidPartial2 = iotaAreaCodes.isValidPartial('NPAAAAAA9');
console.log("isValidPartial2", isValidPartial2);

const extracted = iotaAreaCodes.extract('NPHTQORL9XKP999999999');
console.log("extracted", extracted);

const dimensions = iotaAreaCodes.getPrecisionDimensions(4);
console.log("dimensions", dimensions);

const increasePrecision1 = iotaAreaCodes.increasePrecision('NPHTQORL9');
console.log("increasePrecision1", increasePrecision1);

const decreasePrecision1 = iotaAreaCodes.decreasePrecision('NPHTQORL9');
console.log("decreasePrecision1", decreasePrecision1);

const setPrecision1 = iotaAreaCodes.setPrecision('NPHTQORL9', 4);
console.log("setPrecision", setPrecision1);

Will output:

IOTA Area Code NPHTQORL9XK
IOTA Area Code High Precision NPHTQORL9XKP
IOTA Code Area {
  latitude: 52.52956250000001,
  longitude: 13.413046874999981,
  codePrecision: 11,
  latitudeLow: 52.529550000000015,
  latitudeHigh: 52.529575000000015,
  longitudeLow: 13.413031249999982,
  longitudeHigh: 13.413062499999983
}
Open Location Code 9F4MGCH7+R6F
IOTA Area Code ZHRT9TT
isValid1 false
isValid2 true
isValidPartial1 false
isValidPartial2 true
extracted NPHTQORL9XKP
dimensions {
  blocksSizeDegrees: 1,
  blocksSizeDegreesFormatted: "",
  sizeMetres: 110000,
  sizeMetresFormatted: "110km"
}
increasePrecision1 NPHTQORL9QP
decreasePrecision1 NPHTQOAA9
setPrecision NPHTAAAA9

API Reference

See the JavaScript API reference.

Supporting the project

If you want to contribute, consider submitting a bug report, feature request or a pull request.

See our contributing guidelines for more information.

Joining the discussion

If you want to get involved in the community, need help with getting set up, have any issues or just want to discuss IOTA, Distributed Registry Technology (DRT), and IoT with other people, feel free to join our Discord.

iota-area-codes's People

Contributors

dependabot[bot] avatar mtrabelsi avatar obany avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iota-area-codes's Issues

Query server DB_URL

What is DB_URL=urls.go.here supposed to be?

I did follow the guide to setup a server:
Then in the end set DB_URL=cassandra:7000 , just some random value, since I do not know if this has to match with anything the docker-cassandra launch did setup (not so much familiar with docker nor cassandra)

After "yarn start" I see following output

$ micro 
Connecting to ZMQ
micro: Accepting connections on port 3000

bounding box search

Hi,

i once came up with a similar idea to iota-area-codes and I wanted to get lets say all neighboring transactions with 10km box around me location (e.g. location is NZHOOK ...), so I want to get for example all TAG TRYTES starting with NZHO....

How would you do such a TAG TRYTE search in IOTA using this module..?

 var searchNeigbors = function() {
    // location String
    let tryteLat = convertToTryte
    // 0480101103 - LAT 48, LATMIN 1 LNG 11, LNGMIN 3
    let boundingBox = getGeoTryteNeighbours(lat, lng, latmin, lngmin);
    console.log(boundingBox)

First way to solve this would be to do a TAG search on lets say NZHO. but this could take some time crawling and in same cases return an awful long list to filter. I also wondered whether one could get native support from iota protocol to retrieving transactions with geoTAG.

Also is it possible to search for a NZH tag on a NZHO (for example) to get back the correct transactions from the complete GEOTAG? I struggled to do so back then and would have required iota-core-api support.

Distance between 2 IACs

Hi,

would you take a PR for this lib to calculate the (average, max, min, or other :)), distance between 2 IACs ?
(by a) using a npm geo lib or b) direct plain calc ? )

Thanks

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.