Map view

functional

Put Redis GEO replies, longitude/latitude columns, and WKT or WKB shapes on an OpenStreetMap street map you can pan, zoom, and click through to the row.

When a result has locations in it - a Redis GEOSEARCH reply, a table with longitude and latitude columns, or a column of spatial shapes - SQLly can draw them on a street map you can pan and zoom. Hover a point to see which row it is, click it to jump to that row in the grid, and switch to a heatmap when there are too many points to read one by one.

SQLly
The map window over a result with longitude and latitude columns: OpenStreetMap tiles, one marker per row, a hover label, and the Points/Heatmap/Both, zoom, Fit, and Options controls in the toolbar.The map window over a result with longitude and latitude columns: OpenStreetMap tiles, one marker per row, a hover label, and the Points/Heatmap/Both, zoom, Fit, and Options controls in the toolbar.
The map window over a result with longitude and latitude columns: OpenStreetMap tiles, one marker per row, a hover label, and the Points/Heatmap/Both, zoom, Fit, and Options controls in the toolbar.

Opening a map

  • From the results grid. Right-click any cell and choose Tools › Show on Map…. The whole result set opens in its own map window, so you can keep it beside the grid while you work.
  • Automatically. A -- sqlly map: line with open=auto, or -- sqlly view: map as the query's first line, opens the map every time the query finishes.
  • From a single geometry value. Right-click a cell holding a shape and choose View Geometry… (or select it with the Cell Details panel open). The viewer's toolbar has a Sketch / Map / Raw switch; Map puts that one shape on the street map.

What can be mapped

Redis GEO replies

GEOSEARCH, GEORADIUS, GEORADIUSBYMEMBER, and GEOPOS come back as a grid with member, dist, lon, and lat columns when you ask for coordinates. Add WITHCOORD so the reply carries them:

GEOSEARCH stores FROMLONLAT -0.1278 51.5074 BYRADIUS 50 km WITHCOORD WITHDIST ASC

Each member becomes a point, labelled with its name. Geo-shape fields from Redis search replies (FT.SEARCH over a GEOSHAPE field) arrive as well-known text and are mapped like any other geometry column.

SQLly
A Redis GEOSEARCH WITHCOORD reply on the map: each store member as a point on the street map.A Redis GEOSEARCH WITHCOORD reply on the map: each store member as a point on the street map.
A Redis GEOSEARCH WITHCOORD reply on the map: each store member as a point on the street map.

Longitude and latitude columns

Any result with a longitude column and a latitude column can be mapped. SQLly finds them by name, ignoring case, by looking at the words in the column name:

  • Longitude - a word lon, lng, long, or longitude: lon, LNG, pickup_lon, StartLongitude.
  • Latitude - a word lat or latitude: lat, dropoff_lat, EndLatitude.

Words are split at underscores, spaces, dots, hyphens, and capital letters, so latency, plate, or longest are never mistaken for coordinates. Values can be numbers or numeric text. Rows with a missing value, or a longitude outside -180 to 180 or latitude outside -90 to 90, are left off the map and counted in the toolbar as rows without a location.

When there is more than one pair - say pickup_lon/pickup_lat and dropoff_lon/dropoff_lat - columns that share the rest of their name are paired up, and the map opens with its Options panel showing, where the Locations picker switches between them (or write lat= and lon= in a map directive). If nothing pairs by name, every longitude/latitude combination is offered.

SELECT trip_id, pickup_lon, pickup_lat, dropoff_lon, dropoff_lat
FROM trips
WHERE trip_date = '2026-10-01';

Geometry columns (WKT and WKB)

A column whose values are spatial shapes is mapped too: points, line strings, polygons (holes included), their multi- forms, and geometry collections. SQLly reads:

  • Well-known text, optionally with an SRID prefix: POINT(-0.12 51.5), SRID=4326;POLYGON((...)).
  • Well-known binary, as bytes or as hex text - which is how PostGIS returns a geometry column by default - including the extended form that carries an SRID, and MySQL's own spatial value format.

A column counts as geometry when its type is spatial (geometry, geography, point, and so on) and at least one of its first 20 non-NULL values parses, or when all of its first 20 non-NULL values parse whatever the type. A multi-part shape is drawn as its parts, all labelled with the same row. SQL Server's native geometry/geography bytes are not well-known binary, so select shape.STAsText() or shape.STAsBinary() instead of the raw column.

SELECT name, boundary.STAsText() AS boundary
FROM dbo.DeliveryZones;
SQLly
Polygons and a line from a well-known-text column drawn over the street map, with the stores as points.Polygons and a line from a well-known-text column drawn over the street map, with the stores as points.
Polygons and a line from a well-known-text column drawn over the street map, with the stores as points.
Coordinate systems. The street map is longitude/latitude (WGS 84, SRID 4326). Shapes with SRID 4326, or with no SRID and coordinates inside the longitude/latitude ranges, go on the street map. Shapes in any other system - a national grid or a UTM zone, say SRID=27700 - are still drawn, pannable and zoomable, but as a sketch without the street map, with a note naming the SRID. SQLly does not reproject them; transform them in the query (for example ST_Transform(geom, 4326) in PostGIS) to see them on the map.

