kiral6130 Posted May 1, 2015 Share Posted May 1, 2015 Hey there, is there any possibility to refresh the lon/lat results when a "query limit ...." failure is thrown? I always have to go on every address an click in it - then it could be found..... any better solutions? Best Link to comment Share on other sites More sharing options...
sgt.blikey Posted May 19, 2015 Share Posted May 19, 2015 (edited) I am having a problem returning values for 'lat' and 'lng', which evaluate to '0.000000' when called in my page's template file. I have a field, 'map', of type MapMarker. The default address is filled out and the corresponding Latitude and Longitude values are populated. The field is included in a template, 'contact-us' and this template is used by a page, 'Contact Us'. In the admin, editing the 'Contact Us' page I see the subfields of my 'map' field are populated correctly and a map is displayed, with a pin dropped in the correct place. I have reduced the contents of contact-us.php to the following: <?php if ($page->map) { echo ("Address: {$page->map->address}<br />"); echo ("Latitude: {$page->map->lat}<br />"); echo ("Longitude: {$page->map->lng}<br />"); echo ("Zoom: {$page->map->zoom}<br />"); } ?> The output is as follows (I have edited the address): Address: Name of Establishment, Street, Town, PostcodeLatitude: 0.000000Longitude: 0.000000Zoom: 12 I do not understand, why are 'lat' and 'lng' evaluating as '0.000000'? Thanks, Nic Versions: PW = 2.5.29; FieldTypeMapMarker = 2.0.6; InputfieldMapMarker = 2.0.7; MarkupGoogleMap = 1.0.1 Edited May 19, 2015 by sgt.blikey Link to comment Share on other sites More sharing options...
formmailer Posted May 23, 2015 Share Posted May 23, 2015 Hi! Is there an (easy) way to add letters or numbers to the marker icons? And to change the color of the markers? /Jasper Link to comment Share on other sites More sharing options...
Sined Posted May 24, 2015 Share Posted May 24, 2015 I am having a problem returning values for 'lat' and 'lng', which evaluate to '0.000000' when called in my page's template file. I have a field, 'map', of type MapMarker. The default address is filled out and the corresponding Latitude and Longitude values are populated. The field is included in a template, 'contact-us' and this template is used by a page, 'Contact Us'. In the admin, editing the 'Contact Us' page I see the subfields of my 'map' field are populated correctly and a map is displayed, with a pin dropped in the correct place. I have reduced the contents of contact-us.php to the following: <?php if ($page->map) { echo ("Address: {$page->map->address}<br />"); echo ("Latitude: {$page->map->lat}<br />"); echo ("Longitude: {$page->map->lng}<br />"); echo ("Zoom: {$page->map->zoom}<br />"); } ?> The output is as follows (I have edited the address): Address: Name of Establishment, Street, Town, Postcode Latitude: 0.000000 Longitude: 0.000000 Zoom: 12 I do not understand, why are 'lat' and 'lng' evaluating as '0.000000'? Thanks, Nic Versions: PW = 2.5.29; FieldTypeMapMarker = 2.0.6; InputfieldMapMarker = 2.0.7; MarkupGoogleMap = 1.0.1 You must specify the language when referring to google API (http://maps.google.com/maps/api/js?language=ru&sensor=false) https://developers.google.com/maps/faq?hl=ru#languagesupport Link to comment Share on other sites More sharing options...
heldercervantes Posted June 5, 2015 Share Posted June 5, 2015 Following Soma's Create simple forms using API thread I setup a user registration form on a site I'm working on. Everything worked great until I tried adding an InputfieldMapMarker at the end. So I'm using this to get the field in place: $field = $modules->get("InputfieldMapMarker"); $field->label = "Localização"; $field->attr('id+name','map'); $field->attr('address','38.694147, -9.205794'); $field->required = 0; $form->append($field); The field shows up as expected and I even got my JS to change the address value and update the map according to what users put into the contacts fields before they reach the map. The problem is when the form is submitted. Error: Call to a member function set() on null (line 177 of C:\xampp\htdocs\cars\site\modules\FieldtypeMapMarker\InputfieldMapMarker.module) MapMarker's documentation doesn't say much about using the inputfield, and I'm lost. Help a brother out? Link to comment Share on other sites More sharing options...
Soma Posted June 5, 2015 Share Posted June 5, 2015 I doesn't work on frontend, it requires the Fieldtype. http://modules.processwire.com/modules/fieldtype-map-marker/ read comments. Link to comment Share on other sites More sharing options...
Soma Posted June 5, 2015 Share Posted June 5, 2015 Hm, maybe it works like this? $field = $modules->get("InputfieldMapMarker"); $field->label = "Localização"; $field->attr('id+name','map'); $marker = new MapMarker(); $marker->lat = "38.694147"; $marker->lng = "-9.205794"; $field->attr('value', $marker); $field->required = 0; $form->append($field); 1 Link to comment Share on other sites More sharing options...
sgt.blikey Posted June 5, 2015 Share Posted June 5, 2015 You must specify the language when referring to google API (http://maps.google.com/maps/api/js?language=ru&sensor=false) https://developers.google.com/maps/faq?hl=ru#languagesupport Apparently not: https://developers.google.com/maps/faq#languagesupport By default the API will attempt to load the most appropriate language based on the users location or browser settings. Cheers, Nic Link to comment Share on other sites More sharing options...
heldercervantes Posted June 5, 2015 Share Posted June 5, 2015 Soma, my friend, once again you save my butt. Thanks! To anyone who's interested, the only thing I had to do after Soma's suggestion was tweak the way I set the variable: $page->mapmarker->address = $input->post->map; Link to comment Share on other sites More sharing options...
Peter Knight Posted June 11, 2015 Share Posted June 11, 2015 Trying MapMarker for the first time and really love it. Is there a way for me to specify multiple addresses in a single Map field in the back end? I know on the front end, I can probably setup pages and repeaters and pull those into a map on the front end but thats not what my project requires. Link to comment Share on other sites More sharing options...
bernhard Posted June 12, 2015 Share Posted June 12, 2015 you could put it into a pagetable. would that work for you? Link to comment Share on other sites More sharing options...
Peter Knight Posted June 12, 2015 Share Posted June 12, 2015 Just updating my request with a visual. You can see this page refers to three locations and thats what I need to output on a single map. you could put it into a pagetable. would that work for you? I'm thinking it might be the way to go. In the meantime, I created a repeater field based on the MapMarker field and in the Admin, this works well as I can pinpoint a single address for each of my three locations. In the back end, I'd have a few separate maps per individual page but that's ok. On my front though, I want my single map to display those three addresses. This is what I've been using to display a map for a single location <?php foreach($page->test_map_repeater as $map); $map = $modules->get('MarkupGoogleMap'); echo $map->render($page, 'incident_location'); ?> I'm not sure how to isolate the address from each individual repeater map and pass it to the single MarkupGoogleMap above. I know my repeater map addresses have a value as they output when I try a simple echo such as <?php foreach($page->test_map_repeater as $mapinstance) { echo "{$mapinstance->incident_location->address}<br/>"; } ?> Link to comment Share on other sites More sharing options...
Peter Knight Posted June 12, 2015 Share Posted June 12, 2015 Solved it. I just needed to update this: echo $map->render($page, 'incident_location'); to this echo $map->render($page->test_map_repeater, 'incident_location'); Seems obvious now :-/ Link to comment Share on other sites More sharing options...
bernhard Posted June 12, 2015 Share Posted June 12, 2015 just tried the pagetable with mapmarker on basic profile and i think it looks very clean: 1 Link to comment Share on other sites More sharing options...
Peter Knight Posted June 12, 2015 Share Posted June 12, 2015 just tried the pagetable with mapmarker on basic profile and i think it looks very clean: 2015-06-12_1054.png That's nice. Although I like the simplicity of Repeater, using PageTable instead means extra fields can be associated with each pins tooltip. IE I could have a Summary field and that could display on mouse-over of each locations pin. 1 Link to comment Share on other sites More sharing options...
bernhard Posted June 12, 2015 Share Posted June 12, 2015 yep, that's what i love pagetables for Link to comment Share on other sites More sharing options...
Peter Knight Posted June 12, 2015 Share Posted June 12, 2015 yep, that's what i love pagetables for Can't quite get this to work with Page Table though. Each PageTable instance is a separate child page, right? So if this works for repeater maps and assigns a map called incident_location with those pins, echo $map->render($page->test_map_repeater, 'incident_location'); how would I generate a map containing a pin for each pageTable? Link to comment Share on other sites More sharing options...
Peter Knight Posted June 12, 2015 Share Posted June 12, 2015 Got it. I needed to do this <?php // outputs multiple pointers from pagetable maps(pt_map) $items = $page->children("pt_map!='',"); $map = $modules->get('MarkupGoogleMap'); echo $map->render($items, 'pt_map'); ?> Link to comment Share on other sites More sharing options...
bernhard Posted June 12, 2015 Share Posted June 12, 2015 you can also access all pagetable items like this. seems cleaner to me (pagetable-field name "maptable" and map-field name inside the pagetable is "map"). $map = $modules->get('MarkupGoogleMap'); echo $map->render($page->maptable, 'map'); Link to comment Share on other sites More sharing options...
Peter Knight Posted June 12, 2015 Share Posted June 12, 2015 you can also access all pagetable items like this. seems cleaner to me (pagetable-field name "maptable" and map-field name inside the pagetable is "map"). $map = $modules->get('MarkupGoogleMap'); echo $map->render($page->maptable, 'map'); Thanks Bernhard. That does indeed look cleaner. Im not sure why but this method doesn't always show my most recent pin. Whereas the longer code will. When I look at my parent page and scroll to the PageTable field, I have a notice saying: Children were found that may be added to this table. Check the box next to any you would like to add. Once I check the box beside the missing page, the pin will show on a map using your code. Link to comment Share on other sites More sharing options...
LostKobrakai Posted June 12, 2015 Share Posted June 12, 2015 Are you adding the pages as children or via the pagetable? Link to comment Share on other sites More sharing options...
Peter Knight Posted June 12, 2015 Share Posted June 12, 2015 Are you adding the pages as children or via the pagetable? Pages are being automatically created as children of the parent page. Link to comment Share on other sites More sharing options...
LostKobrakai Posted June 12, 2015 Share Posted June 12, 2015 Then try to save not only the "children" but also the page which holds the pagetable. The orphaned pages message appears if there are children matching the pagetables settings, which are not part of the table itself. Normally pages created by the pagetable add button should automatically be saved to the pagetable, so I would investigate this further, even if additionally saving the parent page will fix this. Link to comment Share on other sites More sharing options...
Peter Knight Posted June 12, 2015 Share Posted June 12, 2015 I think this is from hitting Publish on a PageTable page but then not hitting Save on the same. Or something like this. Link to comment Share on other sites More sharing options...
Peter Knight Posted June 12, 2015 Share Posted June 12, 2015 Typically a pin on a map will link to the source PW page. However, I have a Map which pulls in locations and those locations are child-pages generated via PageTable. In this case, I want the pin to link to each pins parent url instead of itself. I've discovered an option in Ryans module which seems to control the links attached to the pins markerLinkField Page field to use for the marker link, or blank to not link (type: string; default: url). I'm not sure how to apply it to the following <?php $items = $pages->find("template=update-location, pt_map!='', sort=title"); $map = $modules->get('MarkupGoogleMap'); echo $map->render($items, 'pt_map', array( 'height' => '500px', 'markerLinkField' => 'url')); ?> I've tried these but obviously messing up my syntax or understanding of its workings <?php $link-to-parent = page->parent->url; //create a variable and then pass that to the markerlinkField $items = $pages->find("template=update-location, pt_map!='', sort=title"); $map = $modules->get('MarkupGoogleMap'); echo $map->render($items, 'pt_map', array( 'height' => '500px', 'markerLinkField' => ' . {$link-to-parent} .')); //call my variable here ?> <?php $items = $pages->find("template=update-location, pt_map!='', sort=title"); $map = $modules->get('MarkupGoogleMap'); echo $map->render($items, 'pt_map', array( 'height' => '500px', 'markerLinkField' => 'url->parent')); //try adding a reference to the parent ?> Can anyone point me in the right direction? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now