ted serbinski – entrepreneur & web architect
  • thoughts
  • about
  • contact



Popular content

  • Best Place to Buy Macbook Pro RAM
  • Yale School of Drama
  • Fedora: Image Manipulation Servlet
  • DC Drupal Meetup #4
  • Preventing Drupal from Handling 404s for Performance
  • It's back!
  • DC Drupal Meetup #5
  • Working 4 days a week
  • Redesigned: tedserbinski.com
  • MTV.co.uk
more

Recent comments

  • really interesting and well
    5 days 16 hours ago
  • cloning the
    3 weeks 5 days ago
  • vacabindex module (drupal
    4 weeks 2 days ago
  • I seem not to know where to
    4 weeks 2 days ago
  • Hi guys, Here a module
    5 weeks 6 days ago
more

Location data with Drupal

One of the most popular features on MothersClick is our geo-mapping system for mothers’ groups—-a mashup of Google maps and mommy groups (created with the organic groups module).

Now, I receive lots of email and questions about how we built such a system with Drupal and location module. The fact is, we didn’t—-well, we did use Drupal, but we did not use location module. The module is a behemoth, it performs slowly, and isn’t too friendly when you have data outside the US. We didn’t use the GMap module either—-we didn’t want nor need the bloat.

So at MothersClick, we started fresh. We wrote a module that added a location form to any node type we specified and also to users. We then used a database table to store this data that was similar to location module’s table structure. From there, we hooked this up to Google’s geocoding service to grab latitude and longitude coordinates for an address. We also added in an address verification layer that worked with Google to verify addresses as well.

The next step was to add in proximity search. Due to time constraints we couldn’t build a full geo-spatial index, so we opted to rely on a bit of math for proximity searches. While this isn’t super ideal, it does indeed work very well for us.

Add in a custom Google maps module that communicates via AJAX with our custom location module and voilá!

Yes that’s great, how can I have it on my site, you might ask, eh?

Well soon you can!

Mark and Allie at Advantage Labs, together with Brandon Bergren have released 2 brand new geo modules:


  • Geo — a module that provides spatial indexing of location data. Why’s this useful? Well for starters, it’s the ideal way to perform proximity searches using bounding boxes and so forth, considerably more efficient than our previous math query, and scales to millions of location data points. This module will be able to tie into views module and provide Google map functionality.
  • Postal — this is the module that works as a CCK field so you can collect address/location data from any node type. There are many use cases where you need address data but you don’t need to do much more than collect it. This module makes it very easy to collect that data. But when those instances arise when you need to do something with this data, such as plot all the mom groups in the world on a map, this will hook into geo for building spatial indexes to do such cool stuff :-)

These 2 modules are the future of geo data in Drupal, and I’m proud to say, that MothersClick will be contributing to both of these modules, as we plan to migrate our custom location modules to these modules one day soon.

posted 13 Jun 2007
  • drupal
  • geo
  • location
  • MothersClick

13 comments

#1
NicolasH wrote 2 years 2 weeks ago

Hmmmmm, very interesting. We JUST committed to the Location module for storing our geo data – although with limited enthusiasm…just because there is (was?) nothing else and we simply don’t have time to come up with a custom solution.

As you say…for countries other than the US it does very little out of the box, so at the moment it’s just a bucket to throw the data in – hoping that at one stage we’ll get it out again in a meaningful way.

I’m not too worried about it though…at the moment for us the only pressing decision to make was where to put the data, and the Location table is as good as any other place.

However, to future-proof us as much as possible, I’d really like to know what the plans for these new modules are…especially in regards to the storage. The Postal module says “It will eventually provide a CCK field”.

Does this mean if we would use it now and then it becomes a CCK field the data will be transformed accordingly? Or is it “a new beginning”, where we would have to take care of the data migration (in which case we might as well keep using the Location module until Postal has been CCKified).

I’m talking about many many thousands of addresses, so it would greatly improve my sleep knowing that they are in a good place :)

#2
ted wrote 2 years 2 weeks ago

Right now, these modules are in heavy development, but their storage mechanisms are pretty solid, meaning, database changes should be minimal as they are worked on.

I believe the postal CCK fields + storage is working (I haven’t had a chance to play with it much as of lately) but do give it a shot, I do believe it is working in that manner.

#3
Ian Ward wrote 2 years 2 weeks ago

Nice post Ted. The address verification layer sounds like a great idea. Is there more information on this anywhere? – Ian

#4
ted wrote 2 years 2 weeks ago

Well basically we just look at what Google returns. It will return something to the effect “address cannot be found” and in those cases we alert the user that the address cannot be verified.

We have only had one case where this was incorrect since Google maps did not know about a new subdivision going up, so we manually had to set that one.

#5
billk2 wrote 1 year 49 weeks ago

This sound perfect for a project I’m working on. Will you post here when the modules are publicly available?

#6
ted wrote 1 year 45 weeks ago

Sure, definitely will! Still aways off but be sure to check those project pages for updates!

#7
daniel wrote 1 year 42 weeks ago

Hi Ted,

are there any news on the modules you/motherclick are using? When will they be made public?
I think many people are really looking forward to check and use your custom gmap module, as well as an integration with geo/postal (which seem to be not developed very actively, considering the low amount of CVS development that’s going on at the moment – any news on that?).
So do you/mothersclick plan to contribute some modules?
If not/if no time, can you perhaps hand over the custom gmap module code to the community in its raw state – or at least point to how you implemented it and how it implements the cool ajax pan/zoom reload thing, or how you integrated it with geo/postal?

Would be really great to hear some news on that <:)

cheers,

daniel

#8
BeechyBoy wrote 48 weeks 1 day ago

Is there any update on when Postal and Geo will be released? Would yoiu be able to mail me the files if possible? Thanks for this great post.

#9
Fletch wrote 40 weeks 2 days ago

This post ranks quite highly on google for “drupal location”. The text sounds ever so promising and yet the post is over a year old and neither of these modules have managed a release yet. Even the hidden dev releases wouldn’t work together (one is 5.x only and one is 6.x only). Is there an update – is anyone putting concentrated effort into getting these modules going? Is there any kind of timeline anyone is aiming for? Or has the whole thing kind of lost drive?

#10
ted wrote 39 weeks 4 days ago

Fletch, yes everything is in Location 3, see here: http://drupal.org/project/location

We’re hoping to migrate our solution to this module and help test once an alpha/beta is ready.

#11
Fletch wrote 36 weeks 11 hours ago

Thanks Ted, that sounds great. Interesting that you decided to join the Location module after all. Actually I used Location recently for a Real Estate website. It was out of that and an address CCK field module, but I went for Location because it integrated with the Google Maps module. It worked pretty well but I definitely would love to be able to offer proximity searches. Got a second-hand car sales website coming up and I think it would be handy there too… so it’s great to hear this news and good luck getting it going! Location RC2 is now out by the way.

#12
Steve Adamo wrote 25 weeks 5 days ago

Wonderful work, and something we desperately need for our social networking site. Might I ask about the current status of the project?

Thanks for all the effort to date!

#13
ted wrote 19 weeks 1 day ago

@Steve we actually trimmed back our efforts but a lot of great work is in the location module now so check it out!

Add your comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <img> <pre>
  • Web page addresses and e-mail addresses turn into links automatically.
  • You can use Textile markup to format text.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

More information about formatting options


Code examples and downloadable zip files of code are licensed under a Creative Commons License.
All other content, unless where noted, ©2009 Theodore Serbinski. All Rights Reserved.