Answers:
对于GeoJSON-CSS样式用于修改点,线,具有厚度和颜色的多边形
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [[
[-180.0, 10.0], [20.0, 90.0], [180.0, -5.0], [-30.0, -90.0]
]]
},
"style": {
"__comment": "all SVG styles allowed",
"fill":"red",
"stroke-width":"3",
"fill-opacity":0.6
},
"className": {
"baseVal":"A class name"
}
}
这些天来有Mapbox的SimpleStyle。
"properties": {
// OPTIONAL: default ""
// A title to show when this item is clicked or
// hovered over
"title": "A title",
// OPTIONAL: default ""
// A description to show when this item is clicked or
// hovered over
"description": "A description",
// OPTIONAL: default "medium"
// specify the size of the marker. sizes
// can be different pixel sizes in different
// implementations
// Value must be one of
// "small"
// "medium"
// "large"
"marker-size": "medium",
// OPTIONAL: default ""
// a symbol to position in the center of this icon
// if not provided or "", no symbol is overlaid
// and only the marker is shown
// Allowed values include
// - Icon ID from the Maki project at http://mapbox.com/maki/
// - An integer 0 through 9
// - A lowercase character "a" through "z"
"marker-symbol": "bus",
// OPTIONAL: default "7e7e7e"
// the marker's color
//
// value must follow COLOR RULES
"marker-color": "#fff",
// OPTIONAL: default "555555"
// the color of a line as part of a polygon, polyline, or
// multigeometry
//
// value must follow COLOR RULES
"stroke": "#555555",
// OPTIONAL: default 1.0
// the opacity of the line component of a polygon, polyline, or
// multigeometry
//
// value must be a floating point number greater than or equal to
// zero and less or equal to than one
"stroke-opacity": 1.0,
// OPTIONAL: default 2
// the width of the line component of a polygon, polyline, or
// multigeometry
//
// value must be a floating point number greater than or equal to 0
"stroke-width": 2,
// OPTIONAL: default "555555"
// the color of the interior of a polygon
//
// value must follow COLOR RULES
"fill": "#555555",
// OPTIONAL: default 0.6
// the opacity of the interior of a polygon. implementations
// may choose to set this to 0 for line features.
//
// value must be a floating point number greater than or equal to
// zero and less or equal to than one
"fill-opacity": 0.5
}
我认为这完全与拼写类型有关,如果需要,您可以添加更多定义。我不认为不参加json规范这么重要... json对象没有限制,唯一重要的是您的json必须有效才能正确使用...
并且我已经检查了Mapperz♦
geojson,它有一些解析错误..和有效的geojson:
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[-180, 10],[20, 90],[180, -5],[-30, -90]
]
]
},
"style": {
"stroke-width": "3",
"fill-opacity": 0.6
},
"className": {
"baseVal": "highway_primary"
}
}
最后要说的是,您可以从作为JSON验证程序的JSONLint中检查geojson文件是否有效...
希望对您有帮助