使用TopoJSON客户端合并/连接几何

时间:2017-11-18 19:21:22

标签: d3.js topojson cartography

是否可以使用TopoJSON Client合并/连接几何。所以,例如,这个:

public void btnSave (View view){

    //getting data from edittext and spinner

    String fname = txtfname.getText().toString();
    String address = txtaddress.getText().toString();
    String office = spoffice.getSelectedItem().toString();
    String services = spservices.getSelectedItem().toString();
    String date = editdate.getText().toString();
    String time = edittime.getText().toString();

    inserttoDatabase(fname,address,date,time,office,services);
} 

会变成(像这样):

{"type":"Topology","objects":{"areas":{"type":"GeometryCollection","geometries":[{"type":"MultiPolygon","properties":{"common":"S B","class":"range s-b"},"arcs":[[[3053,3054,3055]],[[3075,3076,3077]]]},{"type":"Polygon","properties":{"common":"S B","class":"range s-b"},"arcs":[[3293,3294,3295,]]},{"type":"MultiPolygon","properties":{"common":"S B","class":"range s-b"},"arcs":[[[3011,3012,3013]],[[3014,3015,3016]]]},

换句话说,删除复制,将多面和多边形弧阵列组合成一个合并的多面阵列。

从许多形状移动(总共有5个多面阵列):

enter image description here

,只有一个:

enter image description here

如果我可以删除任何多余的内部边框和一些细节,那将是一个奖励 - 因为我的目标是减小文件大小。

我的脚本如下所示:

{"type":"Topology","objects":{"areas":{"type":"GeometryCollection","geometries":[{"type":"MultiPolygon","properties":{"common":"S B","class":"range s-b"},"arcs":[[[3053,3054,3055]],[[3075,3076,3077]]],[[3293,3294,3295,]],[[[3011,3012,3013]],[[3014,3015,3016]]]},

我试过了:

geo2topo areas=input.json \
| topoquantize 1e5 \
> output.json

......但这没有实现目标。

我可以尝试操作GeoJSON,但从可用文档中可以看出,在将JSON格式化为TopoJSON之后,最好执行简化和压缩。

0 个答案:

没有答案