Created
June 18, 2020 06:50
GoogleEarth用KP-KML作成
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN{ | |
FS="," | |
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | |
print "<kml xmlns=\"http://www.opengis.net/kml/2.2\" xmlns:gx=\"http://www.google.com/kml/ext/2.2\" xmlns:kml=\"http://www.opengis.net/kml/2.2\" xmlns:atom=\"http://www.w3.org/2005/Atom\">" | |
print "<Document>" | |
print " <name>road-kp.kml</name>" | |
print " <StyleMap id=\"msn_grn-blank\">" | |
print " <Pair>" | |
print " <key>normal</key>" | |
print " <styleUrl>#sn_grn-blank</styleUrl>" | |
print " </Pair>" | |
print " <Pair>" | |
print " <key>highlight</key>" | |
print " <styleUrl>#sh_grn-blank</styleUrl>" | |
print " </Pair>" | |
print " </StyleMap>" | |
print " <Style id=\"sh_grn-blank\">" | |
print " <IconStyle>" | |
print " <scale>1.3</scale>" | |
print " <Icon>" | |
print " <href>http://maps.google.com/mapfiles/kml/paddle/grn-blank.png</href>" | |
print " </Icon>" | |
print " <hotSpot x=\"32\" y=\"1\" xunits=\"pixels\" yunits=\"pixels\"/>" | |
print " </IconStyle>" | |
print " <ListStyle>" | |
print " <ItemIcon>" | |
print " <href>http://maps.google.com/mapfiles/kml/paddle/grn-blank-lv.png</href>" | |
print " </ItemIcon>" | |
print " </ListStyle>" | |
print " </Style>" | |
print " <Style id=\"sn_grn-blank\">" | |
print " <IconStyle>" | |
print " <scale>1.1</scale>" | |
print " <Icon>" | |
print " <href>http://maps.google.com/mapfiles/kml/paddle/grn-blank.png</href>" | |
print " </Icon>" | |
print " <hotSpot x=\"32\" y=\"1\" xunits=\"pixels\" yunits=\"pixels\"/>" | |
print " </IconStyle>" | |
print " <ListStyle>" | |
print " <ItemIcon>" | |
print " <href>http://maps.google.com/mapfiles/kml/paddle/grn-blank-lv.png</href>" | |
print " </ItemIcon>" | |
print " </ListStyle>" | |
print " </Style>" | |
print " <Folder>" | |
print " <name>キロポスト</name>" | |
print " <open>1</open>" | |
} | |
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 " <description></description>" | |
print " <LookAt>" | |
print " <longitude>"longitude_deg"</longitude>" | |
print " <latitude>"latitude_deg"</latitude>" | |
print " <altitude>0</altitude>" | |
print " <heading>0</heading>" | |
print " <tilt>30</tilt>" | |
print " <range>500</range>" | |
print " </LookAt>" | |
print " <styleUrl>#msn_grn-blank</styleUrl>" | |
print " <Point>" | |
print " <gx:drawOrder>1</gx:drawOrder>" | |
print " <coordinates>"longitude_deg","latitude_deg",0</coordinates>" | |
print " </Point>" | |
print " </Placemark>" | |
} | |
END{ | |
print " </Folder>" | |
print " </Document>" | |
print "</kml>" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
道路基準点案内システムから得られる基準点(キロポスト)のCSVファイルを、必要な項目のみKML変換して、Google EarthやGoogle Mapsで使用できるようにするawkスクリプト。