Add geojson shapefile
In [1]:
import icechart
import os
In [2]:
m = icechart.Map()
m
In [3]:
in_shp = "./data/countries.shp"
In [4]:
m.add_shapefile(in_shp, layer_name = "Shapefile")
--------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) <ipython-input-4-af61ad44119d> in <module> ----> 1 m.add_shapefile(in_shp, layer_name = "Shapefile") c:\users\user\icechart\icechart\icechart.py in add_shapefile(self, in_shp, style, layer_name) 102 def add_shapefile(self, in_shp, style=None, layer_name="Untitled"): 103 --> 104 geojson = shp_to_geoson(in_shp) 105 self.add_geojson(geojson, style=style, layer_name=layer_name) 106 c:\users\user\icechart\icechart\icechart.py in shp_to_geoson(in_shp, out_geojson) 119 """ 120 import json --> 121 import shapefile 122 123 in_shp = os.path.abspath(in_shp) ModuleNotFoundError: No module named 'shapefile'
In [ ]:
jsondata = "./data/countries.json"
In [ ]:
style = {
"stroke": True,
"color": "#ff0000",
"weight": 2,
"opacity": 1,
"fill": True,
"fillColor": "#000000",
"fillOpacity": 0.4,
}
In [ ]:
m.add_geojson(jsondata, style=style, layer_name= 'World-boundary')
In [ ]:
m
In [ ]:
Last update: 2021-04-04