marshmallow-geojson


Namemarshmallow-geojson JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttps://github.com/folt/marshmallow-geojson
SummaryMarshmallow schema validation for GeoJson
upload_time2023-03-21 22:21:17
maintainer
docs_urlNone
authorAliaksandr Vaskevich
requires_python>=3.7,<4.0
licenseMIT
keywords marshmallow validation geojson schema gis geo json json-schema rest swagger openapi
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://github.com/folt/marshmallow-geojson/actions/workflows/main.yml/badge.svg
   :target: https://github.com/folt/marshmallow-geojson/actions?query=workflow%3A%22Python+package%22
   :alt: GitHub Actions status for master branch

.. image:: https://badge.fury.io/py/marshmallow-geojson.svg
   :target: https://pypi.org/project/marshmallow-geojson/
   :alt: Latest PyPI package version

.. image:: https://codecov.io/gh/folt/marshmallow-geojson/branch/master/graph/badge.svg?token=B5ATYXLBHO
   :target: https://codecov.io/gh/folt/marshmallow-geojson
   :alt: Codecov

.. image:: https://pepy.tech/badge/marshmallow-geojson
   :target: https://pepy.tech/project/marshmallow-geojson
   :alt: Downloads

marshmallow_geojson 🌍
======================


====================   =======
GeoJSON Objects        Status
====================   =======
Point_                 ✅
MultiPoint_            ✅
LineString_            ✅
MultiLineString_       ✅
Polygon_               ✅
MultiPolygon_          ✅
GeometryCollection_    ✅
Feature_               ✅
FeatureCollection_     ✅
Bbox_                  ✅

====================   =======

Installation
------------

marshmallow_geojson is compatible with Python 3.7 and 3.8.
The recommended way to install is via poetry_:

.. code::

  poetry add marshmallow_geojson

Using pip to install is also possible.

.. code::

  pip install marshmallow_geojson

GEOJSON
-------
GeoJSON_ is a format for encoding a variety of geographic data structures.

.. code-block::

  {
    "type": "Feature",
    "geometry": {
      "type": "Point",
      "coordinates": [125.6, 10.1]
    },
    "properties": {
      "name": "Dinagat Islands"
    }
  }

GeoJSON supports the following geometry types: Point, LineString, Polygon,
MultiPoint, MultiLineString, and MultiPolygon. Geometric objects with
additional properties are Feature objects. Sets of features are contained by
FeatureCollection objects.


Examples of using
------------------
Custom properties:

.. code-block::

  from marshmallow.fields import Str, Nested
  from marshmallow_geojson import GeoJSONSchema, PropertiesSchema, FeatureSchema

  class MyPropertiesSchema(PropertiesSchema):
      name = Str(required=True)

  class MyFeatureSchema(FeatureSchema):
      properties = Nested(
          MyPropertiesSchema,
          required=True,
      )

  class MyGeoJSONSchema(GeoJSONSchema):
      feature_schema = MyFeatureSchema

.. code-block::

  >>> geojson_text = '{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-80.724878, 35.265454], [-80.722646, 35.260338]]]}, "properties": {"name": "foo name"}}'
  >>> geojson_schema = MyGeoJSONSchema()
  >>> geojson_schema.loads(geojson_text)
  {'geometry': {'coordinates': [[(-80.724878, 35.265454), (-80.722646, 35.260338)]], 'type': 'Polygon'}, 'properties': {'name': 'foo name'}, 'type': 'Feature'}


Point
------------------
Simple example data:

.. code-block::

  >>> from marshmallow_geojson import GeoJSONSchema
  >>> geojson_text = '{"type": "Point","coordinates": [-105.01621, 39.57422]}'
  >>> geojson_many_text = '[{"type": "Point","coordinates": [-105.01621, 39.57422]}]'
  >>> geojson_dc = {"type": "Point","coordinates": [-105.01621, 39.57422]}

  >>> geojson_schema = GeoJSONSchema()
  >>> geojson_schema.loads(geojson_text)
  {'type': 'Point', 'coordinates': (-105.01621, 39.57422)}

  >>> geojson_schema.load(geojson_dc)
  {'type': 'Point', 'coordinates': (-105.01621, 39.57422)}

  >>> geojson_schema.dumps(geojson_dc)
  {'type': 'Point', 'coordinates': (-105.01621, 39.57422)}

  >>> geojson_schema.dump(geojson_dc)
  {'type': 'Point', 'coordinates': (-105.01621, 39.57422)}

  >>> geojson_schema = GeoJSONSchema(many=True)
  >>> geojson_schema.loads(geojson_many_text)
  [{'type': 'Point', 'coordinates': (-105.01621, 39.57422)}]

