我使用Geocoder获取某些坐标的地址。它在Address对象中给出结果地址,我尝试研究Address对象,以便我可以重新排列用户显示的各种属性(例如Premises,area,landmark,locality,sublocality,city,state)。
我认为Geocoder对象以前有点不同,并且有很多地址线,但是目前它只有一个,所有逗号分隔的短语都不符合下面提供的身体其他部分。
以下JSON结构供参考:
1> Delhi Address: [
{
"mAddressLines": {
"0": "E46, Lodhi Colony, Sector 3G, Rohini, Delhi, 110085, India"
},
"mAdminArea": "Delhi",
"mCountryCode": "IN",
"mCountryName": "India",
"mFeatureName": "E46",
"mHasLatitude": true,
"mHasLongitude": true,
"mLatitude": 28.703985300000003,
"mLocale": "en_US",
"mLocality": "Delhi",
"mLongitude": 77.1024425,
"mMaxAddressLineIndex": 0,
"mPostalCode": "110085",
"mPremises": "E46",
"mSubAdminArea": "North West Delhi",
"mSubLocality": "Rohini"
}
]
2> Delhi Address: [
{
"mAddressLines": {
"0": "684, Pocket 7, Sector 2, Rohini, Delhi, 110085, India"
},
"mAdminArea": "Delhi",
"mCountryCode": "IN",
"mCountryName": "India",
"mFeatureName": "684",
"mHasLatitude": true,
"mHasLongitude": true,
"mLatitude": 28.700565400000002,
"mLocale": "en_US",
"mLocality": "Delhi",
"mLongitude": 77.0993105,
"mMaxAddressLineIndex": 0,
"mPostalCode": "110085",
"mPremises": "684",
"mSubAdminArea": "North West Delhi",
"mSubLocality": "Rohini"
},
{
"mAddressLines": {
"0": "Himalaya Apartment, Guru Gowalkar Marg, Pocket 00, Sector 2, Rohini, Delhi, 110085, India"
},
"mAdminArea": "Delhi",
"mCountryCode": "IN",
"mCountryName": "India",
"mFeatureName": "Himalaya Apartment",
"mHasLatitude": true,
"mHasLongitude": true,
"mLatitude": 28.7004086,
"mLocale": "en_US",
"mLocality": "Delhi",
"mLongitude": 77.09895829999999,
"mMaxAddressLineIndex": 0,
"mPostalCode": "110085",
"mPremises": "Himalaya Apartment",
"mSubAdminArea": "New Delhi",
"mSubLocality": "Rohini",
"mThoroughfare": "Guru Gowalkar Marg"
}
]
3> Hyderabad Address: [
{
"mAddressLines": {
"0": "Rinda Legend Capital Mall, Main Rd, Subhash Nagar, Badi Chowdi, Koti, Hyderabad, Telangana 500095, India"
},
"mAdminArea": "Telangana",
"mCountryCode": "IN",
"mCountryName": "India",
"mFeatureName": "Rinda Legend Capital Mall",
"mHasLatitude": true,
"mHasLongitude": true,
"mLatitude": 17.3852123,
"mLocale": "en_US",
"mLocality": "Hyderabad",
"mLongitude": 78.48660459999999,
"mMaxAddressLineIndex": 0,
"mPostalCode": "500095",
"mPremises": "Rinda Legend Capital Mall",
"mSubAdminArea": "Ranga Reddy",
"mSubLocality": "Koti",
"mThoroughfare": "Main Road"
},
{
"mAddressLines": {
"0": "5-1-314, Main Rd, Subhash Nagar, Badi Chowdi, Koti, Hyderabad, Telangana 500095, India"
},
"mAdminArea": "Telangana",
"mCountryCode": "IN",
"mCountryName": "India",
"mFeatureName": "5-1-314",
"mHasLatitude": true,
"mHasLongitude": true,
"mLatitude": 17.3852895,
"mLocale": "en_US",
"mLocality": "Hyderabad",
"mLongitude": 78.4865963,
"mMaxAddressLineIndex": 0,
"mPostalCode": "500095",
"mSubAdminArea": "Hyderabad",
"mSubLocality": "Koti",
"mSubThoroughfare": "5-1-314",
"mThoroughfare": "Main Road"
},
{
"mAddressLines": {
"0": "Omnitech InfoSolutions, 1st Floor, Bulding No 17, Main Rd, Goutam Nagar, Badi Chowdi, Kachiguda, Hyderabad, Telangana 501301, India"
},
"mAdminArea": "Telangana",
"mCountryCode": "IN",
"mCountryName": "India",
"mFeatureName": "Omnitech InfoSolutions",
"mHasLatitude": true,
"mHasLongitude": true,
"mLatitude": 17.385044,
"mLocale": "en_US",
"mLocality": "Hyderabad",
"mLongitude": 78.486671,
"mMaxAddressLineIndex": 0,
"mPostalCode": "501301",
"mPremises": "Omnitech InfoSolutions",
"mSubAdminArea": "Ranga Reddy",
"mSubLocality": "Kachiguda",
"mSubThoroughfare": "1st Floor, Bulding No 17",
"mThoroughfare": "Main Road"
},
{
"mAddressLines": {
"0": "Mobile Tower, Main Rd, Goutam Nagar, Badi Chowdi, Kachiguda, Hyderabad, Telangana 500095, India"
},
"mAdminArea": "Telangana",
"mCountryCode": "IN",
"mCountryName": "India",
"mFeatureName": "Mobile Tower",
"mHasLatitude": true,
"mHasLongitude": true,
"mLatitude": 17.385044,
"mLocale": "en_US",
"mLocality": "Hyderabad",
"mLongitude": 78.486671,
"mMaxAddressLineIndex": 0,
"mPostalCode": "500095",
"mPremises": "Mobile Tower",
"mSubAdminArea": "Ranga Reddy",
"mSubLocality": "Kachiguda",
"mThoroughfare": "Main Road"
},
{
"mAddressLines": {
"0": "Saini Industries, 1-47/2, Fateh Nagar, Fateh Nagar, Gandhi Nagar, Badi Chowdi, Kachiguda, Hyderabad, Telangana 500018, India"
},
"mAdminArea": "Telangana",
"mCountryCode": "IN",
"mCountryName": "India",
"mFeatureName": "Saini Industries",
"mHasLatitude": true,
"mHasLongitude": true,
"mLatitude": 17.385047399999998,
"mLocale": "en_US",
"mLocality": "Hyderabad",
"mLongitude": 78.4866596,
"mMaxAddressLineIndex": 0,
"mPostalCode": "500018",
"mPremises": "Saini Industries",
"mSubAdminArea": "Hyderabad",
"mSubLocality": "Kachiguda"
}
]
任何人都可以提供一些有关mAddressLine与身体其他部分不匹配的信息吗?
修改 我怀疑的是例如第一个AddressLine是:
"E46, Lodhi Colony, Sector 3G, Rohini, Delhi, 110085, India"
但身体的其他部分:
"mAdminArea": "Delhi",
"mCountryCode": "IN",
"mCountryName": "India",
"mFeatureName": "E46",
"mHasLatitude": true,
"mHasLongitude": true,
"mLatitude": 28.703985300000003,
"mLocale": "en_US",
"mLocality": "Delhi",
"mLongitude": 77.1024425,
"mMaxAddressLineIndex": 0,
"mPostalCode": "110085",
"mPremises": "E46",
"mSubAdminArea": "North West Delhi",
"mSubLocality": "Rohini"
没有Lodhi Colony'或者' Sector 3G'那是什么?相反,Locality显示为'德里',它不是一个地方,它是整个城市。
答案 0 :(得分:-1)
在Java中,有一个用于反序列化Geocoder响应的内置结构
List<android.location.Address> addresses =
geocoder.getFromLocationName("your-address",1);