目前正在尝试通过IP从SQL-Server数据源添加用户地图。 IP要么映射到错误的位置,要么根本不使用Power BI的内置查找进行映射。
有没有办法通过IP列查询位置?或者任何已知的API为我这样做?
答案 0 :(得分:1)
试试这个:freegeoip.net
http://freegeoip.net/xml/8.8.8.8
它返回:
<Response>
<IP>8.8.8.8</IP>
<CountryCode>US</CountryCode>
<CountryName>United States</CountryName>
<RegionCode>CA</RegionCode>
<RegionName>California</RegionName>
<City>Mountain View</City>
<ZipCode>94035</ZipCode>
<TimeZone>America/Los_Angeles</TimeZone>
<Latitude>37.386</Latitude>
<Longitude>-122.0838</Longitude>
<MetroCode>807</MetroCode>
</Response>
或使用JSON:
http://freegeoip.net/json/8.8.8.8
{"ip":"8.8.8.8","country_code":"US","country_name":"United States","region_code":"CA","region_name":"California","city":"Mountain View","zip_code":"94035","time_zone":"America/Los_Angeles","latitude":37.386,"longitude":-122.0838,"metro_code":807}
答案 1 :(得分:1)
我遇到了类似的问题,这就是我所做的。
-- 对我有用的函数代码是
= let
Source = (#"IP Address" as text) => let
Source = Json.Document(Web.Contents("http://freegeoip.net/json/" & #"IP Address")),
#"Converted to Table" = Record.ToTable(Source),
#"Transposed Table" = Table.Transpose(#"Converted to Table"),
#"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table")
in
#"Promoted Headers"
in
Source