Display a map #505
-
Hi everyone, is there any tutorial on how to display a world map and how to display defined points on that map? Best |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hello ! Did you have a look at the documentation for the map component ? You can create a simple map with select
'map' as component;
select
'New Delhi' as title,
28.6139 as latitude,
77.209 as longitude; If you have a database table that looks like this: CREATE TABLE my_locations (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
latitude NUMERIC(9, 6) NOT NULL,
longitude NUMERIC(9, 6) NOT NULL
); Then you can show them on a map with -- Display map component
SELECT 'map' AS component;
-- Display each location
SELECT
name as title,
latitude,
longitude,
CONCAT('details.sql?id=', id) as link
FROM my_locations; |
Beta Was this translation helpful? Give feedback.
-
Here is a short step by step tutorial, supposing you have your data in a csv file Step 1: Prepare Your CSV FileEnsure you have a CSV file with your geo data. For this example, let's assume the CSV file is named
Step 2: Create a SQLite DatabaseFirst, you need to create a SQLite database and a table to store your data. You can use the sqlite3 sqlpage/sqlpage.db Once inside the SQLite prompt, create the table: CREATE TABLE important_locations (
id INTEGER PRIMARY KEY,
title TEXT NOT NULL,
icon TEXT,
color TEXT,
latitude REAL NOT NULL,
longitude REAL NOT NULL,
description_md TEXT,
link TEXT
); Step 3: Import CSV Data into SQLiteExit the SQLite prompt and use the sqlite3 sqlpage/sqlpage.db <<EOF
.mode csv
.import locations.csv important_locations
EOF Step 4: Query the Data with sqlpageWith your data loaded into the SQLite database, you can now query it using sqlpage.
|
Beta Was this translation helpful? Give feedback.
Hello ! Did you have a look at the documentation for the map component ?
You can create a simple map with
If you have a database table that looks like this:
Then you can show them on a map with