This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE INDEX ON cities USING GIST (geom); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
host your_database felt_user felt_ip_range md5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE cities ( | |
id SERIAL PRIMARY KEY, | |
name VARCHAR(100), | |
geom GEOMETRY(Point, 4326) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE USER felt_user WITH PASSWORD 'your_secure_password'; | |
GRANT CONNECT ON DATABASE your_database TO felt_user; | |
GRANT USAGE ON SCHEMA public TO felt_user; | |
GRANT SELECT ON ALL TABLES IN SCHEMA public TO felt_user; | |
-- Grant select permission on future tables | |
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO felt_user; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE EXTENSION postgis; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let mode: "idle" | "dragging" = "idle" | |
const dragHandler: InteractionHandler = { | |
onDragStart(gesture, app) { | |
if (intersection(gesture.elementsUnderCursor, app.selectedElements).size) { | |
mode = "dragging"; | |
} | |
}, | |
onPointerMove(gesture) { | |
// ignore pointer-moves when we haven't started dragging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (isScreenshot) return; | |
if (!isEditor) return; | |
if (isOnMap(event)) return; | |
if (sidebarState.displayedItem !== "comments") return; | |
if (hasDragged.check(event)) return; | |
if (currentTool !== "NONE") return; | |
if (isPanning) return; | |
if (isZooming) return; | |
if (event.shiftKey) return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<MapPosition> | |
<DragBox> | |
<SVGPolygon | |
path={pathFromCoordinates( | |
element.coords, | |
viewport | |
)} /> | |
</DragBox> | |
<SelectionFrame | |
polygon={selectionFramePolygon(element.coords, viewport)} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cache = new WeakMap<ElementCoords, Path2D>() | |
function getCachedPath(element) { | |
const fromCache = cache.get(element.coords) | |
if (fromCache) return fromCache; | |
const path = calculatePath(element.coords); | |
cache.set(element.coords, path); | |
return path; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getFullRouteGeometry(coords, viewport) { | |
const roundedZoom = Math.round(viewport.zoom) | |
const fromCache = cache.get(roundedZoom).get(coords) | |
if (fromCache) return clipToViewport(fromCache, viewport); | |
const simplified = simplify(coords, 1 / roundedZoom) | |
cache.get(roundedZoom).set(coords, simplified); | |
return clipToViewport(simplified, viewport); | |
} |
NewerOlder