SimpleGeo Polymaps 完全菜鸟 LineString 显示为多边形问题?
因此,我正在尝试作为初学者使用多贴图,调整午夜指挥官示例:
var po = org.polymaps;
var map = po.map()
.container(document.getElementById("map").appendChild(po.svg("svg")))
.add(po.interact())
.add(po.hash());
map.add(po.image()
.url(po.url("http://{S}tile.cloudmade.com"
+ "/985d631542924aaa8718b9864529ae8c" // http://cloudmade.com/register
+ "/37326/256/{Z}/{X}/{Y}.png")
.hosts(["a.", "b.", "c.", ""])));
map.add(po.compass()
.pan("none"));
我以 geoJson 格式在本地加载一些道路:
map.add(po.geoJson().url("mylines.geojson"));
GeoJson 示例:
{"type": "FeatureCollection", "features": [{"geometry": {"type": "LineString", "coordinates": [[-4.240532511128865, 55.891926951654455], [-4.238934645983739, 55.891956028400834]]}, "type": "Feature", "id": 6718, "properties": {"IDENTIFIER": "2602840669377", "CODE": 6140, "NAME": ""}}]}
现在 mylines.geojson 显示,但它不是显示为一条线,而是显示为多边形。
我的问题是,我需要做什么才能让 Polymap 将 LineString 显示为一条线(它是道路数据)而不是多边形?
So I'm trying out polymaps as a beginner, adapting the midnight commander example:
var po = org.polymaps;
var map = po.map()
.container(document.getElementById("map").appendChild(po.svg("svg")))
.add(po.interact())
.add(po.hash());
map.add(po.image()
.url(po.url("http://{S}tile.cloudmade.com"
+ "/985d631542924aaa8718b9864529ae8c" // http://cloudmade.com/register
+ "/37326/256/{Z}/{X}/{Y}.png")
.hosts(["a.", "b.", "c.", ""])));
map.add(po.compass()
.pan("none"));
to which I am loading some roads locally in geoJson format:
map.add(po.geoJson().url("mylines.geojson"));
GeoJson sample:
{"type": "FeatureCollection", "features": [{"geometry": {"type": "LineString", "coordinates": [[-4.240532511128865, 55.891926951654455], [-4.238934645983739, 55.891956028400834]]}, "type": "Feature", "id": 6718, "properties": {"IDENTIFIER": "2602840669377", "CODE": 6140, "NAME": ""}}]}
Now mylines.geojson displays but it isn't displaying as a line but as polygons.
My question is, what do I need to do to get Polymaps to display the LineString as a line (it's road data) and not as polygons?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Polymaps 使用 SVG Path 来渲染 Linestring。您必须将 fill 属性设置为 none
http://www.w3.org/ TR/SVG/paths.html#PathElement
Polymaps use SVG Path to render Linestring. You have to set the fill attribute to none
http://www.w3.org/TR/SVG/paths.html#PathElement