Viewing 7 reply threads
  • Author
    Posts
    • #1514
      ralmestro
      Member

      Before, I reported two bugs about file upload and forgot talk about the great job creating Piklist, thanks for the opportunity to use it.
      One question
      Exist any option to add a google map location as a custom field?

      Thanks

    • #1521
      Steve
      Keymaster

      @ralmestro– We currently do not have a Google maps option or plugin.

    • #2124
      bicho44
      Member

      Any news about to add this type of field?

      Thanks in advance

      Fede

    • #2125
      Kevin
      Keymaster

      @bicho44

      What are the core features for such a field and how should they work. This would be a great place to get that discussion rolling. What kinds of things do you feel are necessary for such a field?

      On a related note, in the coming weeks we will start to show people how to create their own fields easily with Piklist so stay tuned!

      Thanks,

      Kevin

    • #2139
      bicho44
      Member

      First sorry, because im so late 😀 with my answer.

      The idea is this, when you add a Google Map field you obtain to spaces (fields) the first one is the address and the second one is the map itself, where yo see (realtime) the change you made in the address field and also the pointer.
      Example of a Google Map Field

      Then you have a magic way function to put that map in the front end avoiding all the google nonsense 😀

      I hope this help

      Thanks in advance.

    • #3687
      bicho44
      Member

      Hi, everybody, any news about the google map field?

      Thanks in advance

    • #3688
      ndbe
      Member

      This is a simple solution to put google maps in your admin panel. User can drag the marker and the position will be saved in latLang custom field:

      piklist('field',array(
          'type'=>'html',
          'label' => 'Map',
          'value' => '<div id="project_map" style="height:500px;"></div>',
      
      ));
      
      piklist('field',array(
          'type'=>'hidden',
          'field'=>'latLang'
      
      ));
      
      ?>
      <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
      <script>
      
          var map;
          var marker
          var latLangField = jQuery('#_post_meta_latLang_0');
          var zoom = 15;
          var latLang = latLangField.val();    
          if(latLang == '') {
              latLang = "54.470636, 18.469391";
              zoom = 8;
          } 
          latLang = latLang.split(',');
          
          
          function initialize() {
              
              
              var mapOptions = {
                  zoom:zoom,
                  center: new google.maps.LatLng(latLang[0],latLang[1])
              }
              map = new google.maps.Map(document.getElementById('project_map'),mapOptions);
              
              marker = new google.maps.Marker({
                  draggable: true,
                  position: new google.maps.LatLng(latLang[0],latLang[1]), 
                  map: map,
                  title: "Your location"
              });
              
              google.maps.event.addListener(marker, 'dragend', function (event) {
                  var lat = this.getPosition().lat();
                  var lang = this.getPosition().lng();
                  latLangField.val(lat+','+lang);
              });
              
          }
          google.maps.event.addDomListener(window, 'load', initialize);
          
         
          
      </script>
      <?php
      

      You will have to change ‘#_post_meta_latLang_0’ to the ID of your hidden field.

      • #5872

        Thanks, ndbe! Tested your code and it works flawlessly on the backend.

        However, I was trying to replicate the same thing on the front-end, but the page returned blank after submit and no data was saved. Any idea how to resolve this?

        Thank you!

    • #3689
      bicho44
      Member

      WOW, thanks, i gonna try it later

Viewing 7 reply threads
  • The topic ‘Google Map’ is closed to new replies.