小编Fer*_*dao的帖子

使用 JavaScript 映射嵌套数组

我正在尝试使用 .map() 映射嵌套数组,这样我就可以在地图中显示并精确定位所有伦敦地铁位置。

this.undergroundGeoJson = [
        {
            'type': 'FeatureCollection',

            'crs': { 'type': 'name', 'properties': { 'name': 
            'urn:ogc:def:crs:OGC:1.3:CRS84' } },

            'features': [
                {
                    'type': 'Feature',
                    'geometry': {
                        'type': 'Point',
                        'coordinates': [-0.278126, 51.5025]
                    },
                    'properties': {
                        'name': 'Acton Town'
                    }
                },
                {
                    'type': 'Feature',
                    'geometry': {
                        'type': 'Point',
                        'coordinates': [-0.263033174, 51.50883531]
                    },
                    'properties': {
                        'name': 'Acton Central'
                    }
                },
                {
                    'type': 'Feature',
                    'geometry': {
                        'type': 'Point',
                        'coordinates': [-0.262879534, 51.50856013]
                    },
                    'properties': {
                        'name': 'Acton Central'
                    }
                }
           }
       ]
Run Code Online (Sandbox Code Playgroud)

我需要几何对象中的坐标数组元素。

这是我到目前为止的代码...

@computed …
Run Code Online (Sandbox Code Playgroud)

javascript arrays reactjs

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

arrays ×1

javascript ×1

reactjs ×1