且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将JSON转换为GeoJSON

更新时间:2023-02-14 10:26:07

如果您确实在项目中添加了jQuery,那么您就快到了:

If you do have jQuery in your project added, then you are almost there:

$.getJSON("./data/tracking.json", function(jsonData) {
    /* 
    Here the anonymous function is called when the file has been downloaded.
    Only then you can be sure that the JSON data is present and you can work with it's data.
    You have to keep in mind if you are getting the file synchronously or asynchronously (default).
   */
});