Search

A new extension, “Map Location Field v3 (beta)” is now available for download. Comments and feedback can be left here but if you discover any issues, please post it on the issue tracker.

To clarify, this is in fact a complete rewrite of the original Map Location Field. It uses ideas from phoque’s and brendo’s versions, but it is really a rewrite.

New functionality:

  • JavaScript rewritten from scratch, uses the new Google Maps API v3
  • a tabbed interface to switch between map and geocoder
  • a small static map is displayed in the entry Publish tables
  • marker position, centre position and zoom level are stored for each entry
  • added DS filtering for “store locator” functionality (e.g within 10 miles of London, England)

As usual, this is in beta. I’ve written this offline, and isn’t yet in use on any production projects. So I’m certain you will find bugs when you use it ;-)

Wow, that was quick! I’ll try it out in the next few days.

Great job! Another “Dunn” extension!

Did you want issues on github or through Symphony?

Maybe an option to specify which is the default tab from the section (or an ‘evolving’ option that learns from what you do, so if you swapped to the edit tab the last 5 times, it’ll auto open that tab and vice versa) would save a bit of time for the user if they are more often then not entering Address instead of picking points?

Perhaps a default value could be in place for the zoom level too (in section creation).

I get an error when typing in an address (1 West Street, Burleigh Heads) at the moment:

n is undefined http://maps.gstatic.com/intl/en_us/mapfiles/api-3/24/main.js Line 43

Because it errors, the button never changes from the ‘loading’ state, so I can’t enter another address. Perhaps the tab should swap the map only if the geocoder finds a valid address (although the one I entered should be valid)

Still, looking good!

Did you want issues on github or through Symphony?

Symphony please. Add them to the extension’s issue tracker, but leave a not here too since the issue tracker does not yet inform me when new issues are raised!

Maybe an option to specify which is the default tab

I thought about this. But then I decided that the primary purpose of this field is always a map (Map Location Field) and not an address geocode field. Perhaps it could remember the choice in a cookie on a per-user basis.

Perhaps a default value could be in place for the zoom level too (in section creation).

It is already.

I get an error when typing in an address (1 West Street, Burleigh Heads)

Odd, since “West Street, Burleigh Heads” works. I’ll look into it.

Perhaps the tab should swap the map only if the geocoder finds a valid address

That’s what it does — the tab only changes when the geocoder returns a “success”. So the bug lies elsewhere.

Still, looking good!

Thanks :-)

Fixed the address issue. Some geocoder responses do not return a bounding box (if the address is very specific, rather than a wide area such as a town) which the Map Location Field didn’t account for.

Map Location Field v3 updated to version 3.1 on 4th of January 2010.

v3.1 provides the following updates:

  • ability to send this field in an Event post e.g. fields[location]=51.121,-0.122
  • when filtering using a radius DS filter, the distance from the origin is returned in the XML so you can order entries in XSLT by distance

Hello,

I am just getting to grips with symphony and as part of the site I am building I would like to build a store locator.

I.E. Customer enters their postcode and gets a list of the stores that are close by.

One thing that I have noticed is that the Postcode Geocoding is not very accurate. I know this is not your fault but would it be possible to implement the method described here? http://www.tomanthony.co.uk/blog/geocoding-uk-postcodes-with-google-map-api/

That map delivers much more accurate results.

I would have a go myself but my knowledge of PHP is very limited!

Thanks.

One thing that I have noticed is that the Postcode Geocoding is not very accurate. I know this is not your fault but would it be possible to implement the method described here?

Map Location Field v3 uses v3 of the Google API (new google.maps.Geocoder()) which I think is cleaner and more future-proofed. If you’re comfortable with JavaScript then you can modify the maplocationfield.js to taste. The geocoder object is defined on line 117:

this.geocoder = new google.maps.Geocoder();

And there is a method that performs the geocode lookup:

MapLocationField.prototype.geocodeAddress = function(address, success, fail) {

Hello Nick,

I think you misunderstood, the technique for geocoding above uses the Google AJAX Search API for UK Postcode Data as it provides a more accurate result due Goolge Maps licensing restriction .

I was not suggesting to use the older Maps API!

@nickdunn -

Nick this extension is phenomenal! How am I just now trying this out. Thanks to you and the team for pulling this one together! Truly awesome work! Thanks again!!!

Hi Nick, great extension, but why I cannot add more that one map location field to a section?

I can’t think why not. Do you get an error?

Yes, I get an error.

There is already a field of type Map Location. There can only be one per section.

Ooh, what a good error! Very descriptive :-) I’ll take a look.

Try removing the mustBeUnique() from the field.maplocationfield.php in the extension. I think this is a legacy requirement from the early versions where the JavaScript would break with more than one map per page. But I think I rewrote the JS to get around this, so let me know!

Hi.

I’ve installed the Extention, get an API code en put this in symphony, just like described on GITHUB.

The problem is, when I want to add the map localtion to a section and click the “save” button, i get an error:

Symphony Fatal Database Error
Unknown column 'default_zoom' in 'field list'

An error occurred while attempting to execute the following query

Is there anyone familiar with this problem?

Maybe i had the field filled in the wrong way.. Can somebody give me an example of this?

however.. If I had the error, and i go back to the admin, the map location field id added to my section manager. If i go to the CONTENT manager » google maps (that’s how i called my content section) i get an empty block without a map..

Awesome extension!

I am new to Symphony and Web as a whole. I have built a website for a friend http://www.usaverx.com and am trying to use the Store-Locator however the text on the page is all that is rendering. I have 28 sites that I need to incorporate into the store locator and when a distance and zipcode is entered I get a No Stores selected on the page. I have basically just copied and pasted the xml from the tutorial. Any ideas?

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details