使用Skobbler多步搜索

时间:2015-12-01 08:46:25

标签: android geocoding openstreetmap skmaps

我在正确编程多步搜索时遇到问题,如"How to" for the Android SDK - Offline geocoding所述。从一个国家/地区到另一个国家/地区逐步搜索我收到了List SKSearchResult。在每个结果中,每个级别都有一个parentList。但在房屋数量级别(SK_LIST_LEVEL_HOUSENUMBER),有些东西是腐败的。所有的父母都在这个级别上迷失了。

在国家/地区级别搜索“德国”会显示以下结果:

SKSearchResult [id=11711160340447248, type=COUNTRY, name=Deutschland, parentsList=[], category=SKPOI_CATEGORY_UNKNOWN, mainCategory=null, location=[10.423439979553223,51.08341979980469], offlinePackageCode=DE]

在城市级别搜索“柏林”会显示以下结果:

SKSearchResult [id=80911995709853584, type=CITY, name=Berlin, parentsList=[SKSearchResultParent [parentIndex=1074716573, parentType=COUNTRY, parentName=Deutschland]], category=SKPOI_CATEGORY_UNKNOWN, mainCategory=null, location=[13.3888578414917,52.51703643798828], offlinePackageCode=DE]
SKSearchResult [id=15911939014706960, type=CITY, name=Bernau bei Berlin, parentsList=[SKSearchResultParent [parentIndex=1074716573, parentType=STATE, parentName=Brandenburg], SKSearchResultParent [parentIndex=1074716573, parentType=COUNTRY, parentName=Deutschland]], category=SKPOI_CATEGORY_UNKNOWN, mainCategory=null, location=[13.588103294372559,52.67873001098633], offlinePackageCode=DE]
SKSearchResult [id=19123745631193744, type=CITY, name=Neuenhagen bei Berlin, parentsList=[SKSearchResultParent [parentIndex=1074716573, parentType=STATE, parentName=Brandenburg], SKSearchResultParent [parentIndex=1074716573, parentType=COUNTRY, parentName=Deutschland]], category=SKPOI_CATEGORY_UNKNOWN, mainCategory=null, location=[13.688921928405762,52.52616882324219], offlinePackageCode=DE]

在街道上搜索“Unter den Linden”,并将“Berlin”的ID作为parentID显示以下结果:

SKSearchResult [id=179887248, type=STREET, name=Unter den Linden, parentsList=[SKSearchResultParent [parentIndex=1628087140, parentType=CITY_SECTOR, parentName=Mitte], SKSearchResultParent [parentIndex=1628087140, parentType=CITY, parentName=Berlin], SKSearchResultParent [parentIndex=1628087140, parentType=COUNTRY, parentName=Deutschland]], category=SKPOI_CATEGORY_UNKNOWN, mainCategory=null, location=[13.393696784973145,52.51726531982422], offlinePackageCode=DE]
SKSearchResult [id=179153424, type=STREET, name=Unter den Rüstern, parentsList=[SKSearchResultParent [parentIndex=1728731020, parentType=CITY_SECTOR, parentName=Steglitz], SKSearchResultParent [parentIndex=1728731020, parentType=CITY, parentName=Berlin], SKSearchResultParent [parentIndex=1728731020, parentType=COUNTRY, parentName=Deutschland]], category=SKPOI_CATEGORY_UNKNOWN, mainCategory=null, location=[13.339591026306152,52.44643020629883], offlinePackageCode=DE]
SKSearchResult [id=179089296, type=STREET, name=Unter den Eichen, parentsList=[SKSearchResultParent [parentIndex=1728731020, parentType=CITY, parentName=Erkner], SKSearchResultParent [parentIndex=1728731020, parentType=STATE, parentName=Brandenburg], SKSearchResultParent [parentIndex=1728731020, parentType=COUNTRY, parentName=Deutschland]], category=SKPOI_CATEGORY_UNKNOWN, mainCategory=null, location=[13.75512981414795,52.43838119506836], offlinePackageCode=DE]

在内容级别上搜索“2”,将“Unter den Linden”的ID作为parentID显示以下结果:

SKSearchResult [id=0, type=POINT, name=2, parentsList=[], category=SKPOI_CATEGORY_UNKNOWN, mainCategory=null, location=[13.397054672241211,52.51759719848633], offlinePackageCode=DE]
SKSearchResult [id=0, type=POINT, name=21, parentsList=[], category=SKPOI_CATEGORY_UNKNOWN, mainCategory=null, location=[13.393257141113281,52.51721954345703], offlinePackageCode=DE]
SKSearchResult [id=0, type=POINT, name=23, parentsList=[], category=SKPOI_CATEGORY_UNKNOWN, mainCategory=null, location=[13.392806053161621,52.517127990722656], offlinePackageCode=DE]

正如您在最后一级(housenumber)所看到的,只找到POINT类型的结果。没有HOUSE_NUMBER类型的结果。此外,信息会丢失,因为在最后的结果中有一个空的parentList=[]

这可能是Skobbler SDK中的一个错误吗?或者我可能滥用SDK?

1 个答案:

答案 0 :(得分:0)

我发现为地理编码搜索实现外部源要容易得多。 Nominatim是一个开源地理编码引擎,允许与Skobbler集成和在线搜索。 http://wiki.openstreetmap.org/wiki/Nominatim

可以在此处找到API:https://github.com/jeremiehuchet/nominatim-java-api