Benefits Of Lats & Longs In Custom Fields?

Home Forums MapPress Support Benefits Of Lats & Longs In Custom Fields?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #13012
    CliveB
    Participant

    Hi Chris,

    I’m about to deploy a site with several thousand businesses.

    When doing mashups of circa 100+ items, is there any advantage in using your function (below) to dump the lats and longs into custom post fields and call from there rather than pulling from the separate MapPress tables (I’m thinking in terms of speed)

    Cheers,

    Clive

    <?php 
    function myaction($map) {
     global $post;
     $first_poi = isset($map->pois[0]) ? $map->pois[0] : null;
     if ($first_poi) {
       $lat = $poi->point['lat'];
      $lng = $poi->point['lng'];
      update_post_meta($post->ID, 'mylat', $lat);
      update_post_meta($post->ID, 'mylng', $lat);
     }
    }
    add_action('mappress_map_save', 'myaction', 10, 2);
    ?>
    #13015
    Chris
    Keymaster

    Hi,

    That code would be very helpful if you want to restrict the result set by querying using lat/lng. As far as reading the result maps or poi details, it’s fastest to read them as a serialized object (the way they’re stored in the custom tables).

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.