Skip to content
You are here: Home arrow Sobi2 arrow FAQ arrow Google Maps & Way Search arrow How to fetch geo coordinates in add/edit entry form (by map) 
Sobi2 FAQ

Tagged with  Google Map,  fetch coordinates,  geo

SOBI FAQ How to fetch geo coordinates in add/edit entry form (by map)

Joomla! 1.0Joomla! 1.5

Written by Sigrid Suski
Last updated on Friday, 16 April 2010

SOBI Answer Fetching Geographical Coordinates by address in the Add/Edit Entry form of Sobi2.

Works with Sobi2 versions since RC 2.7.2

Requirements:

  • Google API Key entered in Sobi2 View Configuration->Google Maps
  • Custom field for longitude 'field_longitude' assigned in Sobi2 View Configuration->Google Maps
  • Custom field for latitude 'field_latitude' assigned in Sobi2 View Configuration->Google Maps
  • Custom field of field type "text code" (formerly called custom code) to insert the script below.
  • Magic Quotes (magic_qotes_gpc) has to be set to on! (for Sobi2 < RC 2.9.2.4)
configuration

Instructions:

  • Create the fields for longitude and latitude and assign them to the map in Sobi2 View Configuration->Google Maps (see image)
  • Enter the Google API Key in Sobi2 View Configuration->Google Maps (see image)
  • Create a new field in the "Custom Fields Manager" called for example "Coordinates Map". Set the field type to "text code" and insert the code below in the "Text Code" area.
  • Set the map field order below the fields for longitude and latitude.
  • Change the initial variables in the code to fit your needs.
    Set zoomlevel_add to your starting zoom level for adding a new entry,
    set zoomlevel_edit to your starting zoom level for editing an entry which has already coordinated entered,
    set start_latitude and start_longitude to initial coordinates.
    The map will center to startposition if a new entry is added (preset in the example to Birmingham, GB).
    Also you can change the width and the height of the map (preset to 400px x 300px).
<script src="http://maps.google.com/maps?file=api&v=1&key={googleApiKey}" type="text/javascript"></script>;
 
<div id="map" style="width: 400px; height: 300px"></div>
 
<script type="text/javascript">
    //<![CDATA[
 
    var start_latitude = "52.4777619318499";
    var start_longitude = "-1.89788818359375";
    var zoomlevel_add = 11;
    var zoomlevel_edit = 3;
 
    var map = new GMap(document.getElementById("map"));
    map.addControl(new GSmallMapControl());
 
  var latitude = document.getElementById('field_latitude').value;
  if (latitude == "")
    latitude = start_latitude;
  var longitude = document.getElementById('field_longitude').value;
  if (longitude == "")
    longitude = start_longitude;
  if (latitude == start_latitude)
     zoomlevel = zoomlevel_add;
  else
     zoomlevel = zoomlevel_edit; 
 
    // center and zoom to the lat/long in the form
    map.centerAndZoom(new GPoint(longitude,latitude), zoomlevel);
 
    GEvent.addListener(map, 'click',
        function(overlay, point) {
            if (point) {
                document.getElementById('field_latitude').value = point.y;
                document.getElementById('field_longitude').value = point.x;
            }
        }
    );   
//]]>
</script>

custom code field

If you want to use the map inside sobiTabs, additionally enter the following small script at the end of the Entry Form Template.
Replace myOwnPane with the pane name you use in your template.
Description of sobiTabs
<script>
myPaneMap = document.getElementById('myOwnPane');
oldmyPaneMap = myPaneMap.onclick;
myPaneMap.onclick = function(){
map.checkResize();
if (oldmyPaneMap)
   oldmyPaneMap();
}
</script>
Fetch Coordinates by Map for Sobi2
 
Published on Tuesday, 29 January 2008. Visited 20547 times.
 
< Prev  Next >
Powered by Sigsiu.NET RSS Feeds

User Feedback

SIMPLY AMAZING!!!!! - Thursday, 16 October 2008
This is by far the absolute best Joomla Component I have ever come across. Super flexible, easy to customize and the support is just as great as the product itself...if not better!
I highly recommend you get your hands on this baby and start playing with it. Very nice indeed!
 
