Location IDs - GarethKirk/lids GitHub Wiki

Have you ever needed a way of aggregating map data, or points on a mat using latitude and longitude? This mechanism solves the problem of having to define a grid matrix database and still lets you aggregate it up.

This is a mechanism to store Locations in a calculable textual format , that does not need a pre-defined grid table reference.

Traditionally one would create a grid and number them so everyone knows what the address is. This is a different way, but oh so useful, as it these are aggregable IDs. What that means is The ID length itself, works much like a number's decimal place.

The key concept to this unique method, is that you are not storing a location number (i.e. not an looked up address), but the path to a location at different levels.

Let me use an analogy, back in the day, before mobiles, if a visitor from another city is coming to your house and you are giving directions to your house. You would not give your post code or address but you would direct them from a commonly known identifiable point of location. You would first go through your references of what you thought would be commonly known objects, or landmarks within the city. "Do you know the church on the corner with the big clock, or where the statue is with the two giraffes, or obviously the train station they may be arriving in". From that known point you begin to describe the direction they must take.

This approach is similar, lets say we use a quadrant (2x2) box, this is the quickest and gives reasonable granularity, if you needed a shorter address you can use a 6x6 grid, and number them a-z0-9 giving you 36 blocks.

2x2LID In this example I will use the (2x2) quadrant approach, and will label them a,b,c,d from left to right, top to bottom.

Lets Say, my GPS tells me I am where the red dot is which is 55.01 latitude and -3.02 longitude, I will divide the world into quadrants, using +90 to -90 Latitude and -180 to + 180 Longitude, with a cross section at 0,0. This is always the starting point. The common reference we all know, the "starting" point as it were.

Calulating the 2x2LID
Then from there we decide, which quadrant my location is in, but my point's latitude is greator or equal to 0, and my point's longitude is less than and equal to 0. if so I am a, else check b, c and d using a similar if statement methods.

This will give us the first lettter... in this case letter a.

Next wo go to the next level, and redraw a new imaginary cross section, halving the quadrant each time, now within the quadrant of a, we move the cross section from 0,0 to up and left (half the width) which is (45 lat, -90 lng)

We do this, for as many times as you want... but now dividing the width by 2 each time and decide in which direction do move. In this example I see I am top, right, so the next letter is b. I then divide the width, and point the pointer. check, divide, move; check, divide, move.

Repeating this I get the next letter d, as the point is in the lower right quadrant, and again lower right, so d again.

So the resulting word, at lenght 4, is abdd.

Why is this powerful?

  1. This is easily calculated
  2. No reference to customized proprietary database
  3. This is aggregable, so you just need to choose your word length in the database to get a grouped number of points.
  4. This is done by 1 measure, that can be easily index and thus super fast.
  5. The length of the word is up to you, and thus it can be to the 50th letter (or more) , which would be a quadrant width of roughly 35.5342422154 nano meter, at the equator. On a 2x2 grid, 30 letters is more than enough, on a 6x6 grid, 6 letters is about right. However you can decide how big your quadrants will be.

Limitation

Guessing relative points in a neighbouring cell, in another quadrant(i.e. outside your path) is not possible at all times:

The dividing mechanism (which allows for grouping), for example near the 0,0 markers, allows neighbouring markers to have completely different words,

Solution 1: of course you can calculate easily what the neighbour cells are at the level you want, quickly and easily. Which means you still don't have to go back to a paid database or service.

Word Compare

Starting with the first letter a or b, creates a significantly different word. it could mean that cells, at equator, or Greenwich meridian line could be relatively close or meters apart but have completely different words. i.e. two points such as (0.1 lat ,0.1 lng ) and (0.1 lat, -0.1 lng) could be adddd... and bcccc,... so although they are physically close to each other, the could be "worlds" apart in word terms.

Future Devleopment

Please go to GitHub, to find out more about what more you can do with LIDS and help us make an open source mechanism to calculate every address anywhere.

(6x4x2)2LID
This could be to use a 6x6 for the first 4 characters and 4 x 4 for the next 4 and 2x2 for the last 4. Although this would create a massive amount of complexity in calculating your word... so not great, but would allow shorter words to get to relevant size grids.

6x6LID
The use of a 6x6 grid, create a great address people could use and remember, but does not serve well for creating a number of levels for aggregating data in. this is also much more complex to code. If it were me, through I would definitely use this as an address tool if you needed to code for areas of unaddressed data.

⚠️ **GitHub.com Fallback** ⚠️