我想读取和张贴在jqGrid中的一组地震GeoJSON数据从USGS存储库中提取。 该请求被接受,但在可能符合标题元数据时显示“Uncaught SyntaxError:Unexpected token”。jqGrid from USGS geojson data
$(function() {
'use strict';
$.extend($.jgrid.search, {multipleSearch: true, multipleGroup: true, overlay: 0});
$('#grid').jqGrid({
url: 'http://earthquake.usgs.gov/earthquakes/feed/geojson/2.5/week?callback=?',
datatype: 'json',
colModel: [
{name: 'mag', label: 'MAGNITUDO', width: 150, jsonmap: 'properties.mag', sorttype: 'number',
formatter: 'number', formatoptions: {decimalPlaces: 2}},
{name: 'place', label: 'LOCALITA', width: 150, jsonmap: 'properties.place'},
{name: 'url', label: 'URL', width: 150, jsonmap: 'properties.url'}
],
toppager: true,
gridview: true,
rowList: [10, 20, 50, 10000],
rowNum: 10,
jsonReader: {
root: 'features',
repeatitems: false
},
loadonce: true,
ignoreCase: true,
height: 'auto'
}).jqGrid('navGrid', '#grid_toppager', {add: false, edit: false, del: false})
.jqGrid('filterToolbar', {stringResult: true, defaultSearch: 'cn', searchOnEnter: false});
$("#grid_toppager option[value=10000]").text('All');
});
你有什么解决方法吗? 在此先感谢。
您是否测试过JSON有效? – Mark 2013-03-20 10:37:51
虽然GeoJSON是一个地理空间数据,但指向根的是“特征”。我认为没有问题。也许我错了? – user2190221 2013-03-20 11:28:30