Reply To: MapPress Pro API?

Home Forums MapPress Support MapPress Pro API? Reply To: MapPress Pro API?

#13917
Chris
Keymaster

    Hi,

    If you’re using PHP you can get an array of all the maps for a post like this (1234 is the post ID):

    Mappress_Map::get_post_map_list(1234);

    Each map will have a ‘pois’ array of POI objects. And each POI object will have a ‘point’ array with members ‘lat’ and ‘lng’. For example to print all the POIs:

    
    $maps = Mappress_Map::get_post_map_list(1234);
    foreach ($maps as $map) {
      foreach ($map->pois as $poi) {
        echo "Lat: " . $poi->point['lat'] . " Lng: " . $poi->point['lng'];
      }
    }
    

    If you want every map in the system instead of every map for one post, you can use:
    $maps = Mappress_Map::get_list();

    I hope that helps.