geojson文件规格

geojson文件示例,

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [102.0, 0.5]
      },
      "properties": {
        "name": "Example Point"
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [102.0, 0.0],
          [103.0, 1.0],
          [104.0, 0.0],
          [105.0, 1.0]
        ]
      },
      "properties": {
        "name": "Example Line"
      }
    },
    {
      "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": {
        "name": "Example Polygon"
      }
    }
  ]
}

在这里插入图片描述

geojson示例2,

{
    "features": [
        {
            "geometry": {
                "coordinates": [
                    [
                        116.27394289090265,
                        40.04563683773862,
                        38.911601834233437
                    ],
                    [
                        116.27394460815701,
                        40.04562333499269,
                        38.908991369866669
                    ]
                ],
                "type": "LineString"
            },
            "properties": {
                "line_color": "3",
                "line_conf_type": "196.507625",
                "line_type": "7",
                "source": "optimized_line_feature"
            },
            "type": "Feature"
        },
        {
            "geometry": {
                "coordinates": [
                    [
                        116.27372626712896,
                        40.04566908578874,
                        38.163651788610785
                    ],
                    [
                        116.27372924922214,
                        40.04565573741756,
                        38.165627857154753
                    ]
                ],
                "type": "LineString"
            },
            "properties": {
                "line_color": "3",
                "line_conf_type": "196.507625",
                "line_type": "7",
                "source": "optimized_line_feature"
            },
            "type": "Feature"
        },
        {
            "geometry": {
                "coordinates": [
                    [
                        116.2736425888071,
                        40.04585037786518,
                        37.983635180289525
                    ],
                    [
                        116.2736420649746,
                        40.04583632046637,
                        37.972707995880953
                    ]
                ],
                "type": "LineString"
            },
            "properties": {
                "line_color": "3",
                "line_conf_type": "196.507625",
                "line_type": "7",
                "source": "optimized_line_feature"
            },
            "type": "Feature"
        }
    ],
    "name": "SingleTrajectoryRes",
    "type": "FeatureCollection"
}

生成geojson文件的C++代码示例,

void GlobalMappingImpl::generate_geojson_gnss() const {
    Json::Value root;
    root.clear();
    root["type"] = "FeatureCollection";
    root["name"] = "SingleTrajectoryGlobalRes";
    auto& root_features = root["features"];

    auto _it_meas = _map_gnss._meas_map.begin();
    while (_map_gnss._meas_map.size() >= 1 && _it_meas != _map_gnss._meas_map.end()) {
        Json::Value json;
        json["type"] = "Feature";
        auto& json_properties = json["properties"];
        json_properties["name"] = "GNSS";
        json_properties["head_veh"].append(_it_meas->second->head_veh());
        json_properties["fix_type"].append(_it_meas->second->fix_type());
        auto& json_geometry = json["geometry"];
        json_geometry["type"] = "Point";
        json_geometry["coordinates"].append(_it_meas->second->lon());
        json_geometry["coordinates"].append(_it_meas->second->lat());
        root_features.append(json);
        _it_meas++;
    }
    static Json::FastWriter fast_write;
    auto* file = new std::ofstream("./debug_optimized_gnss.geojson", std::ios::trunc);
    if (file->is_open()) {
        *file << fast_write.write(root);
        file->flush();
        file->close();
    }
    delete file;
}

代码示例2,

//output.geo.json
for (auto partition : _partition_set.partitions) {
    int id = partition.partition_id;

    Json::Value root;
    root["type"] = "FeatureCollection";
    root["name"] = "SingleTrajectoryGlobalRes";
    auto &features = root["features"];

    for (auto lanemarking : partition.lanemarking_segment_set) {
        Json::Value feature;
        feature["type"] = "Feature";
        auto &properties = feature["properties"];
        properties["marking_id"] = lanemarking.marking_id;
        properties["if_edge"] = lanemarking.if_edge;
        auto &geometry = feature["geometry"];
        geometry["type"] = "LineString"; 
        auto &coordinates = geometry["coordinates"];
        for (auto point : lanemarking.marking_points) {
            double x = point.geometry[1];
            double y = point.geometry[0];
            double z = point.geometry[2];
            Json::Value coord;
            coord.append(x);
            coord.append(y);
            coord.append(z);
            coordinates.append(coord);
        }
        features.append(feature);
    }

    std::string geo_save_dir_path = "log";
    if (!boost::filesystem::exists(geo_save_dir_path)) {
        boost::filesystem::create_directories(geo_save_dir_path);
    }        
    std::string geojson_save_path = geo_save_dir_path + "/partitionid" + std::to_string(id) + ".geo.json";

    Json::FastWriter fast_write;
    std::ofstream file(geojson_save_path, std::ios::trunc);
    if (file.is_open()) {
        file << fast_write.write(root);
        file.flush();
        file.close();
    }
}
  • 12
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
本系统的研发具有重大的意义,在安全性方面,用户使用浏览器访问网站时,采用注册和密码等相关的保护措施,提高系统的可靠性,维护用户的个人信息和财产的安全。在方便性方面,促进了校园失物招领网站的信息化建设,极大的方便了相关的工作人员对校园失物招领网站信息进行管理。 本系统主要通过使用Java语言编码设计系统功能,MySQL数据库管理数据,AJAX技术设计简洁的、友好的网址页面,然后在IDEA开发平台中,编写相关的Java代码文件,接着通过连接语言完成与数据库的搭建工作,再通过平台提供的Tomcat插件完成信息的交互,最后在浏览器中打开系统网址便可使用本系统。本系统的使用角色可以被分为用户和管理员,用户具有注册、查看信息、留言信息等功能,管理员具有修改用户信息,发布寻物启事等功能。 管理员可以选择任一浏览器打开网址,输入信息无误后,以管理员的身份行使相关的管理权限。管理员可以通过选择失物招领管理,管理相关的失物招领信息记录,比如进行查看失物招领信息标题,修改失物招领信息来源等操作。管理员可以通过选择公告管理,管理相关的公告信息记录,比如进行查看公告详情,删除错误的公告信息,发布公告等操作。管理员可以通过选择公告类型管理,管理相关的公告类型信息,比如查看所有公告类型,删除无用公告类型,修改公告类型,添加公告类型等操作。寻物启事管理页面,此页面提供给管理员的功能有:新增寻物启事,修改寻物启事,删除寻物启事。物品类型管理页面,此页面提供给管理员的功能有:新增物品类型,修改物品类型,删除物品类型。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

YMWM_

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值