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 🙏

© 2026 – Pkg Stats / Ryan Hefner

geo-korea

v1.0.6

Published

A flexible library for visualizing data on South Korea's map

Downloads

29

Readme

Geo Korea

Interactive map visualization library for Korea using TopoJSON data, built with D3.js. This library provides a flexible and customizable way to create interactive maps of South Korea with features like region highlighting, custom markers, and smooth animations.

Features

  • 🗺️ Interactive region visualization with hover and click effects
  • 📍 Customizable point markers with tooltips
  • 🔍 Smooth zoom in/out and region focus transitions
  • 🎨 Comprehensive theming system with dark mode support
  • 🎯 Custom TopoJSON data support
  • ⚛️ React component support
  • 🔄 TypeScript support with full type definitions

Installation

npm install geo-korea
# or
yarn add geo-korea
# or
pnpm add geo-korea

Usage

Basic Usage

JavaScript

The simplest way to create a map is to just provide a container ID:

// Most basic usage - all options will be set to defaults
const GeoKoreaRenderer = new GeoKoreaInitializer();
const map = await GeoKoreaRenderer.createMap("map-container");

React

Using React, you can create a map with a ref:

import React, { useEffect, useRef } from "react";
import { GeoKoreaInitializer } from "geo-korea";

const App: React.FC = () => {
  const containerRef = useRef<HTMLDivElement>(null);

  useEffect(() => {
    if (containerRef.current) {
      // Most basic usage - all options will be set to defaults
      const GeoKoreaRenderer = new GeoKoreaInitializer();
      const map = GeoKoreaRenderer.createMap(containerRef.current);

      return () => {
        map.destroy();
      };
    }
  }, []);

  return <div ref={containerRef} />;
};

export default App;

Adding Options

You can enhance the map with various options:

const GeoKoreaRenderer = new GeoKoreaInitializer();
const map = await GeoKoreaRenderer.createMap("map-container", {
  points: [
    {
      name: "Seoul City Hall",
      region: "Capital Area",
      location: "Seoul Metropolitan City",
      coordinates: [37.5666805, 126.9784147],
      type: "City Hall",
    },
  ],
  onRegionClick: (name) => console.log(`Clicked region: ${name}`),
});

React Component

import React, { useEffect, useRef } from "react";
import { GeoKoreaInitializer } from "geo-korea";

const Map: React.FC = () => {
  const mapContainerRef = useRef<HTMLDivElement>(null);

  useEffect(() => {
    if (mapContainerRef.current) {
      const GeoKoreaRenderer = new GeoKoreaInitializer();
      const map = GeoKoreaRenderer.createMap(mapContainerRef.current, {
        points: [
          {
            name: "Seoul City Hall",
            region: "Capital Area",
            location: "Seoul Metropolitan City",
            coordinates: [37.5666805, 126.9784147],
            type: "City Hall",
          },
        ],
        onRegionClick: (name) => console.log(`Clicked region: ${name}`),
      });

      return () => {
        map.destroy();
      };
    }
  }, []);

  return <div ref={mapContainerRef} />;
};

Configuration

Auto-Calculated Values & Default Colors

When you create a map without options, the library will:

  1. Auto-Calculate:

    • width and height: Automatically set based on the container size
    • center and scale: Automatically adjusted to fit the map perfectly within the container
  2. Default Colors:

const defaultColors = {
  region: "#2A2D35",
  regionHover: "#3F4046",
  point: "#5EEAD4",
  pointHover: "#6366F1",
  selected: "#6366F1",
  border: "#4A4B50",
};

Available Options

MapOptions Interface

type MapOptions = {
  width?: number; // Width of the map container
  height?: number; // Height of the map container
  center?: [number, number]; // Center coordinates [longitude, latitude]
  scale?: number; // Map scale (0.5 to 8)
  points?: Point[]; // Array of point markers
  colors?: ColorOptions; // Custom color theme
  onRegionClick?: (name: string) => void; // Region click handler
  tooltipRenderer?: (point: Point) => string; // Custom tooltip renderer
};

Point Interface

type Point = {
  type: string; // Point type (e.g., "city", "landmark")
  name: string; // Point name
  region: string; // Region name
  location: string; // Location description
  coordinates: [number, number]; // [latitude, longitude]
  radius?: number; // Point size (default: 3)
  color?: string; // Custom point color
};

ColorOptions Interface

type ColorOptions = {
  region?: string; // Default region color
  regionHover?: string; // Region hover color
  point?: string; // Default point marker color
  pointHover?: string; // Point marker hover color
  selected?: string; // Selected region color
  border?: string; // Region border color
};

Advanced Features

Custom TopoJSON Data

const map = await GeoKoreaRenderer.createMap("map-container", {
  topoJsonPath: "/path/to/custom-map-data.json",
});

Custom Tooltip Renderer

const map = await GeoKoreaRenderer.createMap("map-container", {
  tooltipRenderer: (point) => {
    return `
      <div>
        <strong>${point.name}</strong>
        <p>${point.location}</p>
      </div>
    `;
  },
});
// or
// using React components
const map = GeoKoreaRenderer.createMap(mapContainerRef.current, {
  tooltipRenderer: (point) => {
    return `
      <div>
        <strong>${point.name}</strong>
        <p>${point.location}</p>
      </div>
    `;
  },
}

Instance Methods

The createMap method returns a GeoKoreaInstance with the following methods:

type GeoKoreaInstance = {
  map: GeoKorea; // Access to the underlying map instance
  destroy: () => void; // Clean up resources
  updatePoints: (points: Point[]) => void; // Update point markers
  setTopoData: (topoData: any, objectName: string) => void; // Update map data
};

License

MIT © [MNIII]