/usr/lib/python3/dist-packages/geojson-1.3.1.egg-info/PKG-INFO is in python3-geojson 1.3.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | Metadata-Version: 1.1
Name: geojson
Version: 1.3.1
Summary: Python bindings and utilities for GeoJSON
Home-page: https://github.com/frewsxcv/python-geojson
Author: Corey Farwell
Author-email: coreyf@rwell.org
License: BSD
Description: python-geojson
==============
.. image:: https://img.shields.io/travis/frewsxcv/python-geojson.svg
:target: https://travis-ci.org/frewsxcv/python-geojson
.. image:: https://img.shields.io/codecov/c/github/frewsxcv/python-geojson.svg
:target: https://codecov.io/github/frewsxcv/python-geojson?branch=master
This library contains:
- Functions for encoding and decoding GeoJSON_ formatted data
- Classes for all GeoJSON Objects
- An implementation of the Python `__geo_interface__ Specification`_
**Table of Contents**
.. contents::
:backlinks: none
:local:
Installation
------------
python-geojson is compatible with Python 2.6, 2.7, 3.2, 3.3, and 3.4. It is listed on `PyPi as 'geojson'`_. The recommended way to install is via pip_:
.. code::
pip install geojson
.. _PyPi as 'geojson': https://pypi.python.org/pypi/geojson/
.. _pip: http://www.pip-installer.org
GeoJSON Objects
---------------
This library implements all the `GeoJSON Objects`_ described in `The GeoJSON Format Specification`_.
.. _GeoJSON Objects: http://www.geojson.org/geojson-spec.html#geojson-objects
Point
~~~~~
.. code:: python
>>> from geojson import Point
>>> Point((-115.81, 37.24)) # doctest: +ELLIPSIS
{"coordinates": [-115.8..., 37.2...], "type": "Point"}
Visualize the result of the example above `here <https://gist.github.com/frewsxcv/b5768a857f5598e405fa>`__. General information about Point can be found in `Section 2.1.2`_ and `Appendix A: Point`_ within `The GeoJSON Format Specification`_.
.. _Section 2.1.2: http://www.geojson.org/geojson-spec.html#point
.. _Appendix A\: Point: http://www.geojson.org/geojson-spec.html#id2
MultiPoint
~~~~~~~~~~
.. code:: python
>>> from geojson import MultiPoint
>>> MultiPoint([(-155.52, 19.61), (-156.22, 20.74), (-157.97, 21.46)]) # doctest: +ELLIPSIS
{"coordinates": [[-155.5..., 19.6...], [-156.2..., 20.7...], [-157.9..., 21.4...]], "type": "MultiPoint"}
Visualize the result of the example above `here <https://gist.github.com/frewsxcv/be02025c1eb3aa2040ee>`__. General information about MultiPoint can be found in `Section 2.1.3`_ and `Appendix A: MultiPoint`_ within `The GeoJSON Format Specification`_.
.. _Section 2.1.3: http://www.geojson.org/geojson-spec.html#multipoint
.. _Appendix A\: MultiPoint: http://www.geojson.org/geojson-spec.html#id5
LineString
~~~~~~~~~~
.. code:: python
>>> from geojson import LineString
>>> LineString([(8.919, 44.4074), (8.923, 44.4075)]) # doctest: +ELLIPSIS
{"coordinates": [[8.91..., 44.407...], [8.92..., 44.407...]], "type": "LineString"}
Visualize the result of the example above `here <https://gist.github.com/frewsxcv/758563182ca49ce8e8bb>`__. General information about LineString can be found in `Section 2.1.4`_ and `Appendix A: LineString`_ within `The GeoJSON Format Specification`_.
.. _Section 2.1.4: http://www.geojson.org/geojson-spec.html#linestring
.. _Appendix A\: LineString: http://www.geojson.org/geojson-spec.html#id3
MultiLineString
~~~~~~~~~~~~~~~
.. code:: python
>>> from geojson import MultiLineString
>>> MultiLineString([
... [(3.75, 9.25), (-130.95, 1.52)],
... [(23.15, -34.25), (-1.35, -4.65), (3.45, 77.95)]
... ]) # doctest: +ELLIPSIS
{"coordinates": [[[3.7..., 9.2...], [-130.9..., 1.52...]], [[23.1..., -34.2...], [-1.3..., -4.6...], [3.4..., 77.9...]]], "type": "MultiLineString"}
Visualize the result of the example above `here <https://gist.github.com/frewsxcv/20b6522d8242ede00bb3>`__. General information about MultiLineString can be found in `Section 2.1.5`_ and `Appendix A: MultiLineString`_ within `The GeoJSON Format Specification`_.
.. _Section 2.1.5: http://www.geojson.org/geojson-spec.html#multilinestring
.. _Appendix A\: MultiLineString: http://www.geojson.org/geojson-spec.html#id6
Polygon
~~~~~~~
.. code:: python
>>> from geojson import Polygon
>>> # no hole within polygon
>>> Polygon([[(2.38, 57.322), (23.194, -20.28), (-120.43, 19.15), (2.38, 57.322)]]) # doctest: +ELLIPSIS
{"coordinates": [[[2.3..., 57.32...], [23.19..., -20.2...], [-120.4..., 19.1...]]], "type": "Polygon"}
>>> # hole within polygon
>>> Polygon([
... [(2.38, 57.322), (23.194, -20.28), (-120.43, 19.15), (2.38, 57.322)],
... [(-5.21, 23.51), (15.21, -10.81), (-20.51, 1.51), (-5.21, 23.51)]
... ]) # doctest: +ELLIPSIS
{"coordinates": [[[2.3..., 57.32...], [23.19..., -20.2...], [-120.4..., 19.1...]], [[-5.2..., 23.5...], [15.2..., -10.8...], [-20.5..., 1.5...], [-5.2..., 23.5...]]], "type": "Polygon"}
Visualize the results of the example above `here <https://gist.github.com/frewsxcv/b2f5c31c10e399a63679>`__. General information about Polygon can be found in `Section 2.1.6`_ and `Appendix A: Polygon`_ within `The GeoJSON Format Specification`_.
.. _Section 2.1.6: http://www.geojson.org/geojson-spec.html#polygon
.. _Appendix A\: Polygon: http://www.geojson.org/geojson-spec.html#id4
MultiPolygon
~~~~~~~~~~~~
.. code:: python
>>> from geojson import MultiPolygon
>>> MultiPolygon([
... ([(3.78, 9.28), (-130.91, 1.52), (35.12, 72.234), (3.78, 9.28)],),
... ([(23.18, -34.29), (-1.31, -4.61), (3.41, 77.91), (23.18, -34.29)],)
... ]) # doctest: +ELLIPSIS
{"coordinates": [[[[3.7..., 9.2...], [-130.9..., 1.5...], [35.1..., 72.23...]]], [[[23.1..., -34.2...], [-1.3..., -4.6...], [3.4..., 77.9...]]]], "type": "MultiPolygon"}
Visualize the result of the example above `here <https://gist.github.com/frewsxcv/e0388485e28392870b74>`__. General information about MultiPolygon can be found in `Section 2.1.7`_ and `Appendix A: MultiPolygon`_ within `The GeoJSON Format Specification`_.
.. _Section 2.1.7: http://www.geojson.org/geojson-spec.html#multipolygon
.. _Appendix A\: MultiPolygon: http://www.geojson.org/geojson-spec.html#id7
GeometryCollection
~~~~~~~~~~~~~~~~~~
.. code:: python
>>> from geojson import GeometryCollection, Point, LineString
>>> my_point = Point((23.532, -63.12))
>>> my_line = LineString([(-152.62, 51.21), (5.21, 10.69)])
>>> GeometryCollection([my_point, my_line]) # doctest: +ELLIPSIS
{"geometries": [{"coordinates": [23.53..., -63.1...], "type": "Point"}, {"coordinates": [[-152.6..., 51.2...], [5.2..., 10.6...]], "type": "LineString"}], "type": "GeometryCollection"}
Visualize the result of the example above `here <https://gist.github.com/frewsxcv/6ec8422e97d338a101b0>`__. General information about GeometryCollection can be found in `Section 2.1.8`_ and `Appendix A: GeometryCollection`_ within `The GeoJSON Format Specification`_.
.. _Section 2.1.8: http://www.geojson.org/geojson-spec.html#geometry-collection
.. _Appendix A\: GeometryCollection: http://www.geojson.org/geojson-spec.html#geometrycollection
Feature
~~~~~~~
.. code:: python
>>> from geojson import Feature, Point
>>> my_point = Point((-3.68, 40.41))
>>> Feature(geometry=my_point) # doctest: +ELLIPSIS
{"geometry": {"coordinates": [-3.68..., 40.4...], "type": "Point"}, "properties": {}, "type": "Feature"}
>>> Feature(geometry=my_point, properties={"country": "Spain"}) # doctest: +ELLIPSIS
{"geometry": {"coordinates": [-3.68..., 40.4...], "type": "Point"}, "properties": {"country": "Spain"}, "type": "Feature"}
>>> Feature(geometry=my_point, id=27) # doctest: +ELLIPSIS
{"geometry": {"coordinates": [-3.68..., 40.4...], "type": "Point"}, "id": 27, "properties": {}, "type": "Feature"}
Visualize the results of the examples above `here <https://gist.github.com/frewsxcv/4488d30209d22685c075>`__. General information about Feature can be found in `Section 2.2`_ within `The GeoJSON Format Specification`_.
.. _Section 2.2: http://geojson.org/geojson-spec.html#feature-objects
FeatureCollection
~~~~~~~~~~~~~~~~~
.. code:: python
>>> from geojson import Feature, Point, FeatureCollection
>>> my_feature = Feature(geometry=Point((1.6432, -19.123)))
>>> my_other_feature = Feature(geometry=Point((-80.234, -22.532)))
>>> FeatureCollection([my_feature, my_other_feature]) # doctest: +ELLIPSIS
{"features": [{"geometry": {"coordinates": [1.643..., -19.12...], "type": "Point"}, "properties": {}, "type": "Feature"}, {"geometry": {"coordinates": [-80.23..., -22.53...], "type": "Point"}, "properties": {}, "type": "Feature"}], "type": "FeatureCollection"}
Visualize the result of the example above `here <https://gist.github.com/frewsxcv/34513be6fb492771ef7b>`__. General information about FeatureCollection can be found in `Section 2.3`_ within `The GeoJSON Format Specification`_.
.. _Section 2.3: http://geojson.org/geojson-spec.html#feature-collection-objects
GeoJSON encoding/decoding
-------------------------
All of the GeoJSON Objects implemented in this library can be encoded and decoded into raw GeoJSON with the ``geojson.dump``, ``geojson.dumps``, ``geojson.load``, and ``geojson.loads`` functions.
.. code:: python
>>> import geojson
>>> my_point = geojson.Point((43.24, -1.532))
>>> my_point # doctest: +ELLIPSIS
{"coordinates": [43.2..., -1.53...], "type": "Point"}
>>> dump = geojson.dumps(my_point, sort_keys=True)
>>> dump # doctest: +ELLIPSIS
'{"coordinates": [43.2..., -1.53...], "type": "Point"}'
>>> geojson.loads(dump) # doctest: +ELLIPSIS
{"coordinates": [43.2..., -1.53...], "type": "Point"}
Custom classes
~~~~~~~~~~~~~~
This encoding/decoding functionality shown in the previous can be extended to custom classes using the interface described by the `__geo_interface__ Specification`_.
.. code:: python
>>> import geojson
>>> class MyPoint():
... def __init__(self, x, y):
... self.x = x
... self.y = y
...
... @property
... def __geo_interface__(self):
... return {'type': 'Point', 'coordinates': (self.x, self.y)}
>>> point_instance = MyPoint(52.235, -19.234)
>>> geojson.dumps(point_instance, sort_keys=True) # doctest: +ELLIPSIS
'{"coordinates": [52.23..., -19.23...], "type": "Point"}'
Helpful utilities
-----------------
coords
~~~~~~
:code:`geojson.utils.coords` yields all coordinate tuples from a geometry or feature object.
.. code:: python
>>> import geojson
>>> my_line = LineString([(-152.62, 51.21), (5.21, 10.69)])
>>> my_feature = geojson.Feature(geometry=my_line)
>>> list(geojson.utils.coords(my_feature)) # doctest: +ELLIPSIS
[(-152.62..., 51.21...), (5.21..., 10.69...)]
map_coords
~~~~~~~~~~
:code:`geojson.utils.map_coords` maps a function over all coordinate tuples and returns a geometry of the same type. Useful for translating a geometry in space or flipping coordinate order.
.. code:: python
>>> import geojson
>>> new_point = geojson.utils.map_coords(lambda x: x/2, geojson.Point((-115.81, 37.24)))
>>> geojson.dumps(new_point, sort_keys=True) # doctest: +ELLIPSIS
'{"coordinates": [-57.905..., 18.62...], "type": "Point"}'
validation
~~~~~~~~~~
:code:`geojson.is_valid` provides validation of GeoJSON objects.
.. code:: python
>>> import geojson
>>> validation = geojson.is_valid(geojson.Point((-3.68,40.41,25.14)))
>>> validation['valid']
'no'
>>> validation['message']
'the "coordinates" member must be a single position'
generate_random
~~~~~~~~~~~~~~~
:code:`geojson.utils.generate_random` yields a geometry type with random data
.. code:: python
>>> import geojson
>>> geojson.utils.generate_random("LineString") # doctest: +ELLIPSIS
{"coordinates": [...], "type": "LineString"}
Development
-----------
To build this project, run :code:`python setup.py build`. To run the unit tests, run :code:`python setup.py test`.
Credits
-------
* Sean Gillies <sgillies@frii.com>
* Matthew Russell <matt@sanoodi.com>
* Corey Farwell <coreyf@rwell.org>
* Blake Grotewold <hello@grotewold.me>
* Zsolt Ero <zsolt.ero@gmail.com>
* Sergey Romanov <xxsmotur@gmail.com>
.. _GeoJSON: http://geojson.org/
.. _The GeoJSON Format Specification: http://www.geojson.org/geojson-spec.html
.. _\_\_geo\_interface\_\_ Specification: https://gist.github.com/sgillies/2217756
Keywords: gis geography json
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Topic :: Scientific/Engineering :: GIS
|