In Kerry Studio, the map in results draws the geometry that arrived in the grid, beside the table. Without it, a POLYGON or a POINT in WKT stays as text in the cell. The Map button opens the split. The background uses OpenStreetMap.
How to use it
You need an open workspace, a connected SQL tab, and a result with geometry. If the result has no spatial column and no geometry in the cells, the Map button does not appear. A text column with WKT, EWKT, or GeoJSON is enough for the map. A native column (geometry, SDO_GEOMETRY, POINT, and the rest) needs the engine’s spatial support, described in Extensions per engine.
- Run a
SELECTthat returns a spatial column, WKT, EWKT, or GeoJSON. - In the results panel, click Map.
- The grid and the map stay together. Drag the splitter if you want more room for the map. The expand icon opens the map in an overlay window. Close map gives the full space back to the grid.
- In the geometry cell, the View on map button opens a map for that value only, like the JSON cell button. That map has zoom in, zoom out, and fit view. A click on the pin does not close the map.
- Next to Zoom in and Zoom out, Fit view frames every geometry in the result. The first time the map opens in the split, in the overlay window, or in the cell map, that framing is already applied. In the overlay window, the legend is larger.
The palette (⌘K / CtrlK) → Toggle results map does the same. The split does not open on its own. If you leave it open, that tab remembers. Switching tabs does not take the zoom with it.
Text
The Text pane shows the WKT of what is selected on the map: a result geometry or a drawing. With nothing selected, it asks you to click. One item is just the WKT, ready to paste. A merged group is one WKT of the union. Several items appear as blocks with the column name or Lasso 1, Rectangle 1, Ellipse 1. Shift, Ctrl, or ⌘ on the pointer adds or removes an item, without opening the card and without moving the map. On a MULTIPOLYGON, a click takes only the clicked island and shows a POLYGON. A click on the map background clears the selection. You can select the text with the mouse or with Shift and the arrow keys. You can copy it, or use the copy button. ⌘A or CtrlA selects only that WKT. The rest of the map fades so the chosen item stays visible. When every item is selected, nothing fades. A chosen pin gets a white outline. With more than one item, the bottom center of the map shows the count.
Flip lon/lat only changes the drawing. The value in the grid stays what the database returned. The Labels switch on the map bar shows the column name on each geometry. In a merged group, areas of the same column show the name once on the union. Pins keep one name each. It starts turned off. On a pin, the name stays beside it and does not jump when you zoom. On an area, the name sits just outside the outline, not inside the fill. The colors follow the theme in use. If two names would occupy the same place, the map shows only what fits. Zoom in to see the rest.
Drawing and SQL
Select is the default tool: click a drawing or a geometry to choose it, drag that drawing to move it. Dragging does not pan the map. Click and drag on the map background to select the drawings and geometries the rectangle crosses, not the empty space around them. Shift, Ctrl, or ⌘ add to the selection. ⌘A or CtrlA selects every geometry and drawing. Click a closed drawing to choose it even with Lasso, Rectangle, or Ellipse on. Hand pans the map. After you click the map, V, H, L, R, and E choose Select, Hand, Lasso, Rectangle, and Ellipse. Those keys do nothing in the SQL editor. Switching tools in the middle of a stroke cancels that stroke and starts drawing in the new shape. Lasso lets you draw several freehand outlines. Rectangle and Ellipse draw when you drag. Shift on the rectangle or the ellipse keeps the sides equal. Each mouse-up closes a polygon and you can draw the next. Delete drawing removes the selected drawings. Esc cancels the current stroke, then the selection, then returns to the pointer, and only then closes the overlay window. Closing that window or the map leaves drawing mode and returns to the pointer. Closed drawings stay until a new query. Switching tabs does not clear those drawings, nor the bar modes, such as Measures.
Paste polygon into SQL inserts, at the editor cursor, the selected polygon, or every drawing if none is selected. One polygon becomes a POLYGON. Several become a spatial union in the tab’s dialect. A merged group pastes the union painted on the map, query geometry and drawing together. If that union stayed in pieces, the SQL carries those pieces. Measures shows the number of each one. Pins stay out of that SQL. On PostgreSQL and MySQL, Kerry pastes ST_GeomFromText. On Oracle it pastes SDO_GEOMETRY. On SQLite it pastes GeomFromText. That SQL needs the engine’s spatial functions, the same ones in Extensions per engine. ST_Intersects remains SQL of the tab’s engine. That button pastes only the polygon, without the area. Copy polygon puts the same SQL on the clipboard. With no polygon, both buttons stay inactive.
Merge turns the selection into a group, paints the union in green, and clears the original fill. Measures does not need to be on. Each new drawing is added to the current selection. You can merge a query geometry with a drawing. You can draw two shapes and merge them without switching tools. Each merge stays until you choose Unmerge. You can merge two items, then another two, without undoing the groups you already made. A click on a member selects the whole group. Dragging a member moves the whole group. If the selection is exactly one group, the button becomes Unmerge. If you select two groups and merge, they become one. G merges. ShiftG unmerges. With fewer than two items selected, the button does not merge anything. If the areas do not meet, the union stays in separate pieces. ⌘Z or CtrlZ undoes create, move, delete, and merge or unmerge. ⌘ShiftZ or CtrlShiftZ redoes. The bar also has Undo and Redo. With nothing to undo or redo, those buttons stay inactive.
Measures
Measures on the map bar shows the size of each polygon, in the unit you pick: m², ha, or km². The number in the legend, on the selection chip, and on the polygon label includes that unit. Each island of a MULTIPOLYGON gets its own number on the map. The number uses the coordinates in the cell, or the lon/lat of the drawing. It also turns on the column total. Identical copies of the same polygon, such as those a JOIN stacks, count once in that total. With a merged group, the green union label and the Merges row in the legend show the same total. The selection chip also shows only the union. Without Merge, two selected items show the total and the overlap. If the coordinate system cannot support that number, the polygon stays on the map and the figure does not appear. Points and lines stay out. A new query clears the drawings and their measures with them. The unit you chose stays while the map is open. Switching tabs does not turn Measures off.
Columns on the map
Each geometry column in the result gets a color. Points and areas use different palettes. A point uses the map pin from the interface. The legend uses the column name, or the alias if the SELECT has one. If the SELECT has i.localizacao AS moradia and z.geom AS inundacao, the legend shows moradia and inundacao. The JOIN stays in the SQL. The map only paints what already arrived in the result. A click on a pin opens a card with that column name in the title and the other values of the row (text, number, date). The geometry itself does not appear in the card. If the result only has areas, a click on the area opens the card. With pins and areas together, the area does not open the card, so joined rows do not get mixed.
Layers, image export, and print
The default background is OpenStreetMap. The background selector only appears when you add another layer in Settings, under Map layers, with an HTTPS tile URL {z}/{x}/{y}. If the background fails, the polygons stay on the neutral background.
The Export map menu opens PNG, SVG, WebP, and GeoJSON. PNG, SVG, and WebP save the map of the result geometries, with the street background, sized to the content. The on-screen crop does not define the file. The Labels switch starts on and writes the column name (or the SELECT alias) in the same place as the map: just outside each area outline and beside each pin. The same menu has Image Theme, with Dark and Light. Label and legend colors follow that theme. The same menu has Measures, the unit selector (m², ha, or km²), and Merges. Those controls apply only to the file. You can export the numbers without turning Measures on in the map bar. With Measures on in that menu, the file includes the area numbers, the overlap fill, and the totals in the legend. With Merges on, the unions you already made on the map go into the file still grouped. If the union is areas of the same column, the file shows that name once on the union. Pins keep one name each. Merges in the file do not require Measures in that menu. If the map has drawings, the Drawings switch also starts on and draws those polygons in the file. You can turn it off to export only the query geometries. GeoJSON writes the map geometries, without the street background. The query is always included. Drawings and merges go in if those switches are on. With Measures on, each geometry includes its area. With Labels on, the column name goes in. If a merge stayed in pieces, the file carries those pieces. Print uses the same switches and the image theme. The street background credits stay as they appear on the map. PNG and WebP are high-resolution raster. SVG puts the street background at high resolution and the geometries as vectors. Print opens the print dialog for that map with the background.
Extensions per engine
Native types in create table and alter table, and the SQL pasted as ST_GeomFromText, SDO_GEOMETRY, or GeomFromText, need the engine’s spatial support. Kerry does not install that extension for you. The map still draws WKT, EWKT, and GeoJSON that already arrived in the cell.
PostgreSQL. Needs the PostGIS extension. Without it, GEOMETRY and GEOGRAPHY appear in create table and alter table, and Kerry warns that the type needs PostGIS. In PostgreSQL itself, CREATE EXTENSION postgis installs PostGIS on the database.
MySQL and MariaDB. Spatial types are native (GEOMETRY, POINT, POLYGON, and the rest). There is no extra extension.
Oracle. Needs Locator or Spatial. Without the SDO_GEOMETRY type on the database, Kerry warns in create table and alter table. With that support, the column is SDO_GEOMETRY.
SQLite. Needs SpatiaLite. In the SQLite connection, under Extensions, add the extension file and turn on Load on connect. Until SpatiaLite loads, spatial types do not appear in the list. Once it is loaded, GEOMETRY, POINT, POLYGON, and the other SpatiaLite types appear.
Details
- The map is not a third way to view the result. It splits the panel with the grid.
- The drawing follows the WKT in the cell. A four-corner
POLYGONappears as a rectangle because that is what the value describes. AMULTIPOLYGONwith many vertices appears with the irregular outline of those vertices. - The type in the column tooltip is the catalog type. A PostGIS point shows as
geometry(Point,4326), not onlygeometry. The spatial icon still appears for any of those types. - It works on the four engines of the tab: PostgreSQL, MySQL/MariaDB, Oracle, and SQLite.
- A query with
@project.tablefrom another project materializes the rows on the tab connection. If that destination has GIS, the temporary table uses the native spatial type. If it does not, the geometry goes as EWKT text.