This patch will insert an interactive google map above the latitude, longitude interface that allows one to select the latitude longitude by clicking on the map. This gmap.module, if gmap.module is installed (if not, it does nothing). Note the most recent cvs version of gmap.module is required in order to do this.

Comments

drob’s picture

What is the thinking here? I can see a lot of situations where one would *not* want to have users interactively setting their lat/long - rather it would be tied to the address. I would want the flexibility of making that choice. Any chance that we could get that flexibility in different modules?

webgeer’s picture

You would not be required to set your lat,long interactively. How it works, is above the lat,long text fields, if you have the gmap module, you would see a google map. If the lat, long has been set then it will have a marker at the lat long location. If you click on the map, it moves the marker to that location, and enters that value into the lat, long fields (and zooms the map in so that you can enter a more precise location on the zoomed in map). The ability for the user to enter the lat, long is not something I added, it is already in the location.module. I just made it easy to find out the right lat, long.

Most of the world is not covered by location.module geocoding, and most people don't know the lat, long of a specific location. This provides a very easy to use method of entering the lat and long of a location. Having the lat, long entered can be extremely useful for a number of different applications.

It would be very easy to make it so that the use of this can be a setting. I will change this patch so that this functionality can be disabled.

Zack Rosen’s picture

Manually setting latitude and longitude via the location module needs to be able to be disabled. Many (or most) people using this module do not want their users to see these options.

Weebgeer, will you be rolling a patch to fix this problem as well? Or should I work on it?

webgeer’s picture

StatusFileSize
new1.16 KB

This is a little improvement. To answer concern, this functionality can now be turned off with a gmap.module setting. This could easily be changed to a location.module setting if that is a better approach.

Zack Rosen’s picture

Excellent. I think it would make more sense to be able to globally disable long/lat forms in the location module. Want to roll a patch?

webgeer’s picture

Just one comment on this issue. This patch/feature request has nothing to do with the ability of users to enter longitude and latitude information. This functionality was already included in the location.module.

This just provides an easy interactive interface to set the latitude and longitude using a google map. It just provides some javascript that draws a map and fills the existing latitute/longitude fields.

Personally I like having the ability to set the latitude and longitude. Having the latitude and longitude is extremely useful for pruposes of mapping, or finding the straight line distance or proximity. Relying on geocoding is very problematic. (Most of the world does not have geocoding for it available. Personally I haven't been able to get it to work for the US for me -- Although I haven't spent that much time on it as I'm not in the US and therefore it isn't that useful for me.)

Zack Rosen’s picture

Ok. I will roll a patch then that will allow users to disable long/lat globally inside location module.

Zack Rosen’s picture

webgeer’s picture

StatusFileSize
new1.12 KB

So here is a revised patch for location.inc using location.module settings.

The patch for location.module will be uploaded attached to a separate comment.

One other note I should probably make, is that using the interactive map will still allow manually entering the lat/long if you have it. When you manually enter a lat/long it will move/add a marker for the manually entered location.

webgeer’s picture

StatusFileSize
new1.21 KB

OK perhaps I misunderstood what Zacker said. I made it a location.module setting to disable the interactive gmap. Personally, it doesn't matter to me whether this is a gmap setting, a location setting or it just always uses it for lat/long entries if you have both location and gmap modules installed.

Zack Rosen’s picture

My .02: Make this a location module setting that only shows up if the gmaps module is installed. It would be nice if it were also aware of the new setting I rolled a patch for that allows admins to disable/enable the long/lat forms.

webgeer’s picture

I thought of making it only show up if gmap.module is installed, but I think that letting people know about the functionality as being available from gmap is a good idea. It doesn't really cause any problems by having that setting there. I think it is pretty clear that you need to install gmap to use it.

I also think that it eliminates the problem of people installing location.module going through the settings of that, and then aftwards installing gmap.module and going through the settings of that, and therefore not seeing this setting.

Zack Rosen’s picture

This should be handled the same way the CiviCRM specific options are, only show this option if the GMap module is avaliable. You can do some fancy stuff though like auto-enabling it if the Gmap module is installed at a later time. If you advertise this functionality in the GMap module I don't think there will be any usability concerns.

ankur’s picture

Status: Needs review » Fixed
StatusFileSize
new3.91 KB

Committed to HEAD.

Thank you, webgeer, for your patches. I messed around with them a little before committing, however. The form of the final patch is that of the attachment here.

