bernhard Posted March 16, 2015 Share Posted March 16, 2015 maybe the problem is that the geocoder didn't find your address - try adding a space here: $page->map->address = $node->StrasseNr.", ".$node->Plz." ".$node->Ort; // use this $page->map->address = $node->StrasseNr.",".$node->Plz." ".$node->Ort; // instead of this of course use $page = $page->get( your page to edit ) instead of $page = new Page() 1 Link to comment Share on other sites More sharing options...
iNoize Posted March 20, 2015 Share Posted March 20, 2015 Thanks, no i tried to view the Map with thy RCDMap.js but something goes wrong. I get always the error with the mapNote http://prntscr.com/6j2zmp with one adress i see the Map without marker. With more than one its only a grey div. What could be the Problem ? I use this way https://processwire.com/talk/topic/690-map-marker-fieldtype/?p=18338 Link to comment Share on other sites More sharing options...
LostKobrakai Posted March 20, 2015 Share Posted March 20, 2015 $ is not definded. This means that jQuery (or any other $ dom searching framework) is not available. Link to comment Share on other sites More sharing options...
iNoize Posted March 22, 2015 Share Posted March 22, 2015 Thanks, I had to put jquery in the <head> also. Now It works with the cluster and custom icons https://processwire.com/talk/topic/690-map-marker-fieldtype/?p=25865 One question for teh category field. Wchich kind of field it have to be ? Textfield ? echo "\n\n<div id='map'></div>"; //div to show in template map $js = "<script type='text/javascript'>"; $js .= "RCDMap.options.zoom = 2;"; $js .= "RCDMap.init('map', 0, 0);"; foreach($page->children as $items) { $cat = $items->category ? $items->category->name : 'default-icon'; //Uses a field called category for icon. $js .= "\nRCDMap.addMarker('{$items->title}', '{$items->url}', {$items->map->lat}, {$items->map->lng}, '{$cat}');"; } $js .= "RCDMap.fitToMarkers();"; $js .= "</script>"; echo $js; dont get really to work with the custom icon. $cat = $items->category ? $items->category->name : 'default-icon'; //Uses a field called category for icon. Link to comment Share on other sites More sharing options...
Mats Posted March 22, 2015 Share Posted March 22, 2015 I think the category is a Pagefield. Link to comment Share on other sites More sharing options...
adrianmak Posted April 14, 2015 Share Posted April 14, 2015 The gmap module is great. One suggestion, how to enable map zooming with using mouse wheel ? Link to comment Share on other sites More sharing options...
adrianmak Posted April 14, 2015 Share Posted April 14, 2015 how to implement a multi-language website? with address in different language Link to comment Share on other sites More sharing options...
iNoize Posted April 16, 2015 Share Posted April 16, 2015 Ive solved the Problem with different parents e.G. for each Land an Parent DE TR EN ......... Link to comment Share on other sites More sharing options...
iNoize Posted April 21, 2015 Share Posted April 21, 2015 Hello, is it possible to get the Distance between two selected points ? I will try to get the distance between two points. The idea is to get near airport and show the distance to the choosen city near airport ? I have no idea how to start to realize this. Some one expierence with this kind of problem ? Thanks Link to comment Share on other sites More sharing options...
bernhard Posted April 21, 2015 Share Posted April 21, 2015 https://www.google.at/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=google%20maps%20calculate%20distance http://stackoverflow.com/questions/7997627/google-maps-how-to-get-the-distance-between-two-point-in-metre/7997732#7997732 http://stackoverflow.com/questions/1502590/calculate-distance-between-two-points-in-google-maps-v3 Link to comment Share on other sites More sharing options...
grumpy Posted April 21, 2015 Share Posted April 21, 2015 (edited) I've got Map marker mod installed and put it on a template (which has a sidebar), I then created a page from that template, put in all the details of the lat/long etc. and can see the map and marker in edit mode. I'm probably being stupid but how the heck do I make the map appear at the top of my sidebar in view mode (and published mode)? Edited April 21, 2015 by LostKobrakai Moved to the right forum Link to comment Share on other sites More sharing options...
grumpy Posted April 21, 2015 Share Posted April 21, 2015 Sorry about the wrong forum. Link to comment Share on other sites More sharing options...
grumpy Posted April 22, 2015 Share Posted April 22, 2015 Is there any body there? Link to comment Share on other sites More sharing options...
bernhard Posted April 23, 2015 Share Posted April 23, 2015 yep, i'm here $map = $modules->get('MarkupGoogleMap'); echo $map->render($page, 'map'); did you read the section "how to use" here http://modules.processwire.com/modules/fieldtype-map-marker/ ? Link to comment Share on other sites More sharing options...
gebeer Posted April 23, 2015 Share Posted April 23, 2015 @Mats thank you so much for your OSM version of the module. Have you opened a thread dedicated to it, yet? Couldn't find it in the forums. I forked your module and added basic support for leaflet-providers. In the field settings we can now choose the map tile provider. and the map renders accordingly (example with MapQuest.Open) (example with OpenStreetMap.BlackAndWhite) I'm thinking adding this on a per marker basis also but I'm not quite sure yet if it makes sense at all to define tiles per marker? We should definitely open a separate thread for your module, what do you think? 3 Link to comment Share on other sites More sharing options...
Mats Posted April 23, 2015 Share Posted April 23, 2015 That's great Gebeer! I created a thread for the Leaflet version here. Link to comment Share on other sites More sharing options...
grumpy Posted April 23, 2015 Share Posted April 23, 2015 Please look at the page linked to below. It brings up an error message 'Please add the maps.googleapis.com script in your document head' but if you look at the page source the script is in the head. Can someone please put me straight? http://www.the-limes.com/postcards/chalfont-st-peter/chalfont-st-peter-001/ Link to comment Share on other sites More sharing options...
Mats Posted April 23, 2015 Share Posted April 23, 2015 You've put the script in the <body>. Put it in the <head> instead: <head> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script> </head> Link to comment Share on other sites More sharing options...
bernhard Posted April 23, 2015 Share Posted April 23, 2015 you have some code before your <html> that should be in the body! <script type='text/javascript' src='/site/modules/FieldtypeMapMarker/MarkupGoogleMap.js'></script><div id='mgmap1' class='MarkupGoogleMap' style='width: 100%; height: 300px;'></div><script type='text/javascript'>if(typeof google === 'undefined' || typeof google.maps === 'undefined') { alert('MarkupGoogleMap Error: Please add the maps.googleapis.com script in your document head.'); } else { var mgmap1 = new MarkupGoogleMap(); mgmap1.setOption('zoom', 16); mgmap1.setOption('mapTypeId', google.maps.MapTypeId.ROADMAP); mgmap1.init('mgmap1', 51.606968, -0.552179); mgmap1.addMarker(51.606968, -0.552179, '/postcards/chalfont-st-peter/chalfont-st-peter-001/', 'csp-001-f', ''); }</script><!DOCTYPE html> <html lang="en"> <head> <meta name="keywords" content="home improvement, home, improvement, improvements, plumbing, plumber, electrics, electrical, electric, tile, tiling, tiles, joiner, joinery, carpentry, door, doors, stair, stairs, wardrobe, wardrobes, cupboard, cupboards, kitchen, kitchens, bathroom, bathrooms, bedroom, bedrooms, chalfont st peter, buckinghamshire, UK, genealogy, family tree, family, history, tree, ancestor, relative, relation, postcard, postcards"> <meta name="copyright" content="Worldwide, Simon and Thelma Dawson, 2015"> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>View over Chalfont St Peter</title> <meta name="description" content="" /> <link href='http://fonts.googleapis.com/css?family=Raleway:500' rel='stylesheet' type='text/css'> <link rel="stylesheet" type="text/css" href="/site/templates/styles/main.css" /> <script type='text/javascript' src='https://maps.googleapis.com/maps/api/js?sensor=false'></script> </head> all before <!DOCTYPE html> has to be anywhere between <body> ... </body> Link to comment Share on other sites More sharing options...
grumpy Posted April 24, 2015 Share Posted April 24, 2015 I am really struggling as a beginner here. I have the FieldtypeMapMarker mod installed and I've created a MapMarker field called location. From a template called postcard.php (which has a sidebar and the location field) I have created a page. I have filled in the details on the location section and can see the map and marker in edit view. In the <head> section of _main.php I have added the line: <script type='text/javascript' src='https://maps.googleapis.com/maps/api/js?sensor=false'></script> First question: Why are the lat and long entries in the edit mode of my page to 15 decimal places? Isn't that going to sl;ow up the database? Second question: If I now put the lines: $location = $modules->get('MarkupGoogleMap');echo $map->render($page, location); and nothing else into postcard.php all that code which BernhardB refers to above gets put at the beginning of the source code and not in the body. Please will someone show me EXACTLY how to get the map to appear as the top item of the sidebar? Thanks. Link to comment Share on other sites More sharing options...
gebeer Posted April 24, 2015 Share Posted April 24, 2015 try $map = $modules->get('MarkupGoogleMap'); echo $map->render($page, location); Link to comment Share on other sites More sharing options...
grumpy Posted April 24, 2015 Share Posted April 24, 2015 I did as you suggest and still get all the code at the top... http://www.the-limes.com/postcards/chalfont-st-peter/chalfont-st-peter-001/ Link to comment Share on other sites More sharing options...
gebeer Posted April 24, 2015 Share Posted April 24, 2015 I see '<script src="https://maps.gstatic.com/maps-api-v3/api/js/20/9/main.js"></script>' In the body of your html after the map div. Also you have meta tags in your body. This suggests that your template code is somehow messed up and things get loaded in the wrong order. It would help if you could post your postcard.php and head.inc. Sorry, have to go now. Can take a look again tomorrow. Link to comment Share on other sites More sharing options...
bernhard Posted April 24, 2015 Share Posted April 24, 2015 hey grumpy, it seems you are using the default intermediate profile? you are mixing code in your map template php file and your _main.php file! thats some very basic PW stuff and not related to mapmarker, so i think it would be a good idea to start a new "general support" thread and stop messing this specific thread up (sorry) as long as there is no extra thread, i'll try to help you here once more. have a look at this posting, thats the intermediate profile workflow: https://processwire.com/talk/topic/9690-sub-templates/?p=93247 so everything you echo in your map template will be placed BEFORE all the code in _main.php to get something into the body of your _main.php you have 2 options: 1) create a whole new map template (i think you named it postcard.php) like this: <!DOCTYPE html> <html> <head> <title></title> ## your javascript here ## </head> <body> <?php ### render map here ### ?> </body> </html> but that would remove all the other site elements that you already have on your website (menu, sidebar, search etc) 2) populate the $content variable with your map markup postcard.php $map = $modules->get('MarkupGoogleMap'); $content = $map->render($page, ## your div id here ##); note its not echo ... but $content = ... _main.php should look somehow like this <!DOCTYPE html> <html> <head> <title></title> ## your javascript here ## </head> <body> <h1><?php echo $title ?></h1> <div> <?php echo $content; ?> </div> </body> </html> so in the second case your map will be placed wherever you put your $content variable in your _main.php file. please take your time and read this thread carefully: https://processwire.com/talk/topic/740-a-different-way-of-using-templates-delegate-approach/ thats a lot of useful information and explanation of what's going on behind the scenes when you are using one file to handle all the markup. especially this thread of ryan should help you: https://processwire.com/talk/topic/740-a-different-way-of-using-templates-delegate-approach/?p=6174 good luck 1 Link to comment Share on other sites More sharing options...
grumpy Posted April 24, 2015 Share Posted April 24, 2015 Thank you. I'll do as you say. 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