
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
@omnedia/ngx-map
Advanced tools
A simple component library to create a map with animated connections.
This library is part of the NGXUI ecosystem.
View all available components at https://ngxui.com
@omnedia/ngx-map
is an Angular library for creating customizable, animated world maps with dotted grid layouts and path animations. Perfect for visualizing geographic connections, this component offers smooth animations and flexible configurations for diverse use cases.
Install the library using npm:
npm install @omnedia/ngx-map dotted-map
Import the NgxMapComponent
in your Angular module or component:
import {NgxMapComponent} from '@omnedia/ngx-map';
@Component({
...
imports:
[NgxMapComponent],
...
})
Use the component in your template:
<om-map
[dots]="[
{ start: { lat: 64.2008, lng: -149.4937 }, end: { lat: 34.0522, lng: -118.2437 } },
{ start: { lat: 34.0522, lng: -118.2437 }, end: { lat: -1.2921, lng: 36.8219 } }
]"
[lineColor]="'#0ea5e9'"
[animated]="true"
[mapColor]="'rgba(0, 0, 0, 0.4)'"
[mapDotsShape]="'circle'"
[mapDotsRadius]="0.22"
></om-map>
<om-map
[dots]="dots"
[lineColor]="lineColor"
[backgroundColor]="backgroundColor"
[mapColor]="mapColor"
[mapDotsShape]="mapDotsShape"
[mapDotsRadius]="mapDotsRadius"
[animated]="animated"
[styleClass]="styleClass"
[style]="style"
[precomputedMap]="precomputedMap"
></om-map>
dots
(required): Array of connection objects, each with start
and end
properties. Example:
[
{ start: { lat: 64.2008, lng: -149.4937 }, end: { lat: 34.0522, lng: -118.2437 } }
]
lineColor
(optional): Color of the animated lines. Defaults to '#0ea5e9'
.backgroundColor
(optional): Background color of the map. Defaults to undefined
.mapColor
(optional): Color of the dots on the map. Defaults to 'rgba(0,0,0,0.40)'
.mapDotsShape
(optional): Shape of the dots ('circle'
or 'hexagon'
). Defaults to 'circle'
.mapDotsRadius
(optional): Radius of the dots. Defaults to 0.22
.animated
(optional): Whether to animate the paths. Defaults to false
.styleClass
(optional): Custom CSS class for additional styling.precomputedMap
(optional): Precomputed map JSON (object or string).@omnedia/ngx-map
now supports two ways to generate maps for maximum performance:
The library automatically uses a Web Worker to offload the heavy dotted-map computation to a background thread. No extra setup required.
If you always use the same map grid, you can precompute it once and ship it as JSON. This completely removes runtime map generation and makes initial render instantaneous.
Run once in Node:
npm install dotted-map
// scripts/precompute-map.js
const {getMapJSON} = require('dotted-map');
const fs = require('fs');
const path = require('path');
const outputFile = path.resolve('./src/precomputed-map.json');
fs.writeFileSync(outputFile, getMapJSON({height: 100, grid: 'diagonal'}));
console.log('✅ Precomputed map saved:', outputFile);
Run it:
node scripts/precompute-map.js
import precomputedMap from './precomputed-map.json';
@Component({
standalone: true,
imports: [NgxMapComponent],
template: `
<om-map
[dots]="dots"
[precomputedMap]="map"
[animated]="true"
[mapColor]="'rgba(0,0,0,0.4)'"
[backgroundColor]="'#020300'"
></om-map>
`,
})
export class DemoComponent {
map = precomputedMap;
dots = [
{start: {lat: 40.7, lng: -73.9}, end: {lat: 48.8, lng: 2.3}},
];
}
<om-map
[dots]="[
{ start: { lat: 51.5074, lng: -0.1278 }, end: { lat: 40.7128, lng: -74.006 } },
{ start: { lat: 40.7128, lng: -74.006 }, end: { lat: 35.6895, lng: 139.6917 } }
]"
[lineColor]="'#ff5733'"
[animated]="true"
[mapColor]="'rgba(255, 87, 51, 0.4)'"
[mapDotsShape]="'circle'"
[mapDotsRadius]="0.3"
styleClass="custom-map"
></om-map>
.om-map
The .om-map
container allows you to apply global or custom styles using the styleClass
input. While the component handles dot placement and animations, you can extend styling for the map container or SVG elements.
<om-map styleClass="custom-map">
</om-map>
.custom-map {
background-color: #1e1e1e;
padding: 2rem;
border-radius: 12px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
Contributions are welcome! Please submit a pull request or open an issue to discuss new features or bug fixes.
This project is licensed under the MIT License.
FAQs
A simple component library to create a map with animated connections.
We found that @omnedia/ngx-map demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Central’s incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.