-Ankur

Anonymous’s picture

Status: Fixed » Closed (fixed)
moshe weitzman’s picture

Title: Allow integration with gmap.module to set a latitude, longitude for a location » Bad integration of user locations with gmap
Version: » 6.x-3.x-dev
Status: Closed (fixed) » Active

I just installed both of these modules on http://groupsbeta.groups.org. I am seeing a Location fieldset on the main edit page and then a google map on a new location map page. Further, when submitting a map it wipes out address info given in Location fieldset. Am I missing something? I'd like to get these working wel and then i'll add some organic groups integration and we'll be flying on groups.drupal.org.

thanks.

moshe weitzman’s picture

I should add that the straightforward fix is Gmap to show up alongside the Location fieldset so they submit in one form, thus avoiding the data loss issue

moshe weitzman’s picture

Also, it looks to me that the map info is being discarded when submitting a node because on the subsequent node view I see only 'United States' as Location. Please try adding an event at http://groupsbeta.drupal.org

webgeer’s picture

Title: Bad integration of user locations with gmap » Bad integration of user locations with gmap (User settings only)

The user location integration problem is a known problem and is a gmap problem not a location.module problem. The workaround is to not use the location.module for users and set user locations with the gmap.module. (This can be achieved by disabling user locations in the /admin/settings/location page.)

It should be noted that the patch added as part of this feature request not the source of the problem and is totatally unrelated to it. When this feature request: http://drupal.org/node/58795 is done then the setting of location of users in the gmap module can be deleted and all of the incompatibilities will be addressed.

I don't think the "straightforward fix" you suggested would work. However, I haven't tried it. If you try it and it works please submit it as a patch to the gmap.module.

Regarding your last comments Moshe, the location information that is shown below the node does not include the lat/long ever. The map information for nodes most definitely is not discarded. If you edit the node again the information will be there (the map will have zoomed back out, but the marker will be at the location and if you zoom in you will see it is exactly where it was set)

It is important to understand that how this actually works is the lat/long forms are those that have always been in location.module. This just adds an interactive map and some other javascript that will update the lat/long form elements when you work on the map. The underlying form is the same form that location.module has always used for lat/long entry, and therefore is treated exactly the same from the perspective of validating and saving the information.

moshe weitzman’s picture

Title: Bad integration of user locations with gmap (User settings only) » integration of user locations with gmap

thanks for the info, james. very interesting.

nice that the map info is not discarded. i got that impression because i saw no map on the view for the node, and i did see other location info. so lets add the map when viewing a node if gmap is enabled and we have sufficient info to build a map.

thanks for your great modules.

webgeer’s picture

Personally I'm a little reluctant to be adding too much gmap specific stuff to location.module. This integration only adds a few lines of code and is quite transparent to the operation of the location.module.

Adding a map to the location block below the map adds quite a bit more code and has a lot more issues that need to be addressed. I have thought of a couple of other possible ways of showing the location for a node. These will probably be integrated into a new module that will be packaged with the gmap.module called gmap_location.module. The existing plotting users on a map will be moved to this new module and new function for plotting the nodes on a map will be provided.

I have been also thinking about adding a block that would show the location of the current node from the location module. (This is quite trivial to do and I know this hase been done before), another possibility would be to add the map linking to have a "googlemap on my site" which would then go to a page with a google map showing a marker for the current node's location.

moshe weitzman’s picture

I don't think any gmap code has to be added to location module. here is some pseudocode

function gmap_nodeapi() {
if ($op == 'view') {
if (node has location data in it) {
$node->body .= gmap_render_map($node);
}
}
}

catch’s picture

Status: Active » Closed (duplicate)

http://drupal.org/node/125001 - this issue's older, but that one has a patch.

onzenet’s picture

Node Locations works perfectly, too perfectly for me ... I need Node location for a content (working right!) but i can't get rid of a 'Location' ('Emplacement' (fr) ) on user registration (except by disabling the 'Node Locations' module :( . Please, any tip or suggestion is warmly welcome ...

onzenet’s picture

Drupal v6.13
Location Nodes v6.x-3.1-rc1

Node Locations works perfectly, too perfectly for me ... I need Node location for a content (working right!) but i can't get rid of a 'Location form' ('Emplacement' in french , with address , country ...etc.. fields) on user registration (except by disabling the 'Node Locations' module :( . Please, any tip or suggestion is warmly welcome ...