我经常使用
Bing Maps Rest APIs。您可以使用以下请求进行地理编码:
http://dev.virtualearth.net/REST/v1/Locations/CA/adminDistrict/postalCode/locality/addressLine?includeNeighborhood=includeNeighborhood&key=BingMapsKey
你可以在我写的关于响应式扩展的
CodeProject文章中看到它的使用。
例如,你的地址:
http://dev.virtualearth.net/REST/v1/Locations/US/1125%20E.%20102nd%20Street,%20Los%20Angeles,%20CA?key=Ai9-KNy6Al-r_ueyLuLXFYB_GlPl-c-_iYtu16byW86qBx9uGbsdJpwvrP4ZUdgD
给出以下响应:
{
"authenticationResultCode":"ValidCredentials",
"brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png",
"copyright":"Copyright © 2012 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.",
"resourceSets":[
{
"estimatedTotal":1,
"resources":[
{
"__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1",
"bbox":[
33.940492293415652,
-118.26180800227225,
33.948217728557005,
-118.24939194889963
],
"name":"1125 E 102ND St, Los Angeles, CA 90002",
"point":{
"type":"Point",
"coordinates":[
33.944355010986328,
-118.25559997558594
]
},
"address":{
"addressLine":"1125 E 102ND St",
"adminDistrict":"CA",
"adminDistrict2":"Los Angeles Co.",
"countryRegion":"United States",
"formattedAddress":"1125 E 102ND St, Los Angeles, CA 90002",
"locality":"Los Angeles",
"postalCode":"90002"
},
"confidence":"High",
"entityType":"Address",
"geocodePoints":[
{
"type":"Point",
"coordinates":[
33.944355010986328,
-118.25559997558594
],
"calculationMethod":"Parcel",
"usageTypes":[
"Display"
]
},
{
"type":"Point",
"coordinates":[
33.944118499755859,
-118.25559997558594
],
"calculationMethod":"Interpolation",
"usageTypes":[
"Route"
]
}
],
"matchCodes":[
"Good"
]
}
]
}
],
"statusCode":200,
"statusDescription":"OK",
"traceId":"81518ba504a3494bb0b62bdb6aa4b291|LTSM002104|02.00.83.500|LTSMSNVM001473, LTSMSNVM001463, LTSMSNVM001452, LTSMSNVM001851, LTSMSNVM001458, LTSMSNVM001462"
}
或者...对于XML数据,添加
o=xml
:
http://dev.virtualearth.net/REST/v1/Locations/US/1125%20E.%20102nd%20Street,%20Los%20Angeles,%20CA?o=xml&key=Ai9-KNy6Al-r_ueyLuLXFYB_GlPl-c-_iYtu16byW86qBx9uGbsdJpwvrP4ZUdgD
这将给出:
<Response>
<Copyright>Copyright ? 2012 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.</Copyright>
<BrandLogoUri>http:
<StatusCode>200</StatusCode>
<StatusDescription>OK</StatusDescription>
<AuthenticationResultCode>ValidCredentials</AuthenticationResultCode>
<TraceId>b9af8a6b058b455ca9c368b9e32142fe|LTSM002102|02.00.83.500|LTSMSNVM002001, LTSMSNVM001464, LTSMSNVM001451, LTSMSNVM001452, LTSMSNVM001457, LTSMSNVM002052, LTSMSNVM001461</TraceId>
<ResourceSets>
<ResourceSet>
<EstimatedTotal>1</EstimatedTotal>
<Resources>
<Location>
<Name>1125 E 102ND St, Los Angeles, CA 90002</Name>
<Point>
<Latitude>33.944355010986328</Latitude>
<Longitude>-118.25559997558594</Longitude>
</Point>
<BoundingBox>
<SouthLatitude>33.940492293415652</SouthLatitude>
<WestLongitude>-118.26180800227225</WestLongitude>
<NorthLatitude>33.948217728557005</NorthLatitude>
<EastLongitude>-118.24939194889963</EastLongitude>
</BoundingBox>
<EntityType>Address</EntityType>
<Address>
<AddressLine>1125 E 102ND St</AddressLine>
<AdminDistrict>CA</AdminDistrict>
<AdminDistrict2>Los Angeles Co.</AdminDistrict2>
<CountryRegion>United States</CountryRegion>
<FormattedAddress>1125 E 102ND St, Los Angeles, CA 90002</FormattedAddress>
<Locality>Los Angeles</Locality>
<PostalCode>90002</PostalCode>
</Address>
<Confidence>High</Confidence>
<MatchCode>Good</MatchCode>
<GeocodePoint>
<Latitude>33.944355010986328</Latitude>
<Longitude>-118.25559997558594</Longitude>
<CalculationMethod>Parcel</CalculationMethod>
<UsageType>Display</UsageType>
</GeocodePoint>
<GeocodePoint>
<Latitude>33.944118499755859</Latitude>
<Longitude>-118.25559997558594</Longitude>
<CalculationMethod>Interpolation</CalculationMethod>
<UsageType>Route</UsageType>
</GeocodePoint>
</Location>
</Resources>
</ResourceSet>
</ResourceSets>
</Response>
因此,您提供的地址的纬度/经度为(33.9,-118.2)