|
Revision 1504, 0.7 KB
(checked in by mattrussell, 8 months ago)
|
|
Simplify code. Remove custom mapping object. add more tests for falling through to json, crs and strict json. Fixes #186
|
| Line | |
|---|
| 1 | CRS annotation |
|---|
| 2 | -------------- |
|---|
| 3 | |
|---|
| 4 | >>> import geojson |
|---|
| 5 | >>> import geojson.crs |
|---|
| 6 | |
|---|
| 7 | By default, no CRS information is present. One should assume WGS84. |
|---|
| 8 | >>> geojson.Point([0.0, 0.0]) |
|---|
| 9 | {"coordinates": [0.0, 0.0], "type": "Point"} |
|---|
| 10 | |
|---|
| 11 | Including crs |
|---|
| 12 | >>> crs = geojson.crs.Named(properties=dict(name="urn:ogc:def:crs:EPSG::3785")) |
|---|
| 13 | >>> point = geojson.Point([0.0, 0.0], crs=crs) |
|---|
| 14 | >>> point |
|---|
| 15 | {"coordinates": [0.0, 0.0], "crs": {"properties": {"name": "urn:ogc:def:crs:EPSG::3785"}, "type": "name"}, "type": "Point"} |
|---|
| 16 | |
|---|
| 17 | >>> geojson.dumps(point, sort_keys=True) |
|---|
| 18 | '{"coordinates": [0.0, 0.0], "crs": {"properties": {"name": "urn:ogc:def:crs:EPSG::3785"}, "type": "name"}, "type": "Point"}' |
|---|
| 19 | |
|---|
| 20 | |
|---|