[英]Include and run javascript file in chrome console
Extending this question : Include javascript file in chrome console 扩展此问题: 在chrome控制台中包含javascript文件
I'm trying to include this file : https://rawgit.com/mapbox/tokml/master/tokml.js 我正在尝试包含此文件: https : //rawgit.com/mapbox/tokml/master/tokml.js
Tried using the example above, and several other following the same principle, but whenever I call tokml
in console it always gives is not defined
使用上面的示例进行了尝试,并遵循相同的原理进行了尝试,但是每当我在控制台中调用
tokml
,它始终会给出is not defined
I think it has something to do with it being encapsulated in a function? 我认为它与封装在函数中有关吗? It is a bundled node.js module, I wouldn't know how to edit it so that it is no longer encapsulated.
它是一个捆绑的node.js模块,我不知道如何编辑它,以便不再封装它。
How can I call toklm
from my cdn in a website? 如何在网站上从我的CDN调用
toklm
?
It also doesn't need to be in chrome, open to all alternatives 它也不必是镀铬的,对所有替代品都开放
// kml is a string of KML data, geojsonObject is a JavaScript object of
// GeoJSON data
var kml = tokml(geojsonObject);
// grab name and description properties from each object and write them in
// KML
var kmlNameDescription = tokml(geojsonObject, {
name: 'name',
description: 'description'
});
// name and describe the KML document as a whole
var kmlDocumentName = tokml(geojsonObject, {
documentName: 'My List Of Markers',
documentDescription: "One of the many places you are not I am"
});
tokml(geojsonObject, [options])
Given GeoJSON data as an object, return KML data as a string of XML. 以GeoJSON数据作为对象,将KML数据作为XML字符串返回。
options
is an optional object that takes the following options: options
是一个可选对象,它具有以下选项:
The property to name/description mapping: while GeoJSON supports freeform properties
on each feature, KML has an expectation of name
and description
properties that are often styled and displayed automatically. 属性到名称/描述的映射:尽管GeoJSON支持每个功能的自由格式
properties
,但KML期望name
和description
属性可以自动设置样式和显示。 These options let you define a mapping from the GeoJSON style to KML's. 这些选项可让您定义从GeoJSON样式到KML的映射。
name
: the name of the property in each GeoJSON Feature that contains the feature's name name
:每个GeoJSON要素中包含该要素名称的属性名称 description
: the name of the property in each GeoJSON Feature that contains the feature's description description
:每个GeoJSON要素中包含该要素描述的属性名称 Timestamp: KML can associate features with a moment in time via the TimeStamp
tag. 时间戳: KML可以通过
TimeStamp
标签将要素与时间关联起来。 GeoJSON doesn't have a comparable field, but a custom property can be mapped GeoJSON没有可比较的字段,但是可以映射自定义属性
timestamp
: the name of the property in each GeoJSON Feature that contains a timestamp in XML Schema Time (yyyy-mm-ddThh:mm:sszzzzzz) timestamp
:每个GeoJSON Feature中的属性名称,其中包含XML Schema Time中的时间戳记(yyyy-mm-ddThh:mm:sszzzzzz) Document name and description : KML supports name
and description
properties for the full document. 文档名称和描述 :KML支持整个文档的
name
和description
属性。
documentName
: the name of the full document documentName
:完整文档的名称 documentDescription
: the description of the full document documentDescription
:完整文档的描述 simplestyle-spec support: simplestyle-spec支持:
simplestyle
: set to true
to convert simplestyle-spec styles into KML styles simplestyle
:设置为true
可以将simplestyle-spec样式转换为KML样式 Source: https://github.com/mapbox/tokml#example 资料来源: https : //github.com/mapbox/tokml#example
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.