-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mrc-6064 serve tile data #2
Conversation
tileData = await db.getTileData( | ||
parseInt(z), | ||
parseInt(x), | ||
parseInt(y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error handling for bad requests where these values aren't parseable to be done in https://mrc-ide.myjetbrains.com/youtrack/issue/mrc-6085/Error-handling
Also where requested dataset or level don't exist.
The test.html page appeared to work but gave these console messages, is this expected? Could be firefox-specific. There was nothing odd on the server logs except that there was a constant, fair mix of 200s and 404s (is that expected?)
Example of the end of the server logs with 200s and 404s
|
Yes, that's expected. It's because we stole the tile geojson from the original arbomap dataset and that only covers countries in the equatorial band, but leaflet is trying to load the whole world, so there are some missing tiles returning 404s.
I'm not seeing this myself on Firefox. Seems like it's related to accessibility toolkit on Linux, but not sure why this page would be triggering these messages if others don't. https://stackoverflow.com/questions/75406844/not-loading-module-atk-bridge-the-functionality-is-provided-by-gtk-natively |
I tried loading a nearly-empty HTML template and it had the same messages. Maybe it's something particular to my computer then. |
@@ -24,6 +24,7 @@ | |||
"cors": "^2.8.5", | |||
"express": "^4.21.1", | |||
"morgan": "^1.10.0", | |||
"sqlite": "^5.1.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The slightly nicer sqlite package, which calls itself node-sqlite
and is listed as sqlite
on npm. We still need sqlite3
which is used as the db driver.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I still have a single quibble about using the word 'row'...
clarify comment Co-authored-by: David Mears <60350599+david-mears-2@users.noreply.github.com>
I've talked Anmol through this now, and he's happy with it, so will merge. |
This branch adds a database class and controller to return tile data from the server.
It also includes a
discoverTileDatasets
method which runs on server start-up, which looks for available tile datasets in thedata
folder. Tile datasets are expected to be provided in folders underdata
, where the folder name is interpreted as the dataset name. Each folder is expected to contain.mbtiles
database files, where the name of each file is interpreted as the level it represents.Tile data is then returned from endpoint:
/tile/:dataset/:level/:z/:x/:y
. Discovered datasets are included inapp.locals
so they can be used by the controller.Example databases are included - these are levels 0 (country) and 1 (region) that we used for arbomap, in a dataset called "gadm41".
A test page,
test.html
is also included to sanity check that we're returning valid tile data. Make sure the server is running locally (npm run dev
) before opening the page in your browser.I've included a very basic integration test, and will add a browser test for this test page in a subsequent ticket.
When running the server in a docker container, the required dataset folders should be mounted as a volume to
/data
.