Идея состоит в том, чтобы получить properties
при зацикливании всех существующих объектов в файле geoJson. У меня есть файл 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