Mapbox - 从自动完成结果中获取区域
Mapbox - Get region from autocomplete result
如何从自动完成的选定结果中获取区域?
从我得到的结果来看,有第三个对象名为区域,但实际上它是部门而不是区域。
示例地址如下:
54b route de brie, 91800 Brunoy, France
Mapbox 给我:Essonne // Its department not region
但实际上是:法兰西岛
如何获得正确的区域?
这是我的工作演示:
不包括该信息。但是,如果您只需要在法国使用您的网站,那么使用 short_code
的最后两个字符包含从省到地区的查找 table 映射会很简单。这是一个:https://gist.github.com/SiamKreative/f1074ed95507e69d08a0
"regions": {
"alsace": [67, 68],
"aquitaine": [40, 47, 33, 24, 64],
"auvergne": [43, 3, 15, 63],
"basse-normandie": [14, 61, 50],
"bourgogne": [21, 58, 71, 89],
"bretagne": [29, 35, 22, 56],
"centre": [45, 37, 41, 28, 36, 18],
"champagne-ardenne": [10, 8, 52, 51],
"corse": ["2b", "2a"],
"franche-compte": [39, 25, 70, 90],
"haute-normandie": [27, 76],
"languedoc-roussillon": [48, 30, 34, 11, 66],
"limousin": [19, 23, 87],
"lorraine": [55, 54, 57, 88],
"midi-pyrennees": [46, 32, 31, 12, 9, 65, 81, 82],
"nord-pas-de-calais": [62, 59],
"pays-de-la-loire": [49, 44, 72, 53, 85],
"picardie": [2, 60, 80],
"poitou-charentes": [17, 16, 86, 79],
"provences-alpes-cote-dazur": [4, 5, 6, 13, 84, 83],
"rhones-alpes": [38, 42, 26, 7, 1, 74, 73, 69],
"ile-de-france": [77, 75, 78, 93, 92, 91, 95, 94]
},
如何从自动完成的选定结果中获取区域?
从我得到的结果来看,有第三个对象名为区域,但实际上它是部门而不是区域。
示例地址如下:
54b route de brie, 91800 Brunoy, France
Mapbox 给我:Essonne // Its department not region
但实际上是:法兰西岛
如何获得正确的区域?
这是我的工作演示:
不包括该信息。但是,如果您只需要在法国使用您的网站,那么使用 short_code
的最后两个字符包含从省到地区的查找 table 映射会很简单。这是一个:https://gist.github.com/SiamKreative/f1074ed95507e69d08a0
"regions": {
"alsace": [67, 68],
"aquitaine": [40, 47, 33, 24, 64],
"auvergne": [43, 3, 15, 63],
"basse-normandie": [14, 61, 50],
"bourgogne": [21, 58, 71, 89],
"bretagne": [29, 35, 22, 56],
"centre": [45, 37, 41, 28, 36, 18],
"champagne-ardenne": [10, 8, 52, 51],
"corse": ["2b", "2a"],
"franche-compte": [39, 25, 70, 90],
"haute-normandie": [27, 76],
"languedoc-roussillon": [48, 30, 34, 11, 66],
"limousin": [19, 23, 87],
"lorraine": [55, 54, 57, 88],
"midi-pyrennees": [46, 32, 31, 12, 9, 65, 81, 82],
"nord-pas-de-calais": [62, 59],
"pays-de-la-loire": [49, 44, 72, 53, 85],
"picardie": [2, 60, 80],
"poitou-charentes": [17, 16, 86, 79],
"provences-alpes-cote-dazur": [4, 5, 6, 13, 84, 83],
"rhones-alpes": [38, 42, 26, 7, 1, 74, 73, 69],
"ile-de-france": [77, 75, 78, 93, 92, 91, 95, 94]
},