MultiPoint
------------------
Simple example data:

.. code-block::

  >>> from marshmallow_geojson import GeoJSONSchema
  >>> geojson_text = '{"type": "MultiPoint", "coordinates": [ [-105.01621, 39.57422], [-80.666513, 35.053994] ]}'
  >>> geojson_schema = GeoJSONSchema()
  >>> geojson_schema.loads(geojson_text)
  {'type': 'MultiPoint', 'coordinates': [(-105.01621, 39.57422), (-80.666513, 35.053994)]}


LineString
------------------
Simple example data:

.. code-block::

  >>> from marshmallow_geojson import GeoJSONSchema
  >>> geojson_text = '{"type": "LineString", "coordinates": [ [-99.113159, 38.869651], [-99.0802, 38.85682], [-98.822021, 38.85682], [-98.448486, 38.848264] ]}'
  >>> geojson_schema = GeoJSONSchema()
  >>> geojson_schema.loads(geojson_text)
  {'type': 'LineString', 'coordinates': [(-99.113159, 38.869651), (-99.0802, 38.85682), (-98.822021, 38.85682), (-98.448486, 38.848264)]}



MultiLineString
------------------
Simple example data:

.. code-block::

  >>> from marshmallow_geojson import GeoJSONSchema
  >>> geojson_text = '{"type": "MultiLineString", "coordinates": [ [ [-105.019898, 39.574997], [-105.019598, 39.574898], [-105.019061, 39.574782] ], [ [-105.017173, 39.574402], [-105.01698, 39.574385], [-105.016636, 39.574385], [-105.016508, 39.574402], [-105.01595, 39.57427] ], [ [-105.014276, 39.573972], [-105.014126, 39.574038], [-105.013825, 39.57417], [-105.01331, 39.574452] ] ]}'
  >>> geojson_schema = GeoJSONSchema()
  >>> geojson_schema.loads(geojson_text)
  {'type': 'MultiLineString', 'coordinates': [[(-105.019898, 39.574997), (-105.019598, 39.574898), (-105.019061, 39.574782)], [(-105.017173, 39.574402), (-105.01698, 39.574385), (-105.016636, 39.574385), (-105.016508, 39.574402), (-105.01595, 39.57427)], [(-105.014276, 39.573972), (-105.014126, 39.574038), (-105.013825, 39.57417), (-105.01331, 39.574452)]]}


Polygon
------------------
Simple example data:

.. code-block::

  >>> from marshmallow_geojson import GeoJSONSchema
  >>> geojson_text = '{"type": "Polygon", "coordinates": [ [ [100, 0], [101, 0], [101, 1], [100, 1], [100, 0] ] ]}'
  >>> geojson_schema = GeoJSONSchema()
  >>> geojson_schema.loads(geojson_text)
  {'type': 'Polygon', 'coordinates': [[(100.0, 0.0), (101.0, 0.0), (101.0, 1.0), (100.0, 1.0), (100.0, 0.0)]]}


MultiPolygon
------------------
Simple example data:

.. code-block::

  >>> from marshmallow_geojson import GeoJSONSchema
  >>> geojson_text = '{"type": "MultiPolygon", "coordinates": [ [ [ [107, 7], [108, 7], [108, 8], [107, 8], [107, 7] ] ], [ [ [100, 0], [101, 0], [101, 1], [100, 1], [100, 0] ] ] ]}'
  >>> geojson_schema = GeoJSONSchema()
  >>> geojson_schema.loads(geojson_text)
  {'type': 'MultiPolygon', 'coordinates': [[[(107.0, 7.0), (108.0, 7.0), (108.0, 8.0), (107.0, 8.0), (107.0, 7.0)]], [[(100.0, 0.0), (101.0, 0.0), (101.0, 1.0), (100.0, 1.0), (100.0, 0.0)]]]}


