zoukankan      html  css  js  c++  java
  • GIS数据格式topojson

    Topojson源自于GeoJson,是D3中描述地理数据的格式,D3的作者觉得GeoJson太繁琐。同样的数据,TopoJson是GeoJson的1/5。

    这里有一个转换TopoJson,GeoJson,Shp的网站http://mapshaper.org/;好像不好使

    GeoJson和TopopJson在线转换:http://jeffpaine.github.io/geojson-topojson/

    Openlayer3目前支持TopoJson

    GeoJson示例

    { "type": "FeatureCollection",
        "features": [
          { "type": "Feature",
            "geometry": {"type": "Point", "coordinates": [102.0, 0.5]},
            "properties": {"prop0": "value0"}
            },
          { "type": "Feature",
            "geometry": {
              "type": "LineString",
              "coordinates": [
                [102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]
                ]
              },
            "properties": {
              "prop0": "value0",
              "prop1": 0.0
              }
            },
          { "type": "Feature",
             "geometry": {
               "type": "Polygon",
               "coordinates": [
                 [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
                   [100.0, 1.0], [100.0, 0.0] ]
                 ]
             },
             "properties": {
               "prop0": "value0",
               "prop1": {"this": "that"}
               }
             }
           ]
    }

     转化为TopoJson示例

    {
        "type": "Topology",
        "objects": {
            "collection": {
                "type": "GeometryCollection",
                "geometries": [
                    {
                        "type": "Point",
                        "coordinates": [
                            4000,
                            5000
                        ]
                    },
                    {
                        "type": "LineString",
                        "arcs": [
                            0
                        ]
                    },
                    {
                        "type": "Polygon",
                        "arcs": [
                            [
                                1
                            ]
                        ]
                    }
                ]
            }
        },
        "arcs": [
            [
                [
                    4000,
                    0
                ],
                [
                    1999,
                    9999
                ],
                [
                    2000,
                    -9999
                ],
                [
                    2000,
                    9999
                ]
            ],
            [
                [
                    0,
                    0
                ],
                [
                    2000,
                    0
                ],
                [
                    0,
                    9999
                ],
                [
                    -2000,
                    0
                ],
                [
                    0,
                    -9999
                ]
            ]
        ],
        "bbox": [
            100,
            0,
            105,
            1
        ],
        "transform": {
            "scale": [
                0.0005000500050005,
                0.00010001000100010001
            ],
            "translate": [
                100,
                0
            ]
        }
    }
  • 相关阅读:
    jQuery之元素操作及事件绑定
    JS中常遇到的浏览器兼容问题和解决方法
    九九乘法表
    全选复习
    css基本知识
    js数组
    Spark常见错误问题汇总
    被问懵逼的Kafka面试题
    被问懵逼的数仓面试
    Flink模拟项目: 订单支付实时监控
  • 原文地址:https://www.cnblogs.com/yoyogis/p/4575376.html
Copyright © 2011-2022 走看看