无效的Geojson对象 Django-leaflet [django] 。

问题描述 投票:0回答:1

这是我试图用django-leaflet和django-geojson在Django上渲染的geojson对象。

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "model": "rent_app.apartment"
      },
      "id": "APT",
      "geometry": {
        "type": "Point",
        "coordinates": [
          38.771353,
          8.984487
        ]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "model": "rent_app.apartment"
      },
      "id": "APT2",
      "geometry": {
        "type": "Point",
        "coordinates": [
          38.773155,
          8.98525
        ]
      }
    }
  ],
  "crs": {
    "type": "link",
    "properties": {
      "href": "http://spatialreference.org/ref/epsg/4326/",
      "type": "proj4"
    }
  }
}

我得到的是 Invalid GeoJSON object 试图渲染geojson的时候。有什么解决办法吗?

django geojson django-leaflet
1个回答
0
投票

事实证明,GeoJSON要么有一个额外的大括号,破坏了geojson格式,要么是 crs 并非不再接受。

© www.soinside.com 2019 - 2024. All rights reserved.