Live-Updating Map Error
Project ID: e738da6d-ea8b-45ba-8e5d-35989196c9ac
The following links are referenced in the text.
1. What I’m trying to create: https://www.weather.gov/
2. https://tgftp.nws.noaa.gov/SL.us008001/DF.sha/DC.cap/DS.WWA/
3. Fiona Docs: https://fiona.readthedocs.io/en/latest/cli.html#cat
I’m following this mapbox tutorial: https://docs.mapbox.com/mapbox-tiling-service/guides/tileset-sources/
My goal (1) is to run a script that will periodically update national weather service alerts on a mapbox map but I’m having trouble getting it to work on Railway. Before explaining the error, this is the process:
1. Download and extract a tar.gz file from (2) (resulting in a folder with a shapefile)
2. Convert the shapefile to a geojson line-delimited file
3. Upload the geojson to mapbox
This process works fine on my computer.
On Railway, the file downloads okay, extracts okay, then runs into an error on step 2. The error is:
Traceback (most recent call last):
File "/opt/venv/bin/fio", line 5, in <module>
from fiona.fio.main import main_group
File "/opt/venv/lib/python3.8/site-packages/fiona/init.py", line 86, in <module>
from fiona._env import (
ImportError: libexpat.so.1: cannot open shared object file: No such file or directory
The line of code that causes the error is:
os.system('fio cat current_all/current_all.shp > current_all.geojson.ld')
What this line is trying to do is grab the extracted alerts layer (current_all/current_all.shp) and convert it to current_all.geojson.ld using a program called Fiona (3). It uses the command line rather than an imported module.
I know this is a pretty specific issue but figure I’d ask anyway.
7 Replies
Project ID:
e738da6d-ea8b-45ba-8e5d-35989196c9ac
add that as a nixpacks.toml file to your project
Is this right?
Did this but I’m still getting the same error and additional errors. I hadn’t brought this up but step 3 was also not working and was returning the line “sh: 1: tilesets: command not found,” but in trying to figure out step 2 I figured out step 3 through the build logs which was to change a couple packages to older versions, so at least there’s that.
Error I got:
Traceback (most recent call last):
File "/opt/venv/bin/fio", line 5, in <module>
from fiona.fio.main import main_group
File "/opt/venv/lib/python3.8/site-packages/fiona/init.py", line 86, in <module>
from fiona._env import (
ImportError: libexpat.so.1: cannot open shared object file: No such file or directory
-
Traceback (most recent call last):
File "/opt/venv/lib/python3.8/site-packages/cligj/features.py", line 74, in iter_features
first_line = next(geojsonfile)
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/venv/bin/tilesets", line 8, in <module>
sys.exit(cli())
File "/opt/venv/lib/python3.8/site-packages/click/core.py", line 1128, in call
return self.main(args, kwargs)
File "/opt/venv/lib/python3.8/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/opt/venv/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/opt/venv/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, ctx.params)
File "/opt/venv/lib/python3.8/site-packages/click/core.py", line 754, in invoke
return __callback(args, kwargs)
File "/opt/venv/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, kwargs)
File "/opt/venv/lib/python3.8/site-packages/mapbox_tilesets/scripts/cli.py", line 544, in upload_source
return _upload_source(
File "/opt/venv/lib/python3.8/site-packages/mapbox_tilesets/scripts/cli.py", line 585, in _upload_source
for index, feature in enumerate(features):
File "/opt/venv/lib/python3.8/site-packages/cligj/features.py", line 38, in normalize_feature_inputs
for feature in iter_features(iter(src)):
RuntimeError: generator raised StopIteration
okay you might just be better off deploying this app with a custom dockerfile
Never looked into this but I'll try to figure it out. Is this something I can just google/youtube and figure out?
"dockerfile for python"