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.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, 23:29

studentofosm's gravatar image

accept rate: 0%

closed 16 Apr, 08:34

Frederik%20Ramm's gravatar image

Frederik Ramm ♦

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

(18 Apr, 21:11) studentofosm

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

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 15 Apr, 23:29

question was seen: 169 times

last updated: 18 Apr, 21:11

powered by OSQA