Street map tiles from OpenStreetMap

The street map is made of image tiles from the OpenStreetMap project, downloaded from tile.openstreetmap.org. SQLly never contacts the tile server until you say so.

  • You are asked once. The first time a map opens, a prompt explains what would be downloaded. Load map tiles turns tiles on; Not now, use a sketch keeps them off. Either answer is remembered.
  • Only map images are fetched. Requests ask for the tiles covering the area on screen, nothing else. Your query results, column names, and coordinates are never sent anywhere.
  • Polite downloading. At most two tiles download at once, only for the part of the map you are looking at (nothing is fetched ahead of you), and requests identify themselves as SQLly with its version, as the OpenStreetMap tile usage policy asks.
  • Attribution. While tiles are showing, © OpenStreetMap contributors sits in the map's bottom-right corner; click it to open OpenStreetMap's copyright and license page.
  • Turning tiles on or off later. Use Settings › Results › General › Maps › Load street map tiles from OpenStreetMap, or the Turn on map tiles button in the map's note bar after declining.
SQLly
The first-use prompt over a new map: Load the street map from OpenStreetMap?, with Load map tiles and Not now, use a sketch.The first-use prompt over a new map: Load the street map from OpenStreetMap?, with Load map tiles and Not now, use a sketch.
The first-use prompt over a new map: Load the street map from OpenStreetMap?, with Load map tiles and Not now, use a sketch.

The tile cache

Every tile is saved on your computer and reused for 14 days before it is downloaded again, so revisiting an area costs nothing and the tile server is not asked twice. Tiles live in a map-tiles folder in SQLly's data folder:

PlatformFolder
macOS~/Library/Application Support/SQLLY/map-tiles
Windows%APPDATA%\SQLLY\map-tiles
Linux~/.local/share/SQLLY/map-tiles

It is safe to delete the folder at any time; tiles are fetched again as you need them.

Without tiles: the sketch

If you decline tiles, are offline, or are using SQLly in the browser, the map still works: the same points, lines, and polygons are drawn on a plain background with a light 30° grid of meridians and parallels, and pan, zoom, fit, hover, click, and the heatmap all behave the same. A note under the toolbar says why there is no street map. When a download fails because the tile server cannot be reached, SQLly stops asking, uses any tiles it already has cached, and offers Retry.

SQLly
The same result drawn as a sketch after declining tiles: markers on a plain background with a light latitude/longitude grid and the Turn on map tiles button.The same result drawn as a sketch after declining tiles: markers on a plain background with a light latitude/longitude grid and the Turn on map tiles button.
The same result drawn as a sketch after declining tiles: markers on a plain background with a light latitude/longitude grid and the Turn on map tiles button.

The Options panel

Click Options at the right of the map's toolbar to open a panel with every setting the map has. Each change redraws the map straight away.

  • Data - Locations (Auto, or one of the detected longitude/latitude pairs and geometry columns), Label (the hover title), Tooltip columns (extra lines in the hover tooltip), Color by (a palette for text, a gradient for numbers, with a legend underneath), and Size by (bigger markers for bigger numbers).
  • Layers - Show points, a heatmap, or both; Cluster markers groups markers that crowd each other into one circle (hover it for the count, click it to zoom in); and, for the heatmap, weight, radius, blur, intensity, opacity, and palette.
  • Map - Street map on or off for this result, what clicking a feature does, whether the map opens on run, the most features to draw, and the starting view (fit to the data, or remember the view you are looking at now).
  • Directive - the -- sqlly map: line these settings make. Copy puts it on the clipboard; Write to Query writes it into the query's lock block, so the map comes back the same way on every run, for anyone who opens the file.
SQLly
The map's Options panel: Data, Layers, and Map sections, a color legend, and the -- sqlly map: line with Copy and Write to Query.The map's Options panel: Data, Layers, and Map sections, a color legend, and the -- sqlly map: line with Copy and Write to Query.
The map's Options panel: Data, Layers, and Map sections, a color legend, and the -- sqlly map: line with Copy and Write to Query.

Moving around

ToDo this
PanDrag the map. It wraps around the globe sideways, so you can keep dragging past the date line.
ZoomScroll the mouse wheel or pinch on a trackpad - the spot under the pointer stays put - or use the − and + buttons, which zoom one level around the center. Street maps go from the whole world (level 0) to street level (level 19).
See everythingFit zooms so every plotted feature is in view. A map opens fitted. Data on both sides of the date line is framed the short way across it.
Identify a featureHover it. The tooltip shows the row's name: a Redis member, or a column called key, name, label, title, or id, else the first text column; failing that, the row number.
Find its rowClick it. The feature is highlighted and the row is selected and scrolled into view in the grid the map came from (turn this off with Click a feature in the Options panel, or click=none).
Open a clusterWith Cluster markers on, crowded markers become one circle; hover it for how many locations it holds, click it to zoom in until it splits.

