DEV Community

Alex
Alex

Posted on

geojson-faker: fake geodata in GeoJSON format

geojson-faker is a tool for generating fake geodata in GeoJSON format.

What problem does the library solve

If your product is related to geodata, then there is often a need to generate a large amount of this data. For example, in order to run tests or prepare a demonstration of the project. This is the problem that geojson-faker solves. With it, you can easily generate data of any size.

GeoJSON

GeoJSON is a format for encoding data about geographic features using JavaScript Object Notation (JSON). It's in this format that geojson-faker generates data, making it easy to embed the library into your services.

Examples of use

Here's a simple example of how to use the library:

>>> from geojson_faker import GeoJsonFaker
>>> geojson_faker = GeoJsonFaker()
>>> # Point2D or Point3D
>>> geojson_faker.point
Point(bbox=None, type='Point', coordinates=Position2D(longitude=-50.56703965217093, latitude=19.72513434718111))
>>> geojson_faker.point
Point(bbox=None, type='Point', coordinates=Position3D(longitude=111.84911865610678, latitude=-19.488979926988165, altitude=7921.968274391678))
>>> # Point2D
>>> geojson_faker.point2d
Point(bbox=None, type='Point', coordinates=Position2D(longitude=29.98434638920918, latitude=36.476444735501616))
>>> # Point3D
>>> geojson_faker.point3d
Point(bbox=None, type='Point', coordinates=Position3D(longitude=-76.36126084558762, latitude=30.682266859380533, altitude=15816.987234147065))
Enter fullscreen mode Exit fullscreen mode

For more information, see the geojson-faker project repository.

Project plans

Support for basic geodata, namely Position, Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, GeometryCollection has already been implemented. Feature and FeatureCollection will soon be added, as well as the generation of realistic data such as countries, cities, famous places, etc.

Thank you

I'd really appreciate it if you could leave a comment, like or star on GitHub! Thank you!

Top comments (0)