map-to-poster README

The project's README from github.com/dimartarmizi/map-to-poster. As one markdown file: README.md.

MapToPoster JS Logo

MapToPoster JS

HTML5 CSS3 JavaScript Tailwind CSS Leaflet MapLibre Vite

MapToPoster JS is a professional-grade, client-side web application designed to help you generate a custom Map To Poster with ease. Whether you're looking to create minimalist city art or a vibrant geographic keepsake, this tool allows you to search for any location in the world and transform it into a stunning Map To Poster piece with fully customizable themes, layouts, and high-fidelity export options. As a versatile Map To Poster generator, the application focuses on high-resolution output suitable for large-format printing, making it the perfect tool for creating unique wall art or personalized gifts.

MapToPoster JS Preview

🚀 Key Features

🎨 Themes

MapToPoster JS offers two distinct ways to style your maps:

Standard Themes (Leaflet)

Based on high-quality raster tiles from established providers:

Artistic Themes (MapLibre GL)

Hand-crafted vector styles with procedural colors:

Customizing Themes

You can easily add your own artistic themes by editing src/core/artistic-themes.js:

  1. Open artistic-themes.js.
  2. Add a new object to the artisticThemes export:
your_theme_key: {
    name: "Your Theme Name",
    description: "Brief description of the style",
    bg: "#HEXCODE",
    text: "#HEXCODE",
    water: "#HEXCODE",
    parks: "#HEXCODE",
    road_motorway: "#HEXCODE",
    road_primary: "#HEXCODE",
    road_secondary: "#HEXCODE",
    road_default: "#HEXCODE"
}

The application will automatically pick up the new theme and display it in the selection menu.

🛠️ Tech Stack

📦 Getting Started

Follow these steps to get a local copy up and running.

Prerequisites

Installation & Setup

  1. Clone the repository

    git clone https://github.com/dimartarmizi/map-to-poster.git
    cd map-to-poster
    
  2. Install dependencies

    npm install
    
  3. Start development server

    npm run dev
    

    The app will be available at http://localhost:5173.

  4. Build for production

    npm run build
    

    Optimized files will be generated in the dist/ folder.

🐳 Deploy with Docker

This project is ready to run as a lightweight Docker container using a multi-stage build:

Build the image

docker build -t map-to-poster .

Run the container

docker run -d -p 8080:80 --name map-to-poster map-to-poster

Then open http://localhost:8080.

Update deployment

After pulling new changes, rebuild and recreate the container:

docker build -t map-to-poster .
docker rm -f map-to-poster
docker run -d -p 8080:80 --name map-to-poster map-to-poster

Included Docker files

📜 Technical Overview

  1. Reactive State Management: Uses an observer-pattern based store (src/core/state.js) to synchronize changes across the UI, Leaflet, and MapLibre engines. All user preferences are persisted via localStorage.
  2. Hybrid Mapping Engine: Implements bidirectional viewport synchronization between Leaflet (raster tiles) and MapLibre GL (vector themes), ensuring seamless layout consistency regardless of the active rendering mode.
  3. Draggable Overlay System: Leverages real-time bounding box calculations to clamp label positions, ensuring a symmetric 8px minimum safety gap from the poster edges.
  4. Dynamic Asset Integration: Manages custom GeoJSON routing and multi-marker instances with interactive drag-and-drop support across both map engines.
  5. Mat Framing Layer: Implements a virtual "Mat/Passepartout" interface with customizable inset spacing and inner borders for a gallery-style finish.
  6. High-Fidelity Rendering Pipeline: Captured exports utilize a multi-stage process in src/core/export.js to generate high-resolution map snapshots using html2canvas and the onclone callback.

🤝 Credits

📧 Contact

If you have any questions, suggestions, or just want to reach out, feel free to contact me at [email protected].

⚖️ License

This project is open-source and available under the MIT License.

map-to-poster (dimartarmizi/map-to-poster)

Searching Database…

这是什么?MapToPoster JS 是一个纯客户端网页应用,能把任意地点变成可定制的高分辨率地图海报,并导出为 PNG 用于打印。
这是托管服务,还是完全在我的浏览器里运行?它是一个用原生 JavaScript 和 Vite 构建的网页应用,完全在客户端运行;所有渲染都在浏览器里完成,不会向服务器发送任何东西。
怎么在本地把它跑起来?克隆仓库,用 npm 装好依赖,然后运行 Vite 开发服务器;生产环境也可以构建成静态文件,或通过自带的多阶段 Docker 方案配合 Nginx 运行。
运行它需要装什么?你需要 Node.js 18.0.0 或更高版本和 npm(随 Node 附带),用来安装依赖并运行 Vite 构建。
它的搜索或路线规划依赖外部服务吗?依赖,地点搜索用 Nominatim API,路线绘制用 OSRM,所以这些功能需要联网,尽管渲染本身在本地完成。
我的地图数据会离开我的电脑吗?不会,该应用把你的设置保存在 LocalStorage 里并完全在客户端渲染,海报数据始终留在你的浏览器中。
标准主题和艺术主题有什么区别?标准主题(Minimal White、Midnight Dark、Classic Street、Modern Voyager、Satellite View)通过 Leaflet 使用栅格地图瓦片,而 Arctic Frost、Cyber Glitch 这类艺术主题是手工打造的过程化矢量风格,用 MapLibre GL 渲染。
导出的海报分辨率能有多高?你可以导出最高 50,000px 的自定义 PNG 分辨率,用于大幅面打印。
我能添加自己的自定义主题吗?可以,编辑 src/core/artistic-themes.js 里的一个对象就能添加新的艺术主题,它会自动出现在主题选择菜单里。
这是原创项目,还是基于别的项目?它受 originalankur/maptoposter 启发,但是一个独立的实现,用了不同的技术栈和架构(原生 JS、Vite、Tailwind CSS)。
Size
0.6 MB
Stars
1.1K
Updated
CommitJun 06
Age
8mo
Commits · 90 Days