GeometryCollection
------------------
Simple example data:

.. code-block::

  >>> from marshmallow_geojson import GeoJSONSchema
  >>> geojson_text = '{"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [-80.660805, 35.049392]}, {"type": "Polygon", "coordinates": [ [ [-80.664582, 35.044965], [-80.663874, 35.04428], [-80.662586, 35.04558], [-80.663444, 35.046036], [-80.664582, 35.044965] ] ]}, {"type": "LineString", "coordinates": [[-80.662372, 35.059509], [-80.662693, 35.059263], [-80.662844, 35.05893] ]}]}'
  >>> geojson_schema = GeoJSONSchema()
  >>> geojson_schema.loads(geojson_text)
  {'type': 'GeometryCollection', 'geometries': [{'type': 'Point', 'coordinates': (-80.660805, 35.049392)}, {'type': 'Polygon', 'coordinates': [[(-80.664582, 35.044965), (-80.663874, 35.04428), (-80.662586, 35.04558), (-80.663444, 35.046036), (-80.664582, 35.044965)]]}, {'type': 'LineString', 'coordinates': [(-80.662372, 35.059509), (-80.662693, 35.059263), (-80.662844, 35.05893)]}]}


Feature
------------------
Simple example data:

.. code-block::

  >>> from marshmallow_geojson import GeoJSONSchema
  >>> geojson_text = '{"type": "Feature", "geometry": { "type": "Polygon", "coordinates": [ [ [-80.724878, 35.265454], [-80.722646, 35.260338], [-80.720329, 35.260618], [-80.71681, 35.255361], [-80.704793, 35.268397], [-82.715179, 35.267696], [-80.721359, 35.267276], [-80.724878, 35.265454] ] ] }, "properties": {} }'
  >>> geojson_schema = GeoJSONSchema()
  >>> geojson_schema.loads(geojson_text)
  {'type': 'Feature', 'properties': {}, 'geometry': {'type': 'Polygon', 'coordinates': [[(-80.724878, 35.265454), (-80.722646, 35.260338), (-80.720329, 35.260618), (-80.71681, 35.255361), (-80.704793, 35.268397), (-82.715179, 35.267696), (-80.721359, 35.267276), (-80.724878, 35.265454)]]}}


FeatureCollection
------------------
Simple example data:

.. code-block::

  >>> from marshmallow_geojson import GeoJSONSchema
  >>> geojson_text = '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-80.870885, 35.215151] }, "properties": {} }, {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [ [ [-80.724878, 35.265454], [-80.722646, 35.260338], [-80.720329, 35.260618], [-80.704793, 35.268397], [-80.724878, 35.265454] ] ]}, "properties": {}} ] }'
  >>> geojson_schema = GeoJSONSchema()
  >>> geojson_schema.loads(geojson_text)
  {'type': 'FeatureCollection', 'features': [{'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': (-80.870885, 35.215151)}, 'properties': {}}, {'type': 'Feature', 'geometry': {'type': 'Polygon', 'coordinates': [[(-80.724878, 35.265454), (-80.722646, 35.260338), (-80.720329, 35.260618), (-80.704793, 35.268397), (-80.724878, 35.265454)]]}, 'properties': {}}]}

Bbox
------------------
Set bbox:

.. code-block::

  from marshmallow.fields import List, Number
  from marshmallow_geojson import PolygonSchema
  from marshmallow_geojson.validate import Bbox

    class MyBboxSchema(PolygonSchema):
        bbox = List(
            Number(
                required=True,
            ),
            required=True,
            validate=Bbox(
                min_lon=-180,
                max_lon=180,
                min_lat=-90,
                max_lat=90,
            ),
        )

.. code-block::

  >>> geojson_text = '{"type": "Polygon", "bbox": [10, 10, 10, 10] , "coordinates": [[[100, 0], [101, 0], [101, 1], [100, 1], [100, 0]]]}'
  >>> my_bbox_schema = MyBboxSchema()
  >>> my_bbox_schema.loads(geojson_text)
  {'type': 'Polygon', 'bbox': [10, 10, 10, 10] , 'coordinates': [[[100, 0], [101, 0], [101, 1], [100, 1], [100, 0]]]}



