(lispkit draw map)
(import (lispkit base)
(lispkit draw)
(lispkit location)
(lispkit draw map)
(lispkit thread future))
;; Draws a map around location future `center` covering `area`
;; (a size object in meters) and return and image of size
;; `dims` (in points).
(define (map-drawing center area dims)
(let*
(; Create a map snapshot for the `area` around `center` of `size`
; displaying satellite footage
(snapsh (make-map-snapshot (future-get center) area dims 'satellite))
; Create an image from the snapshot
(image (map-snapshot-image (future-get snapsh)))
; Determine the points on the map image for the center
(pt (map-snapshot-point (future-get snapsh) (future-get center))))
; Create a drawing of the map with highlighted center
(drawing
; Draw the map at the origin of the drawing
(draw-image image (point 0 0))
; Highlight the center with a red circle
(set-fill-color red)
(fill-ellipse
(rect (point (- (point-x pt) 5) (- (point-y pt) 5))
(size 10 10))))))
;; Save a drawing for a map snapshot of size 800x800 (in points)
;; for a square map segment of 500m x 500m around the current location.
(save-drawing
"~/Downloads/my-map.pdf"
(map-drawing (current-location) (size 500 500) (size 800 800))
(size 800 800))Last updated