FeiXianChengGuanHouTaiGuanLi/public/lib/terraformer/README.md

45 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#terraformer gis格式转换插件
官方网站http://terraformer.io/
github地址 https://github.com/Esri/terraformer
https://github.com/Esri/terraformer-wkt-parser
=============================================================
// parse ArcGIS JSON, convert it to a Terraformer.Primitive
var primitive = Terraformer.ArcGIS.parse({
x:"-122.6764",
y:"45.5165",
spatialReference: {
wkid: 4326
}
});
// take a Terraformer.Primitive or GeoJSON and convert it to ArcGIS JSON
var point = Terraformer.ArcGIS.convert({
"type": "Point",
"coordinates": [45.5165, -122.6764]
});
=============================================================
// parse a WKT file, convert it into a primitive
var primitive = Terraformer.WKT.parse('LINESTRING (30 10, 10 30, 40 40)');
// take a primitive and convert it into a WKT representation
var polygon = Terraformer.WKT.convert({
"type": "Polygon",
"coordinates": [
[ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ],
[ [100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2] ]
]
});