horst Posted January 22, 2015 Share Posted January 22, 2015 Hey, today a newbie question from me: "Is it possible to get one of those addressboxes with the MapMarker-Field?" I use it the first time and with a single marker only. Would be nice to have directly such a box displayed. Link to comment Share on other sites More sharing options...
KaMeKuN Posted January 27, 2015 Share Posted January 27, 2015 Im having troubles to make this work; for some reason on the admin area i can set my market fine; but when i render the map y de frontend the marker just go difrent from i save. I dont see why the module is making the marks difrente from save on the db. $markers = $page->children(); $map = $modules->get('MarkupGoogleMap'); print $map->render($markers, 'field_map', array('type' => 'ROADMAP')); Link to comment Share on other sites More sharing options...
Mats Posted February 22, 2015 Share Posted February 22, 2015 I made a Leaflet version of this module: https://github.com/madebymats/FieldtypeLeafletMapMarker- Front-end demo: http://tegelwebb.se/leaflet-map-test/ 10 Link to comment Share on other sites More sharing options...
cstevensjr Posted February 22, 2015 Share Posted February 22, 2015 @Mats, Very nice! 1 Link to comment Share on other sites More sharing options...
kongondo Posted February 22, 2015 Share Posted February 22, 2015 @Mats, Thanks for this. Please consider submitting your module to the modules directory as well as creating a new (support) thread for it 1 Link to comment Share on other sites More sharing options...
awebcreature Posted February 28, 2015 Share Posted February 28, 2015 No one with experience in that area? Tried to add that functionality and I made a big mess... Any help will be highly appreciated! Hello there! Is it possible to add drawing tools to the module? https://developers.google.com/maps/documentation/javascript/examples/drawing-tools On the current project i need to draw polygon on the map and save to DB for later use in front-end. What changes are needed? Thanks in advance! Link to comment Share on other sites More sharing options...
mr-fan Posted March 1, 2015 Share Posted March 1, 2015 @mats Awesome thank you very much for openstreetmap Version!! Best regards mr-fan Link to comment Share on other sites More sharing options...
bernhard Posted March 1, 2015 Share Posted March 1, 2015 @horst you can add such functionality to your map via google maps api. https://developers.google.com/maps/documentation/javascript/examples/infowindow-simple @Mats nice! @awebcreature i have no experience with this using google maps but using openlayers. of course that's quite a beast regarding complexity and file size - here you have an example: http://openlayers.org/en/v3.2.1/examples/draw-and-modify-features.html. you can also achieve that with the simpler framework leaflet - there are plenty of plugins like this one you would need I'm thinking to create such a module for my master thesis - but you are 2 years early, sorry maybe you find some helpful code in my processwire mapping project "geowire": http://geowire.org/ 1 Link to comment Share on other sites More sharing options...
Mats Posted March 1, 2015 Share Posted March 1, 2015 @awebcreature I have modified the MapMarker module so you can add a polyline (both admin and front-end). You can download it here: https://github.com/madebymats/FieldtypeMapMarkerDraw Please note that you should not use the module in production, but may give you an idea how to build the functionality you needed. 4 Link to comment Share on other sites More sharing options...
awebcreature Posted March 2, 2015 Share Posted March 2, 2015 Thanks, BernhardB and Mats! Very useful! Thanks again! Link to comment Share on other sites More sharing options...
Marco Angeli Posted March 11, 2015 Share Posted March 11, 2015 Hi there, this spectacular plugin works just fine, but I have two issues... 1) I can't set the zoom on my front-end map; this code won't work for me: $items = $pages->find("template=visite-detail, visite_map!='', sort=title"); $options = array('zoom' => '7', 'height' => '700px'); $map = $modules->get('MarkupGoogleMap'); echo $map->render($items, 'visite_map', $options); 2) looking at the rendered map you can see broken zoom controls, tested on a mac and on ubuntu (screenshot attached) Any suggestions? Link to comment Share on other sites More sharing options...
bernhard Posted March 11, 2015 Share Posted March 11, 2015 i have the same problem here: http://scw.zwergo.net/verein/sportplatz/ i think it comes from one of the jquery plugins but no time at the moment for further research... Link to comment Share on other sites More sharing options...
Mats Posted March 11, 2015 Share Posted March 11, 2015 The zoom controls doesn't work because of the css. Try this: #map_canvas_id img { max-width: none; } 5 Link to comment Share on other sites More sharing options...
bernhard Posted March 11, 2015 Share Posted March 11, 2015 you are absolutely right - how did you find this out? any way of debugging such things? Link to comment Share on other sites More sharing options...
Mats Posted March 11, 2015 Share Posted March 11, 2015 Stackoverflow http://stackoverflow.com/questions/7471830/google-maps-api-v3-weird-ui-display-glitches-with-screenshot 2 Link to comment Share on other sites More sharing options...
bernhard Posted March 11, 2015 Share Posted March 11, 2015 thanks - a pity that i didn't google for "weird UI display glitches (with screenshot)" 2 Link to comment Share on other sites More sharing options...
Marco Angeli Posted March 11, 2015 Share Posted March 11, 2015 @Mats: very clever, thanks. ...but still no luck with zoom settings: the rendered map doesn't change if I use zoom 1 or zoom 23... Link to comment Share on other sites More sharing options...
Mats Posted March 11, 2015 Share Posted March 11, 2015 If you change the zoom to an integer? $options = array('zoom' => 7, 'height' => '700px'); Link to comment Share on other sites More sharing options...
Marco Angeli Posted March 12, 2015 Share Posted March 12, 2015 Based on what Ryan said, the map automatically fits with all the markers: This module can accept a single Page or a PageArray. If given a PageArray it'll map them all and fit the map to the markers. If given a single page, it should still map the marker and use the zoom setting from that marker. That's good, I can live with that. UPDATE: sorted out. There's an option, fitToMarkers, true by default. Make this false and you're done. Here's the code: $items = $pages->find("template=visite-detail, visite_map!='', sort=title"); $options = array('fitToMarkers' => false); $map = $modules->get('MarkupGoogleMap'); echo $map->render($items, 'visite_map', $options); Now you can control your zoom via code or modifying your custom field in PW. Now just wondering how to enable the hover tooltip: it seems that it works randomly for me. Yes, I put a div with position: relative; outside the map. using: 'useHoverBox' => true prevents the map from showing. Does it work for you? Link to comment Share on other sites More sharing options...
iNoize Posted March 16, 2015 Share Posted March 16, 2015 Ive imported about 500 adresses. Now I have to open every page and click on the adress field to geocode right the adress. Its possible to do this via API ? http://prntscr.com/6hf9zx after click http://prntscr.com/6hfa3a Link to comment Share on other sites More sharing options...
LostKobrakai Posted March 16, 2015 Share Posted March 16, 2015 Judging from the module description I'd say it does not work. Batch geocoding is a payed service by most providers. The only one I found is MapQuest, which provides a batch api with up to 100 addresses per request, but still no parallel requests like it's the case for all other free services. Edit: Most likely such a thing would clash with the max_execution_time of php for most users. Type in a location or address into the "address" box for the map field. Then click outside of the address, and the Javascript geocoder should automatically populate the latitude, longitude and map location. The Google geocoder will accept full addresses or known location names. For instance, you could type in "Disney Land" and it knows how to find locations like that. Link to comment Share on other sites More sharing options...
bernhard Posted March 16, 2015 Share Posted March 16, 2015 thats not true, google maps geocoding api has a limit of 2.500 requests per day - so you are good here: https://developers.google.com/maps/documentation/geocoding/?hl=de#Limits will come back with a possible solution later... Link to comment Share on other sites More sharing options...
LostKobrakai Posted March 16, 2015 Share Posted March 16, 2015 thats not true, google maps geocoding api has a limit of 2.500 requests per day - so you are good here: https://developers.google.com/maps/documentation/geocoding/?hl=de#Limits.. Users of the free API: 2,500 requests per 24 hour period. 5 requests per second. …The Geocoding API may only be used in conjunction with a Google map; geocoding results without displaying them on a map is prohibited. So yeah, nope, it's not that easy. Also 5 requests/second would mean 100 seconds for 500 addresses, which is enough to exceed the 30 sec execution time of a standart php installation. For more details see here: https://developers.google.com/maps/documentation/geocoding/?hl=en#Limits (the german one isn't as detailed, but also has the part about using it with a visible map) Link to comment Share on other sites More sharing options...
bernhard Posted March 16, 2015 Share Posted March 16, 2015 never heard about the 5r/s limit - may be new, thanks for the hint... anyhow, never had any issues with it! but if anybody thinks he is violating google he could also use a free geocoding service (see example) i just tried <?php for ($i=1; $i <= 200; $i++) { $p = new Page(); $p->template = 'basic-page'; $p->parent = $pages->get('/'); // set parent to root $p->name = "Wagramer Strasse " . $i; $p->title = 'Wagramer Straße ' . $i; $p->map->address = 'Wagramer Straße ' . $i . ', Wien'; // populate the mapmarker field in basic-page template // optional: use any other geocoding service like mapquest should be very easy: // http://stackoverflow.com/questions/18661189/getting-data-from-json-using-mapquest-and-php $result = '...'; // then populate lat/lng manually $p->map->lat = $result->lat; $p->map->lng = $result->lng; $p->save(); } ?> and it worked without any problems. took some seconds of course... but if you only need to geocode the addresses once that should not be a problem. @iNoize how did you populate your address fields? 1 Link to comment Share on other sites More sharing options...
iNoize Posted March 16, 2015 Share Posted March 16, 2015 Thanks a lot. Ive importet already the adresses. <?php include("./index.php"); // bootstrap ProcessWire's API, if applicable // // // the example template and parent we will be using, change for your use $template = wire('templates')->get('city'); $parent = wire('pages')->get('/verkaufsstellen/de/'); // // get your file, read it into an array $archiveData and start to import it: // // here some (pseudo/example)code set_time_limit( intval(60 * 10) ); // give it 10 minutes, you may also increase this $completeurl = "http://myhxmlurl.de/map.xml"; $xml = simplexml_load_file($completeurl); foreach($xml as $node) { // create the new page to import $page = new Page(); $page->template = $template; $page->parent = $parent; $page->title = $node->Firma; $page->map->address = $node->StrasseNr.",".$node->Plz." ".$node->Ort; $page->save(); // testing echo 'id: '.$page->id.'<br/>'; echo 'path: '.$page->path; } // $t = Debug::timer(); // do some expensive code execution here // echo Debug::timer($t); How to renew the geocode without a new page ?? And have also trouble with the 'useHoverBox' => true options. maybe you have an 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