add_shapefile
In [1]:
Copied!
import geogee
import os
import geogee
import os
C:\Users\Sarath_Kin\miniconda3\envs\demo310\lib\site-packages\google\api_core\_python_version_support.py:266: FutureWarning: You are using a Python version (3.10.19) which Google will stop supporting in new releases of google.api_core once it reaches its end of life (2026-10-04). Please upgrade to the latest Python version, or at least Python 3.11, to continue receiving updates for google.api_core past that date. warnings.warn(message, FutureWarning)
In [2]:
Copied!
m = geogee.Map()
m
m = geogee.Map()
m
Out[2]:
In [3]:
Copied!
style = {
"stroke": True,
"color": "#ff0000",
"weight": 2,
"opacity": 1,
"fill": True,
"fillColor": "#0000ff",
"fillOpacity": 0.4,
}
style = {
"stroke": True,
"color": "#ff0000",
"weight": 2,
"opacity": 1,
"fill": True,
"fillColor": "#0000ff",
"fillOpacity": 0.4,
}
In [4]:
Copied!
in_geojson = r"C:/Users/Sarath_Kin/geogee/examples/data/us_states.geojson"
in_geojson = r"C:/Users/Sarath_Kin/geogee/examples/data/us_states.geojson"
In [5]:
Copied!
os.path.abspath(in_geojson)
os.path.abspath(in_geojson)
Out[5]:
'C:\\Users\\Sarath_Kin\\geogee\\examples\\data\\us_states.geojson'
In [6]:
Copied!
in_shp = "./data/countries.shp"
in_shp = "./data/countries.shp"
In [7]:
Copied!
out_geojson = "./data/countries_json.geojson"
out_geojson = "./data/countries_json.geojson"
In [8]:
Copied!
m.add_shapefile(in_shp, style=style, layer_name= "countries")
m.add_shapefile(in_shp, style=style, layer_name= "countries")
--------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) Cell In[8], line 1 ----> 1 m.add_shapefile(in_shp, style=style, layer_name= "countries") File L:\Coding\Github\geogee\geogee\geogee2.py:121, in Map.add_shapefile(self, in_shp, style, layer_name) 119 def add_shapefile(self, in_shp, style=None, layer_name="Untitled"): 120 """Adds a shapefile layer to the map.""" --> 121 geojson = shp_to_geojson(in_shp) 122 self.add_geojson(geojson, style=style, layer_name=layer_name) File L:\Coding\Github\geogee\geogee\geogee2.py:34, in shp_to_geojson(in_shp, out_geojson) 31 in_shp = os.path.abspath(in_shp) 33 if not os.path.exists(in_shp): ---> 34 raise FileNotFoundError("The provided shapefile could not be found.") 36 sf = shapefile.Reader(in_shp) 37 geojson = sf.__geo_interface__ FileNotFoundError: The provided shapefile could not be found.