Clicking selects grid rows for results opened with Show on Map; a map opened from the Pivot tab or from a single value in the viewer has no rows to select. For a very large result whose rows are paged in from disk, a click selects the row only while that part of the result is loaded in the grid.

Very large results

A map draws at most 50,000 features (fewer if you set Most features in the Options panel, or limit=). Past that, the first 50,000 are drawn and the toolbar says Showing 50,000 of N features, so you always know when part of the data is missing. Each part of a multi-part shape counts as one feature. The map reads the rows the grid has in memory, so for a result too large to hold, filter or sample it in the query - or aggregate it - when you need the whole picture.

Map directive

A -- sqlly map: comment in the query sets how its result is mapped, the same way grid: sets the grid. It is what the Options panel's Write to Query button writes, and every setting below can also be changed from the panel.

-- sqlly map: <setting>; <setting>…
-- sqlly map <n>: <setting>; <setting>…

Settings are key=value, separated by ;, in any order. Without a number the line applies to every result set of the run; map 2: applies only to the second, counting from 1. When several lines apply, later settings override earlier ones. Column names match ignoring case, and are written in double quotes when they contain a space or any of , ; : = " | (double a quote inside one).

SettingMeaningExample
lat=col; lon=colThe latitude and longitude columns. Overrides detection by name; both are needed.lat=y; lon=x
geom=colA geometry column in well-known text or binary. Overrides detection.geom=boundary
srid=nThe data's coordinate system. Anything other than 4326 is drawn as a sketch without the street map.srid=27700
label=colThe hover title. Default: member, key, name, label, title, id, or the first text column.label=store_name
tooltip=a, bExtra column: value lines in the hover tooltip.tooltip=city, revenue
mode=points|heatmap|bothMarkers, a heatmap, or the heatmap with markers on top. Lines and polygons are always drawn.mode=both
color=colColor markers and shapes by a column: up to 12 colors for text values (the rest share one), a gradient for numbers.color=region
size=colScale marker size by a numeric column, smallest to largest value.size=revenue
weight=colWeight each location's heat by a numeric column (NULL and negative count as 0).weight=orders
radius=pxHow far each location's heat spreads, 6 to 120 screen pixels (default 24).radius=30
blur=pxExtra softening of the heat, 0 to 200 pixels (default 0).blur=12
intensity=nBoost faint heat toward the hot end, 0 to 10 (default 1).intensity=2
opacity=nMaximum opacity of the heat layer, 0 to 1 (default 0.8).opacity=0.6
palette=nameHeat colors: heat (blue to red, default), fire, viridis (color-blind friendly), ocean, or accent (your theme's accent color).palette=viridis
cluster=on|offGroup crowded markers into counted circles.cluster=on
basemap=osm|noneThe OpenStreetMap street map, or none for this result. osm never downloads tiles you have not agreed to.basemap=none
center=lat,lon; zoom=nThe starting view; zoom 0 (world) to 19 (street).center=51.5,-0.12; zoom=10
fit=dataStart framed on every feature (the default; overrides center and zoom).fit=data
limit=nMost features to draw; anything above 50,000 counts as 50,000.limit=5000
click=select|noneWhether clicking a feature selects its row in the grid (default select).click=none
open=auto|manualOpen the map automatically every time the query finishes, or only from Show on Map… (default).open=auto

-- sqlly view: map as the query's first line is a shortcut for open=auto on the first result: the grid opens as usual and the map window opens beside it. When a map for the result is already open, a re-run refreshes that window instead of opening another.

A misspelled setting or a bad value is underlined in the editor with the reason (for example Map directive: unknown setting “colour”); the other settings on the line still apply and the query runs normally. A column the result does not have is skipped, and the map window says which ones it skipped.

Examples

Stores as points, labelled, with the city in the tooltip:

-- sqlly map: lat=latitude; lon=longitude; label=store_name; tooltip=city
SELECT store_name, city, latitude, longitude FROM stores;

A heatmap of orders, weighted by order count:

-- sqlly map: mode=heatmap; weight=orders; radius=30; palette=fire
SELECT postcode_lat AS lat, postcode_lon AS lon, COUNT(*) AS orders
FROM orders GROUP BY postcode_lat, postcode_lon;

Colored, sized, clustered markers for the second result, opened on every run:

-- sqlly map 2: color=region; size=revenue; cluster=on; open=auto
SELECT COUNT(*) FROM branches;
SELECT branch, region, revenue, lat, lon FROM branches;

A Redis GEOSEARCH, opened on the map automatically:

-- sqlly view: map
-- sqlly map: tooltip=dist; zoom=8; center=51.5074,-0.1278
GEOSEARCH stores FROMLONLAT -0.1278 51.5074 BYRADIUS 50 km WITHCOORD WITHDIST ASC

Projected shapes, drawn as a sketch:

-- sqlly map: geom=boundary; srid=27700; basemap=none
SELECT name, ST_AsText(boundary) AS boundary FROM parishes;

In the browser

The browser version of SQLly never downloads map tiles. Show on Map and the viewer's Map mode open the sketch directly - no prompt - with a note that tiles are not available in the browser.