A high quality component and excellent support! - Monday, 13 October 2008
The support is great, and the Sobi2 component is continuously developed, getting better every day. The forum is excellent. If you run into any kind of problem, just post it on the forum and the problem is often solved immediately, either by the developers or the forum members! The forum help is really outstanding, and far beyond that offered by most other Joomla forums!
 
Key Component - Monday, 13 October 2008
How can I say enough about SOBI2 You can do so much with it its amazing. Had a little hiccup on an upgrade and posted a topic on the forum answered and fixed in no time. My hats off to these guys they are the best. :-)
 
Simply the best directory solution for Joomla - Sunday, 12 October 2008
Support from the developer via the SOBI community forum is excellent and the SOBI component is continuously developed meaning that it just keeps on getting better!
 
Powerful, Flexible, and Customizable Component - Friday, 10 October 2008
SOBI2 is a potential solution for a wide range of applications.
Because the SOBI2 component is so flexible/customizable, and has a wide range plugins/modules/extensions, it is somewhat difficult to adequately describe the scope of SOBI2's capabilities and potential applications. The Developers describe it as a "directory component ... to show entries of companies, clubs, persons, shops, products". This description perhaps understates the component's capabilities and potential applications.
 
Best Directory and probably best component ever - Friday, 10 October 2008
This component is simply the best component around regarding ease of use, flexibility and potentials, support (even if it's free) and community help.
This component is an absolute must for everyone who needs a directory or listing site.
 
Excellent support - Wednesday, 08 October 2008
An essential extension for any Joomla website. But I have to mention how excellent the support is on the SOBI2 forums. Questions are answered very quickly and there are always examples available. Top product!!
 
Amazing product & 1st class support in the forums - Wednesday, 08 October 2008
This is the best experience I've had with OS software and my wife (who isn't into computers) can't believe there are people like this out there. Can't recommend this extension highly enough.
 
Truely a great product - Tuesday, 07 October 2008
I have been doing some research on directory software for sometime and I have to say this is the best product I have come across. SOBI2 is has loads of features, highly customisable and adaptable to any type of listing and directory needs. Without any prior experience in Joomla and PHP I was able to install and use easily. There is a great support forum as well.
 
Sobi-Most Flexible and Adaptable Directory Extension - Tuesday, 07 October 2008
I have used this now twice on production sites and it is not only an excellent directory extension,but ideal for any listing environment.
The support is outstanding both from the forum users and developers.Development is ongoing and there are a number of excellent add ons.
Fully customizable -try it first!!!!
 
Professional strength directory component - Sunday, 21 September 2008
SOBI2 has plenty of features - I just keep finding new ones every week! The clean code, flexibility and power in SOBI2 are the perfect ingredients for a real web portal. Thanks to all the developers at Sigsiu.NET - well done! For anybody looking for a superb industrial strength Joomla directory extension - you've just found it.
 
Very flexible and powerful - Sunday, 14 September 2008
This software ranks with the best there is for free (and commercial), easy-to-use directory component for Joomla. I would have paid lots of money just to own this, but its FREE! Also, the Admin console is beautiful in its look. I have no problem running it for a long time now. This is a really good software. The code is very nice and clean. It's very easy to customize, and has got some really great plugins! Try it!
 
Master of all directories - Thursday, 11 September 2008
SOBI2 is the best COM for directories which I tested, and I tested ALL mayor directories.
 
Very powerfull! - Tuesday, 19 August 2008
Let me just say, I have big plans for this component. We have several projects on the horizon SOBI2 will be perfect for. Everything from a small directory of equipment to a free flowing video gallery for a non-profit organization. Very solid install, setup and configuration. Very, very good component and set of plugins.
 
Well built component with excellent support - Monday, 28 July 2008
SOBI2 is a truly excellent joomla component. I'm no good at all at coding from the beginning, so when i was asked to create a business directory for the company i work for i was a little worried about delivering. Along comes Joomla and SOBI2 and all the hard work is gone.
 
