Skip to content

Display a map #505

Answered by lovasoa
schliesser-p asked this question in Q&A
Jul 23, 2024 · 2 comments · 4 replies
Discussion options

You must be logged in to vote

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;

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@schliesser-p
Comment options

Answer selected by schliesser-p
Comment options

You must be logged in to vote
3 replies
@lovasoa
Comment options

@schliesser-p
Comment options

@lovasoa
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants