... |
... |
@@ -1,6 +1,6 @@
|
1 |
1 |
#-*- coding: utf-8 -*-
|
2 |
2 |
import shapefile
|
3 |
|
-from json import dumps
|
|
3 |
+import json
|
4 |
4 |
|
5 |
5 |
path = "pyshp/shapefiles/blockgroups"
|
6 |
6 |
sf = shapefile.Reader(path)
|
... |
... |
@@ -16,5 +16,5 @@ for sr in sf.shapeRecords():
|
16 |
16 |
buffer.append(dict(type="Feature", geometry=geom, properties=atr))
|
17 |
17 |
|
18 |
18 |
geojson = open("pyshp-demo.geojson", "w")
|
19 |
|
-geojson.write(dumps({"type": "FeatureCollection", "features": buffer}, indent=2, ensure_ascii=False))
|
|
19 |
+geojson.write(json.dumps({"type": "FeatureCollection", "features": buffer}, indent=2, ensure_ascii=False))
|
20 |
20 |
geojson.close()
|