0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GPSの研究 その16

Last updated at Posted at 2018-06-19

概要

GPSを理解したかった。
ntrip casterのRTK2go.comのsourcetableをパースして見た。

写真

image.png

サンプルコード

function run() {
    var objs = [];
    var src = document.getElementById('src');
    var lines = src.value.split('\n');
    for (var i = 0; i < lines.length - 1; i++)
    {   
        var line = lines[i].split(';');
        switch (line[0])
		{
		case 'STR':
            objs.push({
                mountpoint: line[1], 
                identifier: line[2],
                format: line[3],
                format_details: line[4],
                carrier: line[5],
                nav_system: line[6],
                network: line[7],
                country: line[8],
                latitude: line[9],
                longitude: line[10],
                nmea: line[11],
                solution: line[12],
                generator: line[13],
                compression: line[14],
                authentication: line[15],
                bitrate: line[16],
                misc: line[17]
            });

        case 'CAS':
                
        case 'NET':
                
		default:
			
		}
    }
    var table = d3.select("body").insert("table", ":first-child");
    var thead = table.append("thead");
    var tbody = table.append("tbody");
    thead.append("tr").selectAll("th").data(d3.entries(objs[0])).enter().append("th").on("click", function(d, i) {
        createTableBody(d.key);
    }).text(function(d) {
        return d.key;
    });
    createTableBody("id");
    function createTableBody(sortKey) {
        objs.sort(function(x, y) {
            return d3.descending(x[sortKey], y[sortKey]);
        });
        tbody.selectAll("tr").data(objs).enter().append("tr").selectAll("td").data(function(d) {
            return d3.entries(d);
        }).enter().append("td").text(function(d) {
            return d.value;
        });
        tbody.selectAll("tr").data(objs).selectAll("td").data(function(d) {
            return d3.entries(d);
        }).text(function(d) {
            return d.value;
        });
    }   
}

成果物

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?