Just the best - Saturday, 19 July 2008
Thanks for a wonderful ware, easy to instal and configure and think its going to get better with new versions!
 
Couldn't ask for anything better - Wednesday, 09 July 2008
Simple to use, massively flexible, very performant. The new version is so customizable, includes extras and a busy forum so that getting advice, hacks, and tips is a breeze, even for us technically-challenged folk.
SOBI2 offered everything that our site was looking for directory component.
 
Great for my inventory project - Tuesday, 08 July 2008
I work for a non-profit arts organization and this was perfect tool for an inventory project that catalogged buildings in the county. We added in a lightbox for photos and the geo mapping tool to create Google maps in each record.
 
Best Joomla component ever - Wednesday, 18 June 2008
Sobi2 is an excellent component with suburb support, often within 1 hour :)
Also the free plugins works out of the box.
There are also not free plugins/addons, you have to pay a small fee but it is really worth the money.
The community is very active and if you have a problem/question it is ussually solved on the fly.
 
what do you want more? - Saturday, 14 June 2008
absolutely great component that can be costumized to fit your needs.
i'm using this component instead of the standard weblink component from joomla.
congratulations for the developers!
use their forum if you need some tips & tricks for customization!
 
One million dollars tool - Monday, 26 May 2008
Simply the best. Great product, great support!
 
Very flexible and powerful directory component - Wednesday, 21 May 2008
its the coolest the most costomizable and profitinal component.
Very modular piece of work. Simply incredible how easy it was to set up and get running.
Thank you!
 
Simply The Best!!! - Tuesday, 20 May 2008
If you need a sofisticated, but at the same time easy to set up and control open directory system, this component would be probably your best solution! There are addtional modules supported for the system, so it's customizable, there are labguage packs... is there anything else you can dream of? :) My advice is : just use it for your needs and say thanks a lot to its developers! Thank you!
 
Works just great... easy in use... :) Super - Tuesday, 20 May 2008
This component is amazing and very easy to setup and run out of the box! You can also heavily tweak it if you know even a little bit about PHP. It's fast, reliable and very good secured. I saw the code and I think that it will never possible to hack any site thru this component. If it was sold at $100, I would buy it with no hesitation!
 
Perfect application - Tuesday, 13 May 2008
This is a perfect application. It is clean programmed and has a nice layout. The code is very nice and clean. It's very easy to customize, and has got some really great modules! Try it, This package beats them all!
 
Wonderful Joomla directory extension - Monday, 05 May 2008
I spent some time researching the different components out there, and none looked as apealing, easy to install and use, yet be powerful and scalable, as SOBI2.
SOBI2 seemed to have all the features I was interested in, and many others. Good program and excellent support.
 
Easy To Install And Use SOBI2 - Wednesday, 30 April 2008
SOBI2 is the best directory manager for Joomla! that i have seen. With all the features and tools at first one would think this would be to complicated to use and manage, but that not the case. SOBI2 works and is very easy to use.
 
What more would you ask for a directory - Tuesday, 22 April 2008
SOBI2 is I can say the most adaptive, the fastest, the most usable and tweakable directory there is on the net Speed, adaptability, powerful, easy to understand and simple. Everything a webmaster would ever want to offer their clients, and everything a client would want on their site.
And to be honest, because of this directory extension I've started to use Joomla ... ;-)
 
Amazing - Monday, 14 April 2008
I've spent about 10 hours in the last few days trying to figure out the best solution for Directory/Review listings. This soars so high above every other option out there that they can't touch this component.
This is by far the best addition to Joomla I have seen.
 
Excellent component - Friday, 11 April 2008
I discovered SOBI2 only one week ago, but I can say that I am very pleased to work with it. You can modify it to develop your own custom theme, or if you are a beginner it has everything integrated to be able to use it in your way. Nice work and by deepest respect for the developers that made this (and made it free). Keep on going with this and I hope to see future developements.
 
Ads/Anzeige

Partner Sites: Joomla Web Design  |  redCOMPONENT  |  Joomla Downloads  |  CyberTyper.ch  |  Codingfish  |  Joomla! kurz und bündig  |  FLEXIcontent