LispPad
  • Home
  • Applications
    • 🖥️LispPad
      • Sessions
      • Editor
      • Preferences
    • 📱LispPad Go
    • 📜Language
    • 📖Libraries
  • Libraries
    • ⚙️LispKit
      • (lispkit archive tar)
      • (lispkit archive zip)
      • (lispkit base)
      • (lispkit bitset)
      • (lispkit box)
      • (lispkit bytevector)
      • (lispkit char)
      • (lispkit char-set)
      • (lispkit combinator)
      • (lispkit comparator)
      • (lispkit control)
      • (lispkit core)
      • (lispkit crypto)
      • (lispkit csv)
      • (lispkit datatype)
      • (lispkit date-time)
      • (lispkit debug)
      • (lispkit disjoint-set)
      • (lispkit draw)
      • (lispkit draw turtle)
      • (lispkit draw barcode)
      • (lispkit draw chart bar)
      • (lispkit dynamic)
      • (lispkit enum)
      • (lispkit format)
      • (lispkit graph)
      • (lispkit gvector)
      • (lispkit hashtable)
      • (lispkit heap)
      • (lispkit http)
      • (lispkit http oauth)
      • (lispkit http server)
      • (lispkit iterate)
      • (lispkit json)
      • (lispkit json schema)
      • (lispkit list)
      • (lispkit list set)
      • (lispkit log)
      • (lispkit markdown)
      • (lispkit match)
      • (lispkit math)
      • (lispkit math matrix)
      • (lispkit math stats)
      • (lispkit math util)
      • (lispkit object)
      • (lispkit port)
      • (lispkit prolog)
      • (lispkit queue)
      • (lispkit record)
      • (lispkit regexp)
      • (lispkit serialize)
      • (lispkit set)
      • (lispkit sqlite)
      • (lispkit stack)
      • (lispkit stream)
      • (lispkit string)
      • (lispkit styled-text)
      • (lispkit system)
      • (lispkit system call)
      • (lispkit system keychain)
      • (lispkit system pasteboard)
      • (lispkit test)
      • (lispkit text-table)
      • (lispkit thread)
      • (lispkit thread channel)
      • (lispkit-thread-future)
      • (lispkit thread shared-queue)
      • (lispkit type)
      • (lispkit url)
      • (lispkit vector)
    • ⚙️LispPad
      • (lisppad applescript)
      • (lisppad draw map)
      • (lisppad location)
      • (lisppad speech)
      • (lisppad system)
      • (lisppad turtle)
    • ⚙️SRFI
  • Examples
    • 📝LispKit
    • 📝LispPad
    • 📝LispPad Go
  • Releases
    • 🖥️LispPad
    • 📱LispPad Go
  • Downloads
  • Privacy Policy
  • Contact
Powered by GitBook
On this page
  1. Libraries
  2. LispPad

(lisppad draw map)

Library (lisppad draw map) provides an API for creating map snapshots. A map snapshot encapsulates a map image and provides a procedure for mapping locations to points on the image. This makes it possible to draw on top of the image based on locations (lat/longs). Here is a typical use case for this library:

(import (lispkit draw)
        (lisppad location)
        (lisppad draw map))
(define d
  (let*
    (; Determine the current location
     (center (current-location))
     ; Show a 1km box around the center
     (area   (size 1000 1000))
     ; Create a map snapshot of 500x500 points
     (snapsh (make-map-snapshot center area (size 500 500) 'satellite))
     ; Determine the points on the map image for the center
     (pt     (map-snapshot-point snapsh center)))
    ; Create a drawing of the map with highlighted center
    (drawing
      ; Draw the map at the origin of the drawing
      (draw-image (map-snapshot-image snapsh) (point 0 0))
      ; Highlight the center with a red circle
      (set-fill-color red)
      (fill-ellipse 
        (rect (point (- (point-x pt) 4) (- (point-y pt) 4))
              (size 8 8))))))

The body of the let* form first draws the image and then layers a red ellipse on top. This is done in the context of a drawing, which can then be turned into an image and saved.

Returns #t if obj is a map snapshot object; otherwise #f is returned.

Creates a new map snapshot object which represents a rectangular area of a map whose center is the location center. Locations are created and managed via library (lisppad location). dist describes the width and height of the map region. If is either a lat-long-span object or a size object, as defined by library (lispkit draw). lat-long-span objects describe a width and height in terms of a north-to-south and east-to-west distance measured in degrees. size objects are interpreted as width and height measured in meters. size is a size object describing the dimensions of the image in points. type is a symbold that indicates the map type. Supported are:

  • standard: Street map that shows the position of all roads and some road names.

  • satellite: Satellite imagery of the area.

  • satellite-flyover: Satellite image of the area with flyover data where available.

  • hybrid: Satellite image of the area with road and road name information layered on top.

  • hybrid-flyover: Hybrid satellite image with flyover data where available.

  • standard-muted: Street map where the underlying map details are less emphasized to make custom data on top stand out more.

poi is a list of symbols indicating the categories for which point of interests are highlighted on the map. The following categories are supported:

airport, amusement-park, aquarium, atm, bakery, bank, beach, brewery, cafe, campground, car-rental, ev-charger, fire-station, fitness-center, supermarket, gas-station, hospital, hotel, laundry, library, marina movie-theater, museum, national-park, nightlife, park, parking, pharmacy, police, post-office, public-transport, restaurant, restroom, school, stadium, store, theater, university, winery, zoo.

bldng is a boolean parameter (default is #f) indicating whether to show buildings or not.

Given a map snapshot object msh, procedure map-snapshot-image returns an image of the map encapsulated by msh.

Given a map snapshot object msh, procedure map-snapshot-point returns a point on the image of the map that matches the given location loc, or the location derived from the given latitude lat and longitude long.

Returns a new lat-long-span object from the given latitudal (north-to-south) and longitudal (east-to-west) distances latspan and longspan measured in degrees.

Previous(lisppad applescript)Next(lisppad location)

Last updated 2 years ago

(map-snapshot? obj)

(make-map-snapshot center dist size) (make-map-snapshot center dist size type) (make-map-snapshot center dist size type poi) (make-map-snapshot center dist size type poi bldng)

(map-snapshot-image msh)

(map-snapshot-point msh loc) (map-snapshot-point msh lat long)

(lat-long-span latspan longspan)

⚙️