geotile-sdk-atlas
v0.1.3
Published
A tile sdk for Cloud Optimised Geotiff and shapefile
Downloads
2
Readme
geotile-sdk
A tile sdk for Cloud Optimised Geotiff and shapefile ",
Example
var geotile_sdk = require("geotile_sdk");
//设置样式文件路径和mapnik的input plugin
var styleDir=".../style"
var mapnikDir=".../node_modules/mapnik/lib/binding/"
geotile_sdk.setMapnikDir(styleDir,mapnikDir)
//根据json生成栅格的地图样式xml文件
var styleJson_raster = {
"style":{
"Type": "Raster"
},
"layer":{
"path":"/luojun/github/geotiff-server/test/data/clip2.rs",
"SRS":"3857"
}
}
const style_str_raster= JSON.stringify(styleJson_raster)
geotile_sdk.generateXML(style_str, (err,uuid)=>{ if(!!err)var xml_uuid=uuid })
//根据json生成面要素的地图样式xml文件
var styleJson_polygon = {
"style":{
"Type": "Polygon",
"Color": "black",
"LineWidth": 1,
"FillColor": "#bee826"
},
"layer":{
"path":"/luojun/github/geotiff-server/test/data/clip2.rs",
"SRS":"3857"
}
}
const style_str_polygon= JSON.stringify(styleJson_polygon)
geotile_sdk.generateXML(style_str_polygon, (err,uuid)=>{ if(!!err)var xml_uuid_polygon=uuid })
//根据json生成线要素的地图样式xml文件
var styleJson_line={
"style":{
"Type":"Line",
"Color":"#bee826",
"LineWidth":1
},
"layer":{
"path":"/luojun/github/geotiff-server/test/data/clip2.rs",
"SRS":"3857"
}
}
const style_str_line= JSON.stringify(styleJson_line)
geotile_sdk.generateXML(style_str_line, (err,uuid)=>{ if(!!err)var xml_uuid_line=uuid })
//根据json生成点要素的地图样式xml文件
var styleJson_point={
"style":{
"Type":"Point",
},
"layer":{
"path":"/luojun/github/geotiff-server/test/data/clip2.rs",
"SRS":"3857"
}
}
const style_str_point= JSON.stringify(styleJson_point)
geotile_sdk.generateXML(style_str_point, (err,uuid)=>{ if(!!err)var xml_uuid_point=uuid })
//获取瓦片: 传入参数(瓦片的xyz,数据源路径,数据的空间参考系,结果处理回调函数,地图样式文件的uuid)
geotile_sdk.fetchTile(109195, 51561, 17, xml_uuid_raster, (err,buffer) => {});
geotile_sdk.fetchTile(109195, 51561, 17, xml_uuid_polygon, (err,buffer) => {});
geotile_sdk.fetchTile(109195, 51561, 17, xml_uuid_line, (err,buffer) => {});
}