Coder Social home page Coder Social logo

spatialdatagen's Introduction

A data generator for spatial data

This tool is a simple data generator that creates spatial data. Currently, it is able to create points and polygons with uniform distribution only.

Usage

After cloning, build the project with sbt

sbt assembly

and run with

java -jar target/scala-2.12/spatialdatagen --num 10 --types point

This will create 10 points in WKT format and print them on your screen (stdout).

The following cli options are available:

Usage: Spatial Data Generator [options] [file]

  --min-x <value>       Minimal x value (for polygons for the center, Default = -180)
  --max-x <value>       Maximal x value (for polygons for the center, Default = 180)
  --min-y <value>       Minimal y value (for polygons for the center, Default = -90)
  --max-y <value>       Maximal y value (for polygons for the center, Default = 90)
  --x-radius <value>    Maximal x radius of the ellipse to generate polygons (only needed for polygons)
  --y-radius <value>    Maximal y radius of the ellipse to generate polygons (only needed for polygons)
  -a, --approx <value>  Maximun number of points to use to represent a polygon, default = 100
  -n, --num <value>     Number of elements to generate in total, default = 10
  --id                  Generate an ID (Long) for each object
  -q, --quiet           Do not print execution time statistics
  -t, --types <value>   Comma separated list of types to generate (point,polygon)
  -i, --interval <value>  create interval with given min and max bounds
  file                  Output file to write results to. Use <stdout> if empty

Data generation strategies

For points, we use the Java/Scala random number generator to create the coordinate values for x and y.

Polygons are a little more complex to generate. Currently, we create a random center point and create an ellipe around it with the specified max radius in x and y direction, resoectively. The actual radius is a random value between 1 and the respective max value. Then we create between 3 and approx points on that ellipse and use these points as the polygon's boundary points. This results in convex polygons only!

The intervals (-i, --interval) can be used to create a (temporal) interval. The generated value will be added to the output as two fields start and end.

For -t point,polygon --id --interval 1,10 the result will look like

0;POINT(25.97324975670142 -65.94055919025132);3;7

Where the first field is the ID, then the WKT of the geometry (in this case a point), and then followed by the start value of the interval (3) and the end value (7).

TODO

  • more geometry types (linestring, circle, ...)
  • concave polygons
  • payload data?
  • configurable separator (currently ; only)

spatialdatagen's People

Contributors

hag0r avatar

Watchers

 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.