NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Basically I want to place, non-overlapping randomly sized, square filled with nodes (a growing square spiral), which are added real-time so I can't predict how large a square will get, but the maximum square can hold 100 million (10,000 X 10,000) nodes. All nodes belonging inside this square have the same link to the original starting node.

Right now I generate these random start coordinates where the square spiral begins to grow, to minimize overlaps with another growing bounding box arising from a totally new random seed coordinates that by some chance, happens to be close enough that the two boxes end up overlapping each other.

var memdb = require('memdb')
var Osm = require('kappa-osm')

var osm = Osm({
  core: kappa('./db', { valueEncoding: 'json' }),
  index: memdb(),
  storage: function (name, cb) { cb(null, ram()) }
})
var i = 0;
var startingPoints = [];
while (i < 1000000){
  var node = {
   type: 'node',
   lat: (Math.random()*180-95).toFixed(7).toString(),
   lon: (Math.random()*360-180).toFixed(7).toString(),
   tags: { feature: 'randomID', level: '0' },
   links: ["25235235@0"]
   changeset: ''
  }
   osm.create(node, function (err, node) {
    if (err) return console.error(err)
      startingPoints.push(node);
    })
 ++i;
}


startingPoints.forEach(startCoordinates =>{
   fillSquareWithRandomLinkedNodes(startCoordinates, random(2, 1,000,000,000));
})

basically fillSquareWithRandomLinkedNodes generates a random square area size and fills it completely with nodes all linked to provided startCoordinates.

I'm afraid that if I generate 1,000,000 random start coordinates and grow a square spiral square for each coordinate with varying square area size, starting at each point in the clockwise direction, there will be overlapping square shaped spiral of nodes eventually.

I do have some upper limits as to the maximum area of each square spiral, it should be able to store 100 million nodes.

I am assuming there will be issues when more than one node occupies the same longitude and latitude. I've thought about using the level tag but that seems complicated.

or is this overkill, will the overlaps somehow be automatically be handled when querying for all nodes within?

asked 15 Apr '19, 23:29

studentofosm's gravatar image

studentofosm
9113
accept rate: 0%

closed 16 Apr '19, 08:34

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273

I posted it there for visibility but they link it to this thread which effectively kills my question

(18 Apr '19, 21:11) studentofosm

The question has been closed for the following reason "Question is off-topic or not relevant" by Frederik Ramm 16 Apr '19, 08:34

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×60

question asked: 15 Apr '19, 23:29

question was seen: 851 times

last updated: 18 Apr '19, 21:11

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum