December 15, 2013 at 1:03 am #13936
I am using Mapress Pro and would like to save a Map generated from php code as per the documentation.
Is this possible in principle and if so can you provide any guidance.
$mymap = new Mappress_Map(array(“width” => 425, ‘height’ => 350));
$address = “An Address”;
$mypoi_1 = new Mappress_Poi(array(“address” => $address ));
$mypoi_1->geocode(); // Works for me
$mymap->pois = array($mypoi_1);
?>December 15, 2013 at 7:07 pm #13943
Sorry, I don’t understand the question. Are you asking how to save a map you generated? If so, it’s possible to save a map to a post. But it’s usually easier to just generate the map from custom fields in the post (or edit it there manually).December 15, 2013 at 10:18 pm #13947
Thanks for coming back. Yes I want to save the map I generated.
I am not using posts directly in my application, but I am entering data to generate the map (address) in the front end through Gravity forms.
For each address I want to save a Map and later display selected content.
I hope thats a bit clearer.December 16, 2013 at 6:41 am #13956
MapPress requires that each map be associated with a post. But I think Gravity Forms will automatically generate a post on the backend with the data you enter, is that correct?
I think they also save the entered data as custom fields.
If so, you can use the MapPress ‘geocoding’ settings to generate the map in that post from those custom field values. For example if your form includes a field ‘address’ then use that field in the geocoding settings.
I’d suggest configuring geocoding and creating a post manually from the custom field(s) to test that it’s working. Then try sending in the same fields from GF to generate it.
There’s some additional information on setting up geocoding in the documentation.December 16, 2013 at 8:59 am #13957
I will try that approach.Custom Fields can only be a single entry not multiple fields in GF from what I understand so I am hoping that a Uk postcode (in my case) will suffice to generate the map.December 18, 2013 at 4:43 am #13964
Just to say the approach with custom fields works.
I created custom fields in the GF submission form for Post Code entry and a post and map are created and stored in the database.
I now need to associate the map id with the post code so I wondering if it is possible to save the post code (and maybe other custom fields) with the map id either in the maps table or in a new table.
Would you have a view on this?
ThanksDecember 18, 2013 at 5:33 am #13965
Just to add it should be useful to capture the map id when the poi is created from the custom field.Is it this function and if so where is it called?function create_meta_map($postid)
I am trying to understand how the gravity form post data is captured from the map press geocode options.December 20, 2013 at 3:47 am #13971
This may help:
- When the post is saved, MapPress reads the custom field values and generates the map.
- The map is saved in table ‘mappress_maps’ and its relationship of the map ID to the post ID is saved in table ‘mappress_posts’.
- There are some functions in file ‘mappress_map.php’ that can be used to read maps or lists of maps.
- You must be logged in to reply to this topic.