mapplot 0.1.0

A library for plotting data on maps.
Documentation
  • Coverage
  • 62.24%
    61 out of 98 items documented5 out of 67 items with examples
  • Size
  • Source code size: 33.08 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 6.37 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • ondt/mapplot
    6 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ondt

mapplot - A map plotter library for Rust

mapplot is a Rust library for plotting data on maps.

Available Plotters

Example

example

use std::fs;
use mapplot::google::{Circle, GoogleMap, Marker, Polygon, Polyline, Rectangle, style::Color};

fn main() {
  let netherlands = [
    (53.3224787, 7.1852322),
    (53.0056055, 7.1962228),
    // --snip--
    (51.2176932, 3.8900991),
    (51.3706174, 3.3641251),
  ];
  
  let switzerland = [
    (47.5976076, 8.1243554),
    (47.4744889, 7.0147812),
    // --snip--
    (47.5320018, 9.6006684),
    (47.7892979, 8.5809824),
  ];
  
  let bern = [
    (46.9666268, 7.1781895),
    (47.1238637, 7.3361174),
    (47.0593473, 7.6190164),
    (46.8390079, 7.6863061),
    (46.7638649, 7.3683927),
  ];
  
  let html = GoogleMap::new((49.7973, 5.4173), 6, "<your-apikey-here>")
          .draw(Marker::new((51.507, -0.127)).label("A").title("London"))
          .draw(Marker::new((52.48, -1.902)).title("Birmingham"))
          .draw(Polyline::new(netherlands).style(Color::Red))
          .draw(Polygon::new(switzerland).path(bern).style(Color::Red))
          .draw(Rectangle::new((53.0833, 8.8), (51.3333, 12.3833)).style(Color::Green).editable(true).draggable(true))
          .draw(Circle::new((48.856, 2.352), 100_000.0).style(Color::HSL(200, 128, 100))) // Paris
          .to_string();
  
  fs::write("map.html", html).unwrap();
}

License