开发者

Is there a way to generate the co-ordinates of a location based on the address?

开发者 https://www.devze.com 2023-01-26 02:43 出处:网络
I have a node called Dealer that has the following CCK fields; Title Body Location (of type Location) Phone (of type text)

I have a node called Dealer that has the following CCK fields;

Title

Body

Location (of type Location)

Phone (of type text)

Website ( of type text)

Divsion (Node Refrence)

Is there a way to display the location of the node on a gmap, based on the inputted location? I'll be importing around 1000 nodes, and don't have the co-ordinates for any of these, but only have the addres开发者_运维知识库s of each.


What you are looking for is two features: geocoding of Location data and a (Google) map display of the result. Usually Geocoding is done at node creation time, or using some kind of cron job. While map display is done on node view (teaser, full page, views, etc.).

Both features should be provided by the Gmap project's modules. The OpenLayers and OpenLayers Geocoder projects should also provide them. Finally the Google Map Tools may be a third alternative.

All projects provide some kind of Views integration that allow you to build map(s) for your nodes using familiar tools.

For geocoding (and storage) of the coordinates, there is also the Geo and Geocode projects. But it seems Geocode doesn't support Location fields.


You can use the following two modules.

http://drupal.org/project/openlayers

drupal.org/project/openlayers_geocoder

It can geocode your address and you can use google maps to show it. Not sure if this combination of modules will work with programatically created nodes but it is a start.


I implemented geocoding using the location (drupal.org/project/location) and gmap (drupal.org/project/gmap) modules. You need "node location" and "location search" submodules activated, and set up your geocoding options in admin/settings/location/geocoding , offering a way to bulk geocode the existing Dealers too.

You won't need the Location CCK field, just use the setup provided by "node location" (edit your Dealer content type).

0

精彩评论

暂无评论...
验证码 换一张
取 消