So I have already created table with searching filters and pagination. Now I would like to make it interact with map as well. Problem is I am trying to access geojson in wrong way, so maybe somebody can help.
My geojson:
{
"type": "FeatureCollection",
"crs": {
"type": "name",
"properties": {
"name": "urn:ogc:def:crs:OGC:1.3:CRS84"
}
},
"features": [{
"type": "Feature",
"properties": {
"name": "Berlin",
"country": "Germany"
},
"geometry": {
"type": "Point",
"coordinates": [28.410585, -11.293361]
}
}, .......
]
}
The service that retrieves it:
var AppMapDirectory = angular.module('DirectoryAppMap', ['ngResource']);
AppMapDirectory.factory("Directory", function($resource) {
return $resource("/result.json", {}, {
get: {
method: "GET",
cache: true
}
});
});
The controller that puts it in the scope:
AppMapDirectory.controller("DirectoryMapList", function($scope, Directory, $filter) {
Directory.query(function(data) {
$scope.list = data.features;
});
And the view:
<tr ng-repeat="hf in list">
<td>{{ hf.properties.name }}</td>
<td>{{ hf.properties.category }}</td>
</tr>
or
<tr ng-repeat="feature in list">
<td>{{ feature.properties.name }}</td>
<td>{{ feature.properties.category }}</td>
</tr>
I saw on stackoverflow that somebody was typing something like this:
$scope.list = data.features[];
but in my case json is not loading at all then
Mayby sb will say that i should use json instead of geojson, but my main point is to make map and table interactive so both will change if searching will work.
Or it is possible to use json data and geojson from the same source?
I plan to use leaflet directive with angular, it seems easy to use just geojson for map, but how to use geojson for table? Is it possible?