Texan78 Posted October 25, 2016 Share Posted October 25, 2016 Hello, I am working on a small project and looking for some suggestions on what would be a practical and best way to approach this. I am not proficient at all in javascript and dread working with Google Maps. Here is what I am trying to do. I have a live streaming platform which has about 6 users. All the data I.E. lat/long, heading, geolocation etc is stored in a MySQL DB. The cords are inserted into the DB by a GPS client that is installed on the streamers computer that sends and updates the DB. All that is completed and works perfectly well and great there. What I need to do now is take that data from the DB and plot the users location on map via the cords in the DB but, since they are also constantly moving at times I need for the markers to refresh every X minutes or seconds and on mouseover on the marker show some other details like their name and geolocation which is also stored in the DB. There is a heading field and I have markers for that I need to convert to cardinal direction to display the correct heading icon. I have created a script that connects to the DB and returns a JSON response. What would be the best and easiest way to approach this? Use the JSON file or just use PHP to connect to the DB and create the variables to insert on the map? What is tricky about this is it is fully dynamic so I need some guidance on how to approach this as my Google search hasn't been very successful up to this point. The markers will only be plotted if a certain field in the table is returned as true. If it is true, then plot the marker from the cords in the DB and in the infobox show the other details I.E. Name, Geolocation, etc. One of the things I am struggling with on how to approach this is how to pull all the associated data for a certain user to creating the dynamic marker and infobox details dynamically triggered off a certain field in the DB. If anyone has any suggestions or guidance on how to approach this I would be greatly appreciative. I tried to hire someone to do this part of this small project but had a hard time finding someone that was interested so looks like I will have to do this myself. -Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/302408-plotting-dynamic-markers-from-mysql-db-in-google-maps/ Share on other sites More sharing options...
Barand Posted October 25, 2016 Share Posted October 25, 2016 see https://developers.google.com/maps/documentation/javascript/markers and also this topic https://forums.phpfreaks.com/topic/302364-need-help-to-clear-concept-of-google-maps-integration-in-php/?do=findComment&comment=1538471 Quote Link to comment https://forums.phpfreaks.com/topic/302408-plotting-dynamic-markers-from-mysql-db-in-google-maps/#findComment-1538617 Share on other sites More sharing options...
Texan78 Posted October 28, 2016 Author Share Posted October 28, 2016 Thanks, I have read through the Google Maps docs before. That would be useful for static markers but it doesn't help when it comes to dynamic markers and plotting more than one. Also no information on plotting markers from a DB or using JSON triggered off the value of a variable. Looking for suggestions. -Thanks Quote Link to comment https://forums.phpfreaks.com/topic/302408-plotting-dynamic-markers-from-mysql-db-in-google-maps/#findComment-1538707 Share on other sites More sharing options...
Barand Posted October 29, 2016 Share Posted October 29, 2016 Also no information on plotting markers from a DB or using JSON triggered off the value of a variable. You didn't look at the code samples in that thread then? Quote Link to comment https://forums.phpfreaks.com/topic/302408-plotting-dynamic-markers-from-mysql-db-in-google-maps/#findComment-1538710 Share on other sites More sharing options...
Texan78 Posted October 30, 2016 Author Share Posted October 30, 2016 You didn't look at the code samples in that thread then? There is only one code sample which is on post 7 and it didn't apply to what I am trying to accomplish nor was it useful? Quote Link to comment https://forums.phpfreaks.com/topic/302408-plotting-dynamic-markers-from-mysql-db-in-google-maps/#findComment-1538776 Share on other sites More sharing options...
Barand Posted October 30, 2016 Share Posted October 30, 2016 The attached php files in reply #5 do exactly what you said you want to do - retrieve from db and add map markers via json data. Quote Link to comment https://forums.phpfreaks.com/topic/302408-plotting-dynamic-markers-from-mysql-db-in-google-maps/#findComment-1538780 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.