All examples
Visualization

Plot geographic observations and values

Place illustrative city coordinates on offline maps, encode independent values as color and circle area and choose a label collision policy.

plot_geo_points.aner
// Requires the updated native development runtime.
// Coordinates are illustrative city locations, not surveyed observations.
// Values are synthetic indices; no spatial aggregation or geocoding is performed.
// Point size and label placement are native and require no extra pack or service.
import aner.plot
import aner.geo

let cityPositions = List(
    geo.position(longitude: -105.2705, latitude: 40.0150),
    geo.position(longitude: -122.4194, latitude: 37.7749),
    geo.position(longitude: -118.2437, latitude: 34.0522),
    geo.position(longitude: -122.1430, latitude: 37.4419),
    geo.position(longitude: -74.0060, latitude: 40.7128),
    geo.position(longitude: -95.3698, latitude: 29.7604),
    geo.position(longitude: -70.6693, latitude: -33.4489),
    geo.position(longitude: -58.3816, latitude: -34.6037),
    geo.position(longitude: -99.1332, latitude: 19.4326),
    geo.position(longitude: -79.3832, latitude: 43.6532))
let cityValues = List(8.0, 12.0, 18.0, 9.0, 15.0, 13.0, 11.0, 10.0, 14.0, 16.0)
let cityLabels = List("Boulder", "San Francisco", "Los Angeles", "Palo Alto", "New York City",
    "Houston", "Santiago", "Buenos Aires", "Mexico City", "Toronto")
plot.geo_scatter(positions: cityPositions, values: cityValues, labels: cityLabels)
    .point_sizes(values: cityValues, max_radius: 14.0)
    .point_labels("avoid")
    .extent(west: -132.0, south: -58.0, east: -45.0, north: 58.0)
    .projection("equirectangular")
    .title("Illustrative city positions: no map pack required")
    .caption("Synthetic index sets color and circle area; crowded labels may be hidden; full text stays in tooltips. No boundary pack.")
    .show()

// Optional pack: usa.co. Boundary: generalized Census 2025 place geometry.
let boulderPositions = List(
    geo.position(longitude: -105.2705, latitude: 40.0150),
    geo.position(longitude: -105.2500, latitude: 40.0300))
let boulder = plot.map("usa.co.places", keys: List("0807850"), values: List(20.0))
boulder.add_points(positions: boulderPositions, values: List(8.0, 12.0),
        labels: List("Site A", "Site B"))
    .point_sizes(values: List(10.0, 40.0), max_radius: 16.0)
    .focus(key: "0807850", padding: 0.20)
    .projection("lambert_azimuthal_equal_area")
    .title("Boulder: labeled observation positions")
    .caption("Synthetic color indices; circle areas encode separate synthetic totals 10 and 40. Census 2025; labels avoid collisions.")
    .show()

// Optional pack: usa.ca. The viewport shows San Francisco and Palo Alto together.
let california = plot.map("usa.ca.places",
    keys: List("0667000", "0644000", "0655282"), values: List(12.0, 18.0, 9.0))
let bayPositions = List(
    geo.position(longitude: -122.4194, latitude: 37.7749),
    geo.position(longitude: -122.1430, latitude: 37.4419))
let bayPoints = plot.add_points(chart: california, positions: bayPositions,
    values: List(12.0, 9.0), labels: List("San Francisco", "Palo Alto"))
bayPoints.extent(west: -122.65, south: 37.20, east: -121.70, north: 38.15)
    .point_size(radius: 6.0)
    .point_labels("avoid")
    .projection("lambert_azimuthal_equal_area")
    .title("Bay Area: supplied positions and separate value colors")
    .caption("Synthetic indices set color; uniform 6-pixel radii encode no quantity. Census 2025; no automatic point-in-polygon join.")
    .show()

// Optional pack: mexico. MX-DIF is the pinned source's legacy Mexico City key.
plot.map("mexico", keys: List("MX-DIF"), values: List(7.0))
    .add_points(positions: List(geo.position(longitude: -99.1332, latitude: 19.4326)),
        values: List(14.0), labels: List("Mexico City"))
    .point_labels("all")
    .focus("MX-DIF")
    .projection("lambert_azimuthal_equal_area")
    .title("Mexico City: illustrative location over a federal entity")
    .caption("Synthetic indices; Natural Earth 2022 snapshot; legacy MX-DIF boundary; no street or municipal layer.")
    .show()

// Optional pack: canada. The background is Ontario, not a Toronto city boundary.
plot.map("canada", keys: List("CA-ON"), values: List(6.0))
    .add_points(positions: List(geo.position(longitude: -79.3832, latitude: 43.6532)),
        values: List(16.0), labels: List("Toronto"))
    .extent(west: -79.9, south: 43.3, east: -78.9, north: 44.0)
    .projection("lambert_azimuthal_equal_area")
    .title("Toronto: illustrative position in an Ontario viewport")
    .caption("Synthetic indices; Natural Earth 2022 province boundary; local extent adds no finer geometry.")
    .show()

Run step by step in VS Code.

The notebook separates observations and chart construction into cells. It opens with empty outputs and shared variables. Map cells state which optional local packs they need.

  1. Install a compatible native Aner executable and VS Code extension using the editor guide. Chart construction and interactive geographic navigation require the matching development runtime and editor.
  2. Download the .anernb notebook and open it in your VS Code project. If it appears as JSON, choose Reopen Editor With… → Aner Notebook.
  3. Select the Aner — notebook kernel and keep Shared variables active. Run code cells from top to bottom, or choose Run All. Later cells reuse observations and chart values from earlier cells. Run cells that need no pack before trying the optional geographic map.
  4. Read the figures below their producing cells. In geographic outputs, drag to pan and use the zoom controls to reveal crowded labels. Static SVG exports retain the initial view. Source observations, units and limitations remain in each caption.

After changing an earlier cell, rerun its dependent cells. Use Aner: Restart Notebook Session, then Run All, for a clean experiment. Saved outputs are historical; reopening the file starts without live variables. The notebook guide explains session state, inspection, and runtime controls.

Make it your experiment.

With a compatible development runtime installed, save this program as examples/plot_geo_points.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.

Terminal
aner check examples/plot_geo_points.aner
aner run examples/plot_geo_points.aner

The aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.

Requires a chart enabled native Aner development runtime and a matching VS Code extension for notebook display and interactive geographic navigation. Aner Plot awaits a binary release and is not included in the published research preview. Development packages are not available on this website. Copy the required matching .anermap files to the computer and install them locally. The first point chart needs no pack; the remaining overlays need usa.co, usa.ca, mexico and canada. All observations are included, and execution requires no network, credentials or external service. The website shows static native SVG figures; pan and zoom run in the compatible local notebook renderer.

Map pack status
aner maps list
aner maps path

Observations are synthetic teaching inputs. Geographic context comes from optional offline boundary packs and does not add street detail or establish observed traffic conditions.

Read the chart and map contracts
Install Aner