Code Monkey home page Code Monkey logo

snazzy's Introduction

Snazzy

Earth Engine Javascript Open in Code Editor

Snazzy Maps styles in the Google Earth Engine code editor.

Snazzy basemap demo

TLDR

  • πŸ—ΊοΈ Customize your Earth Engine basemap in any script or App
  • ✨ Add any style from Snazzy Maps by URL, name, or tags with one line of code
  • ⚑ Asynchronous evaluation for fast, non-blocking execution

Usage

Import the snazzy module into your Earth Engine script.

var snazzy = require("users/aazuspan/snazzy:styles");

Add a Style Using a URL

Add a style from Snazzy Maps to your map by copying the URL and pasting in your Earth Engine script with snazzy.addStyle. The second parameter is optional and will be assigned as the style alias (displayed in the top right of the map). If no alias (or null) is provided, the name of the style on Snazzy Maps will be used.

snazzy.addStyle("https://snazzymaps.com/style/235815/retro", "My Custom Style");

Add a Style Using a Name

You can also add a style by name rather than URL. However, there may be multiple styles with the same name. snazzy will always add the most popular style that matches a given name, so use a URL if selecting by name doesn't give you the style you want.

snazzy.addStyleFromName("Retro");

Add a Style Using Tags

Know the aesthetic or color scheme but don't have a specific style in mind? You can use snazzy.addStyleFromTags to add a popular or random style that matches your criteria. Just pass in an array of tags/colors and an alias.

snazzy.addStyleFromTags(["yellow", "black", "two-tone"]);

By default, addStyleFromTags adds the most popular style that matches all your tags, sorted by favorites, but you can also sort by views (or random for a surprise).

var tags = ["colorful", "no-labels", "simple"];
var alias = null;
var order = "random";
var printUrl = true;

snazzy.addStyleFromTags(tags, alias, order, printUrl);

Note that addStyleFromTags takes an optional printUrl parameter that will print a style's URL to help you find it again in the future.

Snazzy Tags

Snazzy supports all of the tags and colors used by Snazzy Maps. To see them in the code editor: print(snazzy.tags).

  • Tags: colorful, complex, dark, greyscale, light, monochrome, no-labels, simple, two-tone
  • Colors: black, blue, grey, green, orange, purple, red, white, yellow

Acknowledgements

snazzy's People

Contributors

aazuspan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

snazzy's Issues

Automate style updates from Snazzy Maps

Map styles are stored in a Feature Collection asset ingested from a CSV file. The CSV is created by scripts.update_snazzy_styles.py, but the asset has to be manually re-uploaded in order to update the style library when new styles are added to Snazzy Maps. Eventually, the process of downloading and ingesting new styles should be automated with a cron Github workflow.

With that said, the most recent style on Snazzy Maps was added about a year ago, so this is pretty low priority.

JSON parsing error

The Bright & Bubbly style causes a JSON parsing error. This is the only style I've seen that fails, but there may be others.

To recreate:

snazzy.addStyle("https://snazzymaps.com/style/17/bright-and-bubbly");

Error:

Line 25: JSON.parse: unexpected character at line 1 column 1730 of the JSON data 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.