maptalks / maptalks.js

A light and plugable JavaScript library for integrated 2D/3D maps.
https://maptalks.org
BSD 3-Clause "New" or "Revised" License
4.31k stars 504 forks source link

maptalks support ssr,but I don't run the examples #1245

Open heyonggis opened 4 years ago

heyonggis commented 4 years ago

const maptalks = require('maptalks'); //with node-canvas 2.0 const { createCanvas, Image } = require('canvas');

//load node adapters, source: https://github.com/maptalks/maptalks.node require('maptalks.node'); //register node-canvas's Image as a global class global.Image = Image;

const canvas = createCanvas(400, 300); const map = new maptalks.Map(canvas, { center : [0, 0], zoom : 3, baseLayer : new maptalks.TileLayer('base', { 'urlTemplate' : 'http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', 'subdomains' : ['a','b','c','d','e'], }) });

fuzhenn commented 4 years ago

因为图层的绘制是异步的,需要监听baseLayer的layerload事件等待底图绘制完成,才会正确输出地图。 我们有个服务端的静态地图生成服务是基于node + maptalks开发的,我们也在考虑是否要开源出来。

heyonggis commented 4 years ago

因为图层的绘制是异步的,需要监听baseLayer的layerload事件等待底图绘制完成,才会正确输出地图。 我们有个服务端的静态地图生成服务是基于node + maptalks开发的,我们也在考虑是否要开源出来。

期待你的大作