npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aframe-tangram-component

v2.3.0

Published

A Tangram component for A-Frame.

Downloads

25

Readme

aframe-tangram-component

A Mapzen Tangram component for A-Frame.

Supports A-Frame 0.8.0.

Example

API

tangram-map component

The geojson component has the material and geometry components as a dependency from the entity. It implements a raycaster logic that fires an event if a GeoJSON feature gets selected.

Schema

| Property | Description | Default Value | | -------- | ----------- | ------------- | | apiKey | Sets the global API key of the Tangram map. May be empty if the style needs no API. | "" | | style | The style definition document for the ovleray style. Must point to a custom style or to a basemap style. | "" | | center | Center of the map, in the form of [longitude, latitude] | [0, 0] | | zoom | The zoom level of the map. | 13 | | pxToWorldRatio | The multiplication factor between meters in A-Frame and the pixels of the map. ie; when set to 100, will display 100 pixels per 1 meter in world space. (see a note on fidelity) | 100 | | highDensityDisplay | Flag if the devicePixelRatio property should be considered. Mobile devices may have a high ppd so the output texture size may be 3 times as high as on desktop which may lead to crash of the browser | false |

Events

| Name | Data | Description | | -------- | ----------- | ------------- | | tangram-map-loaded | None| Fired when the map has finished loading. | | tangram-map-moveend | None | Fired when the map parameters have been changed and the map has reloaded. |

API

| Name | Data | Description | | -------- | ----------- | ------------- | | project | lon, lat| Returns the pixel x and y coordinates of the given longitude and latitude. | | unproject | x, y| Gives the longitude and latitude of the pixel coordinates. | | getMap | | Returns the Leaflet instance to work programmatically with the map. |

Styling

The Mapzen Tangram are styled within a (set) of YAML files or ZIP files. See the Tangram documentation for details. You can also directly load the prefabed styles provided by Mapzen

A note on fidelity

The higher pxToWorldRatio, the more map area will be displayed per world unit. That canvas has to be translated into a plane in world space. This is combined with the width and height in world space (from geometry.width and geometry.height on the entity) to set up the plane for rendering in 3D.

The map is rendered as a texture on a 3D plane. For best performance, texture sizes should be kept to powers of 2. Keeping this in mind, you should work to ensure width * pxToWorldRatio and height * pxToWorldRatio are powers of 2.

Dependencies

The Mapzen styling documents are in the YAML format, so you need a possiblity to require those files. If you are using Webpack install npm install yml-loader --save-dev and configure the webpack configuration file

If you are using browserify install the nmp install yamlify --save-dev and give pass the transform (-t) parameter to browserify.

Installation

Browser

Install and use by directly including the browser files:

<head>
  <title>My A-Frame Scene</title>
  <script src="https://aframe.io/releases/0.8.0/aframe.min.js"></script>
  <script src="https://unpkg.com/aframe-tangram-component/dist/aframe-tangram-component.min.js"></script>
</head>

<body>
  <a-scene>

      <a-tangram-map 
        position="0 0 -2"
        width="7"
        height="5"
        api-key="mapzen-tDHBHDp"
        map-style="#zip-style"
        center="16, 48"
        zoom="12"
        px-world-ratio="100"
        >
      </a-tangram-map>
  </a-scene>
</body>

npm

Install via npm:

npm install aframe-tangram-component

Then require and use.

require('aframe');
require('aframe-tangram-component');

Known issues

  • Dynamic maps are not support yet.

Notes