2

I am building a site where people can log power failures in their area on a google map in Drupal 7.

I want to be able to have my site users register their location on their profile. This seems pretty straightforward to do using the Profile 2 and Location modules, however it's the next step that I'm hung up on.

I want the user to be able to click an "add a power failure" button, fill in the details of the failure (time, date etc) and hit save. Once this is done, I want to be able to plot a point on the map (using views or whatever) with the location details they entered in their profile when they signed up.

I've been trying to play with User reference and node reference in the power failure content type, but this doesn't really give me what I want.

Does anybody have any ideas on how I can accomplish this?

Thanks!

G

3 Answers 3

1

For the location to be displayed on the google map,You need to install few modules:-

  1. Install GMAP and LOCATION module,
  2. Install GEOLOCATION and its dependent modules.
  3. Add a field in content type with field type GEOLOCATION and widget type GOOGLE MAP.
  4. With this, When the user will ad content,he will be able to mark the location of the area of the power cut on the map.
  5. Refer this GEOLOCATION for further help.
0

Add Geofield to the user profile. You can then build a view using OpenLayers... or Leaf... or others to display the Geofield on a map. I think you want OpenLayers, but here is a comparison of some Drupal Mapping Mods. OpenLayers does not use Location, but some others do. If you need your users to add addresses rather than lat/lon, you can make geofield hidden and derive its data from and address with Geocoder.

You could create a pwr failure report content type and allow unauthenticated users to create a PFR protected by capacha and what not and skip the address all together by using ip_geoloc. Depending on the data, the PFR could be a form with just email address and a true or false toggle?

You really might want to look at doing it with a simple webform and use MapBox

Anyway, lots of ideas to map user locations.

0

I (sort of) wanted to build the same thing. But I prefer not on use a lot of modules. I came up with the following solution: http://www.webdev.vanrij.org/index.php/2013/06/06/store-location-on-a-node/

I store the location information (Longitude & Latitude) in the node table itself. I fill that information based on a given address (user input). Made a function that get's all the nodes with location information from within a given radius of a given point. And put in on a (google) map.

Check out the blog for more info & the related github for the code. https://github.com/jivanrij/locationsearch

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.