Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
地理院地図用KP-KML作成
BEGIN{
FS=","
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
print "<kml xmlns=\"http://www.opengis.net/kml/2.2\">"
print " <Document>"
print " <Style id=\"PolyStyle1\">"
print " <IconStyle>"
print " <Icon>"
print " <href>https://maps.gsi.go.jp/portal/sys/v4/symbols/080.png</href>"
print " </Icon>"
print " <scale>1</scale>"
print " </IconStyle>"
print " </Style>"
}
NR>1{
latitude_hours = $9;
latitude_minute = $10;
latitude_second = $11;
latitude_deg = latitude_hours+(latitude_minute/60)+(latitude_second/3600);
longitude_hours = $12;
longitude_minute = $13;
longitude_second = $14;
longitude_deg = longitude_hours+(longitude_minute/60)+(longitude_second/3600);
print " <Placemark>"
print " <name>"$8"KP</name>"
print " <styleUrl>#PolyStyle1</styleUrl>"
print " <Point>"
print " <coordinates>"longitude_deg","latitude_deg"</coordinates>"
print " </Point>"
print " </Placemark>"
}
END{
print " </Document>"
print "</kml>"
}
@sasapurin

This comment has been minimized.

Copy link
Owner Author

@sasapurin sasapurin commented Jun 20, 2020

道路基準点案内システム
http://www.road-refpoint.jp/kijunten/]http://www.road-refpoint.jp/kijunten/
からダウンロードできる基準点(キロポスト)のCSVファイルを地理院地図にプロットできるよう、KML形式に変換するawkスクリプト。中身はXML形式なので拡張子を自分でKMLにしてやればテキストエディタでも作成は可能。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment