Skip to main content

A simple geojson provider for faker

Project description

GeoFactory

This is a faker provider that generates fake geojson data. It simulates all the different types of features and geometries in the geojson specification. There is also a test suite for the class and it's methods run with pytest.

Setup

Install from source:

pip install git+https://github.com/scook12/geofactory.git@master

OR

pipenv install git+https://github.com/scook12/geofactory.git@master#egg=geofactory

Install with pip:

pip install geofactory

Use

GeoFactory is just an additional community provider for geojson.

An example might look like this:

from faker import Faker

from geofactory import GeoFactory

factory = Faker()

factory.add_provider(GeoFactory)

pt = factory.point()

pt is now a valid geojson Point feature. All methods follow this pattern.

Methods

lnglat

Returns a given number of random longitude/latitude pairs.

point

Returns a single geojson point object with random coordinates

multipoint

Returns a multipoint geojson object with a random number of random points :param: count_limit - determines the maxiumum number of points generated

linestring

Returns a linestring geojson object with a random number of nodes :param: node_limit - determines the maxiumum number of nodes generated

multilinestring

Returns a multilinestring with a random number of segments with a random number of nodes :param: node_limit - determines maximum number of nodes for a given linestring :param: count_limit - determines the maximum number of line segments generated

polygon

Returns a randomly arranged polygon with a specific number of nodes :param: node_limit - determines how many nodes will be in the return polygon

multypolygon

Returns a geojson multipolygon with a specific number of randomly arranged polygons :param: count_limit - determines how many polygons will be created

geometry_collection

Returns a specific number of random geojson geometries as a collection :param: count_limit - determines how many geometries will be generated

feature

Returns a random geojson feature object

feature_collection

Returns a specific number of random features in a feature collection object :param: count_limit - determines how many features will be generated

to_file

Writes geojson object to file :param: path - full path and filename for data to be written to :param: data - valid geojson object to dump in path

Contribute

Open an issue, fork the repo, submit a PR. This is a tiny side project I built to be used while developing an app that ingested geojson, so there aren't a ton of guidelines.

If you make changes to existing methods, be sure to run pytest to make sure they all are still passing. If you write a new method or class, please include some basic pytest cases.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geofactory-0.0.2.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geofactory-0.0.2-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file geofactory-0.0.2.tar.gz.

File metadata

  • Download URL: geofactory-0.0.2.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.1.post20191125 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.3

File hashes

Hashes for geofactory-0.0.2.tar.gz
Algorithm Hash digest
SHA256 bb315f2b55a4d81fa66fe1e83fee5fa7f8f56305f7f4b63aa6568d3d6ef3aa3d
MD5 564c8489d6ba4eddd11061bf6752caa7
BLAKE2b-256 18fa5c0b5fdb9bad2ea2e818e88eb1aaa6456aa675d2f08a482a319f70206709

See more details on using hashes here.

File details

Details for the file geofactory-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: geofactory-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.1.post20191125 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.3

File hashes

Hashes for geofactory-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ecdb40550969536887bf25a4dcbb60cd0d81266a0b461d325a14d0bb200be68a
MD5 4a06fd145c4b800771aa881f171bca0f
BLAKE2b-256 bb9d81f14bc37e105a6fbc0fd3e946a8ebb41843169ed7499ca880730f16258b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page