from urllib.request import Request, urlopen
import xml.dom.minidom as MD
appid = 'YOUR APPLICATION ID' #Geben Sie die Anwendungs-ID an
headers = {'User-Agent': 'Yahoo AppID: {0}'.format(appid)}
# lat=Breitengrad, lon=Mittlere Länge, z=Skalierungsstufe, output=Ausgabeformat
#Geben Sie diesmal den Breiten- und Längengrad der Nagoya Station an
png_url = 'https://map.yahooapis.jp/map/V1/static?lat=35.170476&lon=136.882250&z=17'
xml_url = 'https://map.yahooapis.jp/map/V1/static?lat=35.170476&lon=136.882250&z=17&output=xml'
#Laden Sie das Kartenbild herunter und speichern Sie es
req = Request(png_url, headers=headers)
with urlopen(req) as res:
with open ('map.png', mode='wb') as file:
file.write(res.read())
#XML der Karteninformationen ausgeben
req = Request(xml_url, headers=headers)
with urlopen(req) as res:
body = res.read().decode('utf-8')
with open ('map.xml', mode='w') as file:
#XML formatieren und ausgeben
dom = MD.parseString(body)
dom.writexml(file, addindent=' ', newl='\n', encoding='utf-8')
Das erfasste Kartenbild.
Bedeutung der Hauptelemente und Attribute.
--Koordinaten: Kartenmittenkoordinaten --Coordinate-UL: Koordinaten oben links auf der Karte --Coordinate-UR: Koordinaten oben rechts auf der Karte --Coordinate-DL: Koordinaten unten links auf der Karte --Coordinate-DR: Koordinaten unten rechts auf der Karte
Die abgerufene XML-Datei.
map.xml
<?xml version="1.0" encoding="utf-8"?>
<ResultSet xmlns="urn:yahoo:jp:olp:static" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:yahoo:jp:olp:static http://olp.yahooapis.jp/OpenLocalPlatform/V1/staticResponse.xsd">
<Result>
<Coordinates datum="WGS84" format="lon,lat">136.88225,35.170476</Coordinates>
<Coordinate-UL>
<Coordinates datum="WGS84" format="lon,lat">136.8768855819702,35.1748609813922</Coordinates>
</Coordinate-UL>
<Coordinate-UR>
<Coordinates datum="WGS84" format="lon,lat">136.8876144180298,35.1748609813922</Coordinates>
</Coordinate-UR>
<Coordinate-DL>
<Coordinates datum="WGS84" format="lon,lat">136.8768855819702,35.1660907821191</Coordinates>
</Coordinate-DL>
<Coordinate-DR>
<Coordinates datum="WGS84" format="lon,lat">136.8876144180298,35.1660907821191</Coordinates>
</Coordinate-DR>
<Scale zlevel="17" sc="4">23842</Scale>
<Image>
<Width>500</Width>
<Height>500</Height>
</Image>
<Scales mode="map">
<Scale zlevel="1" sc="20">1562498438</Scale>
<Scale zlevel="2" sc="19">781249219</Scale>
<Scale zlevel="3" sc="18">390624609</Scale>
<Scale zlevel="4" sc="17">195312305</Scale>
<Scale zlevel="5" sc="16">97656152</Scale>
<Scale zlevel="6" sc="15">48828076</Scale>
<Scale zlevel="7" sc="14">24414038</Scale>
<Scale zlevel="8" sc="13">12207019</Scale>
<Scale zlevel="9" sc="12">6103510</Scale>
<Scale zlevel="10" sc="11">3051755</Scale>
<Scale zlevel="11" sc="10">1525877</Scale>
<Scale zlevel="12" sc="9">762939</Scale>
<Scale zlevel="13" sc="8">381469</Scale>
<Scale zlevel="14" sc="7">190735</Scale>
<Scale zlevel="15" sc="6">95367</Scale>
<Scale zlevel="16" sc="5">47684</Scale>
<Scale zlevel="17" sc="4">23842</Scale>
<Scale zlevel="18" sc="3">11921</Scale>
<Scale zlevel="19" sc="2">5960</Scale>
<Scale zlevel="20" sc="1">2980</Scale>
</Scales>
<Scales mode="map-mobile">
<Scale zlevel="1" sc="20">1562498438</Scale>
<Scale zlevel="2" sc="19">781249219</Scale>
<Scale zlevel="3" sc="18">390624609</Scale>
<Scale zlevel="4" sc="17">195312305</Scale>
<Scale zlevel="5" sc="16">97656152</Scale>
<Scale zlevel="6" sc="15">48828076</Scale>
<Scale zlevel="7" sc="14">24414038</Scale>
<Scale zlevel="8" sc="13">12207019</Scale>
<Scale zlevel="9" sc="12">6103510</Scale>
<Scale zlevel="10" sc="11">3051755</Scale>
<Scale zlevel="11" sc="10">1525877</Scale>
<Scale zlevel="12" sc="9">762939</Scale>
<Scale zlevel="13" sc="8">381469</Scale>
<Scale zlevel="14" sc="7">190735</Scale>
<Scale zlevel="15" sc="6">95367</Scale>
<Scale zlevel="16" sc="5">47684</Scale>
<Scale zlevel="17" sc="4">23842</Scale>
<Scale zlevel="18" sc="3">11921</Scale>
<Scale zlevel="19" sc="2">5960</Scale>
<Scale zlevel="20" sc="1">2980</Scale>
</Scales>
<Scales mode="photo">
<Scale zlevel="1" sc="20">1562498438</Scale>
<Scale zlevel="2" sc="19">781249219</Scale>
<Scale zlevel="3" sc="18">390624609</Scale>
<Scale zlevel="4" sc="17">195312305</Scale>
<Scale zlevel="5" sc="16">97656152</Scale>
<Scale zlevel="6" sc="15">48828076</Scale>
<Scale zlevel="7" sc="14">24414038</Scale>
<Scale zlevel="8" sc="13">12207019</Scale>
<Scale zlevel="9" sc="12">6103510</Scale>
<Scale zlevel="10" sc="11">3051755</Scale>
<Scale zlevel="11" sc="10">1525877</Scale>
<Scale zlevel="12" sc="9">762939</Scale>
<Scale zlevel="13" sc="8">381469</Scale>
<Scale zlevel="14" sc="7">190735</Scale>
<Scale zlevel="15" sc="6">95367</Scale>
<Scale zlevel="16" sc="5">47684</Scale>
<Scale zlevel="17" sc="4">23842</Scale>
<Scale zlevel="18" sc="3">11921</Scale>
<Scale zlevel="19" sc="2">5960</Scale>
<Scale zlevel="20" sc="1">2980</Scale>
<Scale zlevel="21" sc="1">1490</Scale>
</Scales>
<Scales mode="hybrid">
<Scale zlevel="1" sc="20">1562498438</Scale>
<Scale zlevel="2" sc="19">781249219</Scale>
<Scale zlevel="3" sc="18">390624609</Scale>
<Scale zlevel="4" sc="17">195312305</Scale>
<Scale zlevel="5" sc="16">97656152</Scale>
<Scale zlevel="6" sc="15">48828076</Scale>
<Scale zlevel="7" sc="14">24414038</Scale>
<Scale zlevel="8" sc="13">12207019</Scale>
<Scale zlevel="9" sc="12">6103510</Scale>
<Scale zlevel="10" sc="11">3051755</Scale>
<Scale zlevel="11" sc="10">1525877</Scale>
<Scale zlevel="12" sc="9">762939</Scale>
<Scale zlevel="13" sc="8">381469</Scale>
<Scale zlevel="14" sc="7">190735</Scale>
<Scale zlevel="15" sc="6">95367</Scale>
<Scale zlevel="16" sc="5">47684</Scale>
<Scale zlevel="17" sc="4">23842</Scale>
<Scale zlevel="18" sc="3">11921</Scale>
<Scale zlevel="19" sc="2">5960</Scale>
<Scale zlevel="20" sc="1">2980</Scale>
<Scale zlevel="21" sc="1">1490</Scale>
</Scales>
<Scales mode="map-b1">
<Scale zlevel="19" sc="3">5960</Scale>
<Scale zlevel="20" sc="2">2980</Scale>
<Scale zlevel="21" sc="1">1490</Scale>
</Scales>
<Scales mode="hd">
<Scale zlevel="1" sc="20">1562498438</Scale>
<Scale zlevel="2" sc="19">781249219</Scale>
<Scale zlevel="3" sc="18">390624609</Scale>
<Scale zlevel="4" sc="17">195312305</Scale>
<Scale zlevel="5" sc="16">97656152</Scale>
<Scale zlevel="6" sc="15">48828076</Scale>
<Scale zlevel="7" sc="14">24414038</Scale>
<Scale zlevel="8" sc="13">12207019</Scale>
<Scale zlevel="9" sc="12">6103510</Scale>
<Scale zlevel="10" sc="11">3051755</Scale>
<Scale zlevel="11" sc="10">1525877</Scale>
<Scale zlevel="12" sc="9">762939</Scale>
<Scale zlevel="13" sc="8">381469</Scale>
<Scale zlevel="14" sc="7">190735</Scale>
<Scale zlevel="15" sc="6">95367</Scale>
<Scale zlevel="16" sc="5">47684</Scale>
<Scale zlevel="17" sc="4">23842</Scale>
<Scale zlevel="18" sc="3">11921</Scale>
<Scale zlevel="19" sc="2">5960</Scale>
<Scale zlevel="20" sc="1">2980</Scale>
</Scales>
<Scales mode="hd-mobile">
<Scale zlevel="1" sc="20">1562498438</Scale>
<Scale zlevel="2" sc="19">781249219</Scale>
<Scale zlevel="3" sc="18">390624609</Scale>
<Scale zlevel="4" sc="17">195312305</Scale>
<Scale zlevel="5" sc="16">97656152</Scale>
<Scale zlevel="6" sc="15">48828076</Scale>
<Scale zlevel="7" sc="14">24414038</Scale>
<Scale zlevel="8" sc="13">12207019</Scale>
<Scale zlevel="9" sc="12">6103510</Scale>
<Scale zlevel="10" sc="11">3051755</Scale>
<Scale zlevel="11" sc="10">1525877</Scale>
<Scale zlevel="12" sc="9">762939</Scale>
<Scale zlevel="13" sc="8">381469</Scale>
<Scale zlevel="14" sc="7">190735</Scale>
<Scale zlevel="15" sc="6">95367</Scale>
<Scale zlevel="16" sc="5">47684</Scale>
<Scale zlevel="17" sc="4">23842</Scale>
<Scale zlevel="18" sc="3">11921</Scale>
<Scale zlevel="19" sc="2">5960</Scale>
<Scale zlevel="20" sc="1">2980</Scale>
</Scales>
<Scales mode="loco">
<Scale zlevel="1" sc="20">1562498438</Scale>
<Scale zlevel="2" sc="19">781249219</Scale>
<Scale zlevel="3" sc="18">390624609</Scale>
<Scale zlevel="4" sc="17">195312305</Scale>
<Scale zlevel="5" sc="16">97656152</Scale>
<Scale zlevel="6" sc="15">48828076</Scale>
<Scale zlevel="7" sc="14">24414038</Scale>
<Scale zlevel="8" sc="13">12207019</Scale>
<Scale zlevel="9" sc="12">6103510</Scale>
<Scale zlevel="10" sc="11">3051755</Scale>
<Scale zlevel="11" sc="10">1525877</Scale>
<Scale zlevel="12" sc="9">762939</Scale>
<Scale zlevel="13" sc="8">381469</Scale>
<Scale zlevel="14" sc="7">190735</Scale>
<Scale zlevel="15" sc="6">95367</Scale>
<Scale zlevel="16" sc="5">47684</Scale>
<Scale zlevel="17" sc="4">23842</Scale>
<Scale zlevel="18" sc="3">11921</Scale>
<Scale zlevel="19" sc="2">5960</Scale>
<Scale zlevel="20" sc="1">2980</Scale>
</Scales>
<Positions/>
<Copyright>(C)Yahoo Japan,(C)ZENRIN</Copyright>
</Result>
</ResultSet>
Recommended Posts