Echarts地图坐标geoCoordMap数据获取

该代码段展示了一个从阿里云数据平台获取中国所有省份边界信息的API调用方法。通过HTTP请求获取JSON数据,解析并提取省份名称及中心坐标,存储到Map中返回。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 数据来源网站 :http://datav.aliyun.com/tools/atlas/#&lat=30.332329214580188&lng=106.72278672066881&zoom=3.5 

    public Map<String, Object> getProvinceGeo() {
        String body = HttpUtil.get("https://geo.datav.aliyun.com/areas_v2/bound/100000_full.json");
        JSONArray features = JSONUtil.parse(body).getByPath("features", JSONArray.class);
        Map<String, Object> map = new HashMap<>(8);
        features.forEach(v -> {
            JSONObject json = JSONUtil.parseObj(v);
            String name = json.getByPath("properties.name", String.class);
            Object center = json.getByPath("properties.center", Object.class);
            map.put(StrUtil.removeAny(name, "省"), center);
        });
        return map;
    }

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值