geoPHP就绪属性/元数据

时间:2019-06-18 12:48:49

标签: properties geophp

这个想法是在循环geoJson文件中的所有exisint特征时检索properties。我有一个像这样的geoJson文件:

{
    "type": "FeatureCollection",
    "features": [{
        "type": "Feature",
        "properties": {
            "region_name": "my_region",
            "province_name": "my_province",
            ...
        },
        "geometry": {
            "type": "Polygon",
            "coordinates": [
                [
                    [
                        16.45477294921875,
                        43.51619059561274
                    ],
                    [
                        16.450481414794922,
                        43.50772499687011
                    ],
                    [
                        16.470909118652344,
                        43.5019975949657
                    ],
                    [
                        16.481552124023438,
                        43.51021500212034
                    ],
                    [
                        16.475543975830078,
                        43.518306809754804
                    ],
                    [
                        16.45477294921875,
                        43.51619059561274
                    ]
                ]
            ]
        }
    }]
}

尝试使用geoPHP读取它,我使用:

$geoData = geoPHP::load(file_get_contents("path/to/myGeoJson-File.json"),'json');

当转储结果变量时,它没有任何属性字段/数据

Polygon Object
(
    [geom_type:protected] => Polygon
    [components] => Array
        (
            [0] => LineString Object
                (
                    [geom_type:protected] => LineString
                    [components] => Array
                        (
                            [0] => Point Object
                                (
                                    [coords] => Array
                                        (
                                            [0] => 16.454772949219
                                            [1] => 43.516190595613
                                        )

                                    [geom_type:protected] => Point
                                    [dimension:protected] => 2
                                    [geos:Geometry:private] => 
                                    [srid:protected] => 
                                )

                            [1] => Point Object
                                (
                                    [coords] => Array
                                        (
                                            [0] => 16.450481414795
                                            [1] => 43.50772499687
                                        )

                                    [geom_type:protected] => Point
                                    [dimension:protected] => 2
                                    [geos:Geometry:private] => 
                                    [srid:protected] => 
                                )

                            [2] => Point Object
                                (
                                    [coords] => Array
                                        (
                                            [0] => 16.470909118652
                                            [1] => 43.501997594966
                                        )

                                    [geom_type:protected] => Point
                                    [dimension:protected] => 2
                                    [geos:Geometry:private] => 
                                    [srid:protected] => 
                                )

                            [3] => Point Object
                                (
                                    [coords] => Array
                                        (
                                            [0] => 16.481552124023
                                            [1] => 43.51021500212
                                        )

                                    [geom_type:protected] => Point
                                    [dimension:protected] => 2
                                    [geos:Geometry:private] => 
                                    [srid:protected] => 
                                )

                            [4] => Point Object
                                (
                                    [coords] => Array
                                        (
                                            [0] => 16.47554397583
                                            [1] => 43.518306809755
                                        )

                                    [geom_type:protected] => Point
                                    [dimension:protected] => 2
                                    [geos:Geometry:private] => 
                                    [srid:protected] => 
                                )

                            [5] => Point Object
                                (
                                    [coords] => Array
                                        (
                                            [0] => 16.454772949219
                                            [1] => 43.516190595613
                                        )

                                    [geom_type:protected] => Point
                                    [dimension:protected] => 2
                                    [geos:Geometry:private] => 
                                    [srid:protected] => 
                                )

                        )

                    [geos:Geometry:private] => 
                    [srid:protected] => 
                )

        )

    [geos:Geometry:private] => 
    [srid:protected] => 
)

有人解决我如何准备好properties吗?

请注意:geoPHP已成功安装geos extension

0 个答案:

没有答案