Drupal 6位置模块使用邮政编码获取城市名称

发布于 2024-10-18 08:35:11 字数 166 浏览 2 评论 0原文

我正在使用位置模块并启用位置 CCK 字段。在创建内容时,我只是收集邮政编码和国家/地区。我想使用与节点关联的邮政编码显示城市名称。

我知道位置模块附带邮政编码数据库。是否需要查询此邮政编码数据库才能获取城市名称?如果该邮政编码不可用,那么有什么解决方案呢?

请指导我如何实现这一目标?

I am using Location module and enabled Location CCK field. While creating content I am just collecting zip/postal code and country. I want to display the City name using the zip/postal code associated with node.

I know Location module comes with zip code database. Is there need to query this zip/postal code database to get City name? If that zip/postal code is not available then what could be solution?

Please guide me how could I achieve this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

星軌x 2024-10-25 08:35:11

部分已解决。这可能对其他人有帮助。
您可以通过位置模块中可用的功能获取邮政编码信息,即
location_get_postalcode_data 接受位置参数作为数组

@param $location
 *   Array. the location data
 *   -> the values are:
 *     'street'         => the string representing the street location (REQUIRED)
 *     'additional'     => the string representing the additional street location portion in the location form
 *     'city'           => the city name (REQUIRED)
 *     'province'       => the province code defined in the country-specific include file
 *     'country'        => the lower-case of the two-letter ISO code (REQUIRED)
 *     'postal_code'    => the postal-code (REQUIRED)

另外,我对支持目录中可用的国家/地区特定 .inc 文件进行了一些修改,以获取额外信息以及默认经纬度信息。

但如果数据库中没有邮政编码,则第二部分正在等待处理。

Part of it has been resolved. This could be helpful for others.
You can get zip/postal code information by the function available in the location module i.e.
location_get_postalcode_data which accept Location parameter as array

@param $location
 *   Array. the location data
 *   -> the values are:
 *     'street'         => the string representing the street location (REQUIRED)
 *     'additional'     => the string representing the additional street location portion in the location form
 *     'city'           => the city name (REQUIRED)
 *     'province'       => the province code defined in the country-specific include file
 *     'country'        => the lower-case of the two-letter ISO code (REQUIRED)
 *     'postal_code'    => the postal-code (REQUIRED)

Also I did some modification in my country specific .inc file available in supported directory to fetch extra information along with default lat-lon info.

But second part if zip/postal code not available in database then is pending.

弥繁 2024-10-25 08:35:11
public function 
{
    $null='';
    #   REFERENCE SITE URL = http://developer.yahoo.com/maps/rest/V1/geocode.html


    #   get and output "<Result>" elements
    $result=$xmlDoc->getElementsByTagName('Result');
    foreach ($result as $val)
    {
        return $null;
    }
}
public function 
{
    $null='';
    #   REFERENCE SITE URL = http://developer.yahoo.com/maps/rest/V1/geocode.html


    #   get and output "<Result>" elements
    $result=$xmlDoc->getElementsByTagName('Result');
    foreach ($result as $val)
    {
        return $null;
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文