Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Streda, 25. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Google maps geocoding inserts

phpMyEdit General     Google maps geocoding inserts
Odoslať novú tému   Odpovedať na tému    
 
marcool     Založený: 07.10.2008   Príspevky: 5  
Príspevok Zaslal: 2008-10-07 20:37
Návrat hore  Odpovedať s citátom     

I'm looking for a way to insert geocoding results of a search with the google maps API into several fields...
I didn't start putting together an extension but I'm guessing it shouldn't be so complicated.
I'm planning to try modifying the jscalendar extension.

Did anyone do that already?
Any clue where to start?

Cheers,

 
ajh     Založený: 17.12.2003   Príspevky: 236  
Príspevok Zaslal: 2008-10-08 12:37
Návrat hore  Odpovedať s citátom     

Hi...could you explain in more detail what you are trying to do? I'm sure I can help (I wrote the mce_cal extension).

 
ajh     Založený: 17.12.2003   Príspevky: 236  
Príspevok Zaslal: 2008-10-08 14:38
Návrat hore  Odpovedať s citátom     

The integration into PME is easy, and I would just adapt the calendar implementation. The difficult bit is going to be creating a javascript function that creates the functionality.

So what you need to do is to create a javascript function to create the popup, with a number of arguments, including one which gives the id of the field that you want updated with the coordinates (actually there's nothing to stop you updating multiple fields). It might look something like:
Kód:
google.map(
search : "parameters for map search",
oCoord : <field on form for coordinates>,
oCountry : <field on form for country>)


 
marcool     Založený: 07.10.2008   Príspevky: 5  
Príspevok Zaslal: 2008-10-08 18:13
Návrat hore  Odpovedať s citátom     

hehe... that might help a lot...

 
ajh     Založený: 17.12.2003   Príspevky: 236  
Príspevok Zaslal: 2008-10-08 21:48
Návrat hore  Odpovedať s citátom     

Could you give a more complete example? ie. what does showLocation do?

 
marcool     Založený: 07.10.2008   Príspevky: 5  
Príspevok Zaslal: 2008-10-08 21:52
Návrat hore  Odpovedať s citátom     

Kód:
<script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=xxxxyour-key-herexxxxx" type="text/javascript">
</script>
<script type="text/javascript">

    var map;
    var geocoder;

    function initialize() {
      map = new GMap2(document.getElementById("map_canvas"));
      map.setCenter(new GLatLng(34, 0), 1);
      geocoder = new GClientGeocoder();
    }

    // addAddressToMap() is called when the geocoder returns an
    // answer.  It adds a marker to the map with an open info window
    // showing the nicely formatted version of the address and the country code.
    function addAddressToMap(response) {
      map.clearOverlays();
      if (!response || response.Status.code != 200) {
        alert("Sorry, we were unable to geocode that address");
      } else {
        place = response.Placemark[0];
        point = new GLatLng(place.Point.coordinates[1],
                            place.Point.coordinates[0]);
        marker = new GMarker(point);
        map.addOverlay(marker);
        marker.openInfoWindowHtml(place.address + '<br>' +
          '<b>Country code:</b> ' + place.AddressDetails.Country.CountryNameCode);
      }
    }

    // showLocation() is called when you click on the Search button
    // in the form.  It geocodes the address entered into the form
    // and adds a marker to the map at that location.
    function showLocation() {
      var address = document.forms[0].q.value;
      geocoder.getLocations(address, addAddressToMap);
    }

   // findLocation() is used to enter the sample addresses into the form.
    function findLocation(address) {
      document.forms[0].q.value = address;
      showLocation();
    }
</script>
       <script type="text/javascript" src="jscal/calendar.js"></script>
       <script type="text/javascript" src="jscal/lang/calendar-en.js"></script>
       <script type="text/javascript" src="jscal/calendar-setup.js"></script>
       <link rel="stylesheet" type="text/css" media="screen" href="jscal/calendar-system.css">


 
Odoslať novú tému   Odpovedať na tému    

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov