vendredi 27 février 2015

How to insert the following JSON Data into a table? (I'm using Geoserver)


I'm very frustrated trying to fix the following code. I'm new in this and I'd like a little help here:


First, I have the following code and It works perfectly: I received a JSON Data from Geoserver (sectoresURL) and then, I put it into a DIV. That's all.



<div id="info" style="width: 100%; height: 280px; overflow-y: scroll;"></div>

<script type="text/javascript">
function showResult(sectoresURL) {

$('#info').empty(); // Remove all child in stack.

$.getJSON(sectoresURL, function (json) {
if (sectores.getVisible() && typeof(json.features[0]) != 'undefined') {
$('#info').append('<iframe width="99%" seamless src="' + sectoresURL + '"></iframe>');
}
});
}
</script>


But now, I want to insert all this into a table but I can't do it. At present, I'm showing in the browser like JSON format, but definitely It isn't the idea.


By the way, the JSON Data is:



{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": "SectoresComunaCurico.34",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
301138.4332258755,
6110719.0948824
],
[
307975.62819723826,
6117936.350421507
],
[
309421.54950536136,
6117454.401929129
],
[
314529.81321677275,
6117779.869510237
],
[
321315.062045189,
6115168.846100847
],
[
309617.2118206576,
6102890.015916108
],
[
306318.28485806234,
6104246.552389812
],
[
301138.4332258755,
6110719.0948824
]
]
]
},
"geometry_name": "FiguraGeometrica",
"properties": {
"Numero": 19,
"Sector": "Cordillera"
}
}
],
"crs": {
"type": "name",
"properties": {
"name": "urn:ogc:def:crs:EPSG::32319"
}
}
}


I've tried to insert all this in Bootstrap-Table but without success. Also, Is there some way to re-use geoserver template to do it? At the present, I have one but for {'INFO_FORMAT': 'text/html'});


Regards.





Aucun commentaire:

Enregistrer un commentaire