Coder Social home page Coder Social logo

rbrundritt / maplibre-gl-svg Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 2.0 859 KB

A maplibre-gl-js plugin that adds support for loading SVGs and SVG templates as images into the maps image sprite.

License: MIT License

JavaScript 13.61% HTML 15.53% TypeScript 70.86%

maplibre-gl-svg's Introduction

MapLibre GL SVG Plugin

Status: New plugin, still being validated.

A maplibre-gl-js plugin that adds support for loading SVGs images into the maps image sprite.

Features:

  • Load an SVG into the maps image sprite and use as an icon in a symbol layer, or as an fill pattern.
  • Framework for templatable SVG icons. Great way to create reusable icons that you can programmatically change the styles of.
  • HTML marker support

Known Limitations

  • When loaded into the maps image sprite SVG's are converted into a data URI, and loaded as a static image into the maps image sprite. This means animations and CSS classes are not supported. All CSS styles should be embedded within the SVG. SVG's used with HTML markers will support CSS classes and animations as usual.

License

MIT

See License for full license text.

maplibre-gl-svg's People

Contributors

rbrundritt avatar

Stargazers

Carl Higgs avatar Alexander Dunkel avatar Goncalo Oliveira avatar Brendan Stone avatar  avatar Anton Sutarmin avatar Christopher Boone avatar Jens Wiesehahn avatar  avatar

Watchers

Nick Sellen avatar  avatar

Forkers

dbrnz ohmyray

maplibre-gl-svg's Issues

Typescript check fails

Hi, I am trying to use this library to render svg images with maplibre inside a React application, however i am getting an error when i try to build using vite alongside with typescript checks:

node_modules/maplibre-gl-svg/src/SvgManager.ts:69:20 - error TS2774: This condition will always return true since this function is always defined. Did you mean to call it instead?

69                 if(map._requestManager._transformRequestFn) {
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 1 error in node_modules/maplibre-gl-svg/src/SvgManager.ts:69

error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

This happens whenever you run tsc on a project that imports SvgManager as follows:

import { SvgManager } from "maplibre-gl-svg/src";


const App = () => {

  return <></>;
}

And this is how I define the dependency on my package.json:

    "dependencies": {
        ...
        "maplibre-gl-svg": "git+https://github.com/rbrundritt/maplibre-gl-svg.git",
       ...
    },

The version of typescript being used is:

tsc --version     
Version 4.6.4

Maybe there is something I need to configure that I am not aware of? Any feedback is appreciated ๐Ÿ˜ƒ

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.