.. _GeoJSON: http://geojson.org/
.. _poetry: https://python-poetry.org/

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/folt/marshmallow-geojson",
    "name": "marshmallow-geojson",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<4.0",
    "maintainer_email": "",
    "keywords": "marshmallow,validation,geojson,schema,gis,geo,json,json-schema,rest,swagger,openapi",
    "author": "Aliaksandr Vaskevich",
    "author_email": "vaskevic.an@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b7/6c/06a3a9b2b27946cbb53082e6ad074ef9124b699a306c0634d880f9103946/marshmallow_geojson-0.4.0.tar.gz",
    "platform": null,
    "description": ".. image:: https://github.com/folt/marshmallow-geojson/actions/workflows/main.yml/badge.svg\n   :target: https://github.com/folt/marshmallow-geojson/actions?query=workflow%3A%22Python+package%22\n   :alt: GitHub Actions status for master branch\n\n.. image:: https://badge.fury.io/py/marshmallow-geojson.svg\n   :target: https://pypi.org/project/marshmallow-geojson/\n   :alt: Latest PyPI package version\n\n.. image:: https://codecov.io/gh/folt/marshmallow-geojson/branch/master/graph/badge.svg?token=B5ATYXLBHO\n   :target: https://codecov.io/gh/folt/marshmallow-geojson\n   :alt: Codecov\n\n.. image:: https://pepy.tech/badge/marshmallow-geojson\n   :target: https://pepy.tech/project/marshmallow-geojson\n   :alt: Downloads\n\nmarshmallow_geojson \ud83c\udf0d\n======================\n\n\n====================   =======\nGeoJSON Objects        Status\n====================   =======\nPoint_                 \u2705\nMultiPoint_            \u2705\nLineString_            \u2705\nMultiLineString_       \u2705\nPolygon_               \u2705\nMultiPolygon_          \u2705\nGeometryCollection_    \u2705\nFeature_               \u2705\nFeatureCollection_     \u2705\nBbox_                  \u2705\n\n====================   =======\n\nInstallation\n------------\n\nmarshmallow_geojson is compatible with Python 3.7 and 3.8.\nThe recommended way to install is via poetry_:\n\n.. code::\n\n  poetry add marshmallow_geojson\n\nUsing pip to install is also possible.\n\n.. code::\n\n  pip install marshmallow_geojson\n\nGEOJSON\n-------\nGeoJSON_ is a format for encoding a variety of geographic data structures.\n\n.. code-block::\n\n  {\n    \"type\": \"Feature\",\n    \"geometry\": {\n      \"type\": \"Point\",\n      \"coordinates\": [125.6, 10.1]\n    },\n    \"properties\": {\n      \"name\": \"Dinagat Islands\"\n    }\n  }\n\nGeoJSON supports the following geometry types: Point, LineString, Polygon,\nMultiPoint, MultiLineString, and MultiPolygon. Geometric objects with\nadditional properties are Feature objects. Sets of features are contained by\nFeatureCollection objects.\n\n\nExamples of using\n------------------\nCustom properties:\n\n.. code-block::\n\n  from marshmallow.fields import Str, Nested\n  from marshmallow_geojson import GeoJSONSchema, PropertiesSchema, FeatureSchema\n\n  class MyPropertiesSchema(PropertiesSchema):\n      name = Str(required=True)\n\n  class MyFeatureSchema(FeatureSchema):\n      properties = Nested(\n          MyPropertiesSchema,\n          required=True,\n      )\n\n  class MyGeoJSONSchema(GeoJSONSchema):\n      feature_schema = MyFeatureSchema\n\n.. code-block::\n\n  >>> geojson_text = '{\"type\": \"Feature\", \"geometry\": {\"type\": \"Polygon\", \"coordinates\": [[[-80.724878, 35.265454], [-80.722646, 35.260338]]]}, \"properties\": {\"name\": \"foo name\"}}'\n  >>> geojson_schema = MyGeoJSONSchema()\n  >>> geojson_schema.loads(geojson_text)\n  {'geometry': {'coordinates': [[(-80.724878, 35.265454), (-80.722646, 35.260338)]], 'type': 'Polygon'}, 'properties': {'name': 'foo name'}, 'type': 'Feature'}\n\n\nPoint\n------------------\nSimple example data:\n\n.. code-block::\n\n  >>> from marshmallow_geojson import GeoJSONSchema\n  >>> geojson_text = '{\"type\": \"Point\",\"coordinates\": [-105.01621, 39.57422]}'\n  >>> geojson_many_text = '[{\"type\": \"Point\",\"coordinates\": [-105.01621, 39.57422]}]'\n  >>> geojson_dc = {\"type\": \"Point\",\"coordinates\": [-105.01621, 39.57422]}\n\n  >>> geojson_schema = GeoJSONSchema()\n  >>> geojson_schema.loads(geojson_text)\n  {'type': 'Point', 'coordinates': (-105.01621, 39.57422)}\n\n  >>> geojson_schema.load(geojson_dc)\n  {'type': 'Point', 'coordinates': (-105.01621, 39.57422)}\n\n  >>> geojson_schema.dumps(geojson_dc)\n  {'type': 'Point', 'coordinates': (-105.01621, 39.57422)}\n\n  >>> geojson_schema.dump(geojson_dc)\n  {'type': 'Point', 'coordinates': (-105.01621, 39.57422)}\n\n  >>> geojson_schema = GeoJSONSchema(many=True)\n  >>> geojson_schema.loads(geojson_many_text)\n  [{'type': 'Point', 'coordinates': (-105.01621, 39.57422)}]\n\nMultiPoint\n------------------\nSimple example data:\n\n.. code-block::\n\n  >>> from marshmallow_geojson import GeoJSONSchema\n  >>> geojson_text = '{\"type\": \"MultiPoint\", \"coordinates\": [ [-105.01621, 39.57422], [-80.666513, 35.053994] ]}'\n  >>> geojson_schema = GeoJSONSchema()\n  >>> geojson_schema.loads(geojson_text)\n  {'type': 'MultiPoint', 'coordinates': [(-105.01621, 39.57422), (-80.666513, 35.053994)]}\n\n\nLineString\n------------------\nSimple example data:\n\n.. code-block::\n\n  >>> from marshmallow_geojson import GeoJSONSchema\n  >>> geojson_text = '{\"type\": \"LineString\", \"coordinates\": [ [-99.113159, 38.869651], [-99.0802, 38.85682], [-98.822021, 38.85682], [-98.448486, 38.848264] ]}'\n  >>> geojson_schema = GeoJSONSchema()\n  >>> geojson_schema.loads(geojson_text)\n  {'type': 'LineString', 'coordinates': [(-99.113159, 38.869651), (-99.0802, 38.85682), (-98.822021, 38.85682), (-98.448486, 38.848264)]}\n\n\n\nMultiLineString\n------------------\nSimple example data:\n\n.. code-block::\n\n  >>> from marshmallow_geojson import GeoJSONSchema\n  >>> geojson_text = '{\"type\": \"MultiLineString\", \"coordinates\": [ [ [-105.019898, 39.574997], [-105.019598, 39.574898], [-105.019061, 39.574782] ], [ [-105.017173, 39.574402], [-105.01698, 39.574385], [-105.016636, 39.574385], [-105.016508, 39.574402], [-105.01595, 39.57427] ], [ [-105.014276, 39.573972], [-105.014126, 39.574038], [-105.013825, 39.57417], [-105.01331, 39.574452] ] ]}'\n  >>> geojson_schema = GeoJSONSchema()\n  >>> geojson_schema.loads(geojson_text)\n  {'type': 'MultiLineString', 'coordinates': [[(-105.019898, 39.574997), (-105.019598, 39.574898), (-105.019061, 39.574782)], [(-105.017173, 39.574402), (-105.01698, 39.574385), (-105.016636, 39.574385), (-105.016508, 39.574402), (-105.01595, 39.57427)], [(-105.014276, 39.573972), (-105.014126, 39.574038), (-105.013825, 39.57417), (-105.01331, 39.574452)]]}\n\n\nPolygon\n------------------\nSimple example data:\n\n.. code-block::\n\n  >>> from marshmallow_geojson import GeoJSONSchema\n  >>> geojson_text = '{\"type\": \"Polygon\", \"coordinates\": [ [ [100, 0], [101, 0], [101, 1], [100, 1], [100, 0] ] ]}'\n  >>> geojson_schema = GeoJSONSchema()\n  >>> geojson_schema.loads(geojson_text)\n  {'type': 'Polygon', 'coordinates': [[(100.0, 0.0), (101.0, 0.0), (101.0, 1.0), (100.0, 1.0), (100.0, 0.0)]]}\n\n\nMultiPolygon\n------------------\nSimple example data:\n\n.. code-block::\n\n  >>> from marshmallow_geojson import GeoJSONSchema\n  >>> geojson_text = '{\"type\": \"MultiPolygon\", \"coordinates\": [ [ [ [107, 7], [108, 7], [108, 8], [107, 8], [107, 7] ] ], [ [ [100, 0], [101, 0], [101, 1], [100, 1], [100, 0] ] ] ]}'\n  >>> geojson_schema = GeoJSONSchema()\n  >>> geojson_schema.loads(geojson_text)\n  {'type': 'MultiPolygon', 'coordinates': [[[(107.0, 7.0), (108.0, 7.0), (108.0, 8.0), (107.0, 8.0), (107.0, 7.0)]], [[(100.0, 0.0), (101.0, 0.0), (101.0, 1.0), (100.0, 1.0), (100.0, 0.0)]]]}\n\n\nGeometryCollection\n------------------\nSimple example data:\n\n.. code-block::\n\n  >>> from marshmallow_geojson import GeoJSONSchema\n  >>> geojson_text = '{\"type\": \"GeometryCollection\", \"geometries\": [{\"type\": \"Point\", \"coordinates\": [-80.660805, 35.049392]}, {\"type\": \"Polygon\", \"coordinates\": [ [ [-80.664582, 35.044965], [-80.663874, 35.04428], [-80.662586, 35.04558], [-80.663444, 35.046036], [-80.664582, 35.044965] ] ]}, {\"type\": \"LineString\", \"coordinates\": [[-80.662372, 35.059509], [-80.662693, 35.059263], [-80.662844, 35.05893] ]}]}'\n  >>> geojson_schema = GeoJSONSchema()\n  >>> geojson_schema.loads(geojson_text)\n  {'type': 'GeometryCollection', 'geometries': [{'type': 'Point', 'coordinates': (-80.660805, 35.049392)}, {'type': 'Polygon', 'coordinates': [[(-80.664582, 35.044965), (-80.663874, 35.04428), (-80.662586, 35.04558), (-80.663444, 35.046036), (-80.664582, 35.044965)]]}, {'type': 'LineString', 'coordinates': [(-80.662372, 35.059509), (-80.662693, 35.059263), (-80.662844, 35.05893)]}]}\n\n\nFeature\n------------------\nSimple example data:\n\n.. code-block::\n\n  >>> from marshmallow_geojson import GeoJSONSchema\n  >>> geojson_text = '{\"type\": \"Feature\", \"geometry\": { \"type\": \"Polygon\", \"coordinates\": [ [ [-80.724878, 35.265454], [-80.722646, 35.260338], [-80.720329, 35.260618], [-80.71681, 35.255361], [-80.704793, 35.268397], [-82.715179, 35.267696], [-80.721359, 35.267276], [-80.724878, 35.265454] ] ] }, \"properties\": {} }'\n  >>> geojson_schema = GeoJSONSchema()\n  >>> geojson_schema.loads(geojson_text)\n  {'type': 'Feature', 'properties': {}, 'geometry': {'type': 'Polygon', 'coordinates': [[(-80.724878, 35.265454), (-80.722646, 35.260338), (-80.720329, 35.260618), (-80.71681, 35.255361), (-80.704793, 35.268397), (-82.715179, 35.267696), (-80.721359, 35.267276), (-80.724878, 35.265454)]]}}\n\n\nFeatureCollection\n------------------\nSimple example data:\n\n.. code-block::\n\n  >>> from marshmallow_geojson import GeoJSONSchema\n  >>> geojson_text = '{\"type\": \"FeatureCollection\", \"features\": [{\"type\": \"Feature\", \"geometry\": {\"type\": \"Point\", \"coordinates\": [-80.870885, 35.215151] }, \"properties\": {} }, {\"type\": \"Feature\", \"geometry\": {\"type\": \"Polygon\", \"coordinates\": [ [ [-80.724878, 35.265454], [-80.722646, 35.260338], [-80.720329, 35.260618], [-80.704793, 35.268397], [-80.724878, 35.265454] ] ]}, \"properties\": {}} ] }'\n  >>> geojson_schema = GeoJSONSchema()\n  >>> geojson_schema.loads(geojson_text)\n  {'type': 'FeatureCollection', 'features': [{'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': (-80.870885, 35.215151)}, 'properties': {}}, {'type': 'Feature', 'geometry': {'type': 'Polygon', 'coordinates': [[(-80.724878, 35.265454), (-80.722646, 35.260338), (-80.720329, 35.260618), (-80.704793, 35.268397), (-80.724878, 35.265454)]]}, 'properties': {}}]}\n\nBbox\n------------------\nSet bbox:\n\n.. code-block::\n\n  from marshmallow.fields import List, Number\n  from marshmallow_geojson import PolygonSchema\n  from marshmallow_geojson.validate import Bbox\n\n    class MyBboxSchema(PolygonSchema):\n        bbox = List(\n            Number(\n                required=True,\n            ),\n            required=True,\n            validate=Bbox(\n                min_lon=-180,\n                max_lon=180,\n                min_lat=-90,\n                max_lat=90,\n            ),\n        )\n\n.. code-block::\n\n  >>> geojson_text = '{\"type\": \"Polygon\", \"bbox\": [10, 10, 10, 10] , \"coordinates\": [[[100, 0], [101, 0], [101, 1], [100, 1], [100, 0]]]}'\n  >>> my_bbox_schema = MyBboxSchema()\n  >>> my_bbox_schema.loads(geojson_text)\n  {'type': 'Polygon', 'bbox': [10, 10, 10, 10] , 'coordinates': [[[100, 0], [101, 0], [101, 1], [100, 1], [100, 0]]]}\n\n\n\n.. _GeoJSON: http://geojson.org/\n.. _poetry: https://python-poetry.org/\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Marshmallow schema validation for GeoJson",
    "version": "0.4.0",
    "split_keywords": [
        "marshmallow",
        "validation",
        "geojson",
        "schema",
        "gis",
        "geo",
        "json",
        "json-schema",
        "rest",
        "swagger",
        "openapi"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "34dfbe68acdcd1a0550d3c4332b618711461203996410218843a5e4e691a4d4c",
                "md5": "944d5afdaf42a200248d5d32152e2c9c",
                "sha256": "4623e7105ccf00d7437826f52120000cf3e3812211b285cc17c43072b4222d5d"
            },
            "downloads": -1,
            "filename": "marshmallow_geojson-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "944d5afdaf42a200248d5d32152e2c9c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 13921,
            "upload_time": "2023-03-21T22:21:15",
            "upload_time_iso_8601": "2023-03-21T22:21:15.416696Z",
            "url": "https://files.pythonhosted.org/packages/34/df/be68acdcd1a0550d3c4332b618711461203996410218843a5e4e691a4d4c/marshmallow_geojson-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b76c06a3a9b2b27946cbb53082e6ad074ef9124b699a306c0634d880f9103946",
                "md5": "5206cefe202c936d662bebae9b7b7bd2",
                "sha256": "22dd2529ffe53c0bcbfd3dba7948009668bcd470764e4bc3db6740b476f28d23"
            },
            "downloads": -1,
            "filename": "marshmallow_geojson-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "5206cefe202c936d662bebae9b7b7bd2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4.0",
            "size": 11097,
            "upload_time": "2023-03-21T22:21:17",
            "upload_time_iso_8601": "2023-03-21T22:21:17.148611Z",
            "url": "https://files.pythonhosted.org/packages/b7/6c/06a3a9b2b27946cbb53082e6ad074ef9124b699a306c0634d880f9103946/marshmallow_geojson-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-21 22:21:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "folt",
    "github_project": "marshmallow-geojson",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "marshmallow-geojson"
}
        
Elapsed time: 0.16566s