gosox116 Posted February 28, 2010 Report Share Posted February 28, 2010 Hi everyone, I am currently in the proccess of creating a new flight map that looks cleaner and nicer than the google one. It even automatically resizes just to show the routes that have been flown. To use it, I need to find a way to make a list of DEPICAO-ARRICAO,DEPICAO-ARRICAO,DEPICAO-ARRICAO,DEPICAO-ARRICAO. Example: KTPA-KMCO,KMCO-KMHT,KMHT-KMDW,KMDW-KLAS Then, I need to insert that info into an image tag. Example: <img src="http://www.gcmap.com/map?P=KTPA-KMCO,KMCO-KMHT,KMHT-KMDW,KMDW-KLAS&PM=pemr%3Adiamond7%2B%25U&MS=bm&DU=mi" border="0" title="Flight Map" alt="Flight Map" /> How can I go about calling up the info, putting in the KMCO-KTPA,KTPA-KMHT... format, and then inserting it into the image tag? I've tried this so far, but it's failed miserably. I'm terrible with PHP. <?php $pilots = PIREPData::getAllReportsForPilot($pilotid); foreach($pilots as $pilot) { print_r($pilot); } ?> Thanks for all of your help, Carl K. CEO of SWAVA.net Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted February 28, 2010 Administrators Report Share Posted February 28, 2010 How about -> <?php $pilots = PIREPData::getAllReportsForPilot(Auth::$userinfo->pilotid); foreach($pilots as $pilot) { echo $pilot->depicao.' - '.$pilot->arricao.'<br />'; } ?> That will give you something like -> KPQI - KBOS KBOS - KATL KORD - KDEN KDEN - KMSP KBUF - KBOS KBOS - KPHL KDEN - KMSP KORD - KDEN KOWD - KBDL KBOS - KACK KBOS - KLAX Quote Link to comment Share on other sites More sharing options...
gosox116 Posted March 1, 2010 Author Report Share Posted March 1, 2010 Cool, I changed it a bit, and now it works perfectly. Thanks sooo much! <?php $pilots = PIREPData::getAllReportsForPilot(Auth::$userinfo->pilotid); foreach($pilots as $pilot) { echo $pilot->depicao.'-'.$pilot->arricao.','; } ?> Sorry to sound so needy, but I have two more questions. (I've read the API guide but I still can't figure these things out on my own. Any ideas on places I can look to learn?) Question 1: How can I implement a similar code on the homepage, but instead, display the info in the same map format for the last 20 accepted (or preferably, accepted PIREPs in the past XX days) PIREPS on my website? Question 2: How can I implement a similar code on the PIREP Details Route_Map template, but instead, display the info in the same map format for the dep. and arr. ICAO associated to that PIREP? Thanks again!!! -Carl Quote Link to comment Share on other sites More sharing options...
hjhjhgjgjh Posted March 1, 2010 Report Share Posted March 1, 2010 sounds good what you do there.. if possible, could you make it to work for me, that a map is shown in the flight briefing section? then i could handover it to my crew briefing script Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted March 2, 2010 Administrators Report Share Posted March 2, 2010 Question 1: How can I implement a similar code on the homepage, but instead, display the info in the same map format for the last 20 accepted (or preferably, accepted PIREPs in the past XX days) PIREPS on my website? By count <?php $pireps = PIREPData::getRecentReportsByCount('20'); //20 = # of records foreach($pireps as $pirep) { echo $pirep->depicao.'-'.$pirep->arricao.','; } ?> By days <?php $pireps = PIREPData::getRecentReports('2'); // 2 = # of days foreach($pireps as $pirep) { echo $pirep->depicao.'-'.$pirep->arricao.','; } ?> Question 2: How can I implement a similar code on the PIREP Details Route_Map template, but instead, display the info in the same map format for the dep. and arr. ICAO associated to that PIREP? not sure what you mean here... the pirep route map shows the dep and arr already......... 1 Quote Link to comment Share on other sites More sharing options...
gosox116 Posted March 5, 2010 Author Report Share Posted March 5, 2010 Simpilot, Thanks a TON! I don't even know how I can thank you enough. As for #2, on the homepage, there are the 3 most recent PIREPs. If you click on one of the flight numbers, you see more details about the flight. At the bottom, it shows a route map. How can I get the code to display the dep ICAO-arr ICAO of the PIREP. Thanks! Carl Klinker Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted March 5, 2010 Administrators Report Share Posted March 5, 2010 Simpilot, Thanks a TON! I don't even know how I can thank you enough. As for #2, on the homepage, there are the 3 most recent PIREPs. If you click on one of the flight numbers, you see more details about the flight. At the bottom, it shows a route map. How can I get the code to display the dep ICAO-arr ICAO of the PIREP. Thanks! Carl Klinker If you look around in the rest of the template, it's probably there somewhere. IIRC, it's $pirep->depicao And arricao Quote Link to comment Share on other sites More sharing options...
Guest Brian Posted March 5, 2010 Report Share Posted March 5, 2010 Couldnt it be throw in as a Multidimensional Array? Atleast in VB is how you could do it. Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted March 6, 2010 Administrators Report Share Posted March 6, 2010 Couldnt it be throw in as a Multidimensional Array? Atleast in VB is how you could do it. Arrays have nothing to do with anything here. He just needs a string Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted March 6, 2010 Moderators Report Share Posted March 6, 2010 Back to basics this reminds me of Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted March 6, 2010 Administrators Report Share Posted March 6, 2010 I think what you are looking for shows up in the route_map.tpl view. The data for the map is being passed to that view using one of two variables depending on where the map is displayed, ($pirep or $schedule) $pirep is being used when looking at the flight details accessed from the frontpage. You should be able to get the data off that page with $pirep->arricao and $pirep->depicao. If you are trying to get the data from the db and use it in your own page you should use $mydata = PIREPData::getReportDetails($pirepid); The $priepid id the db id # of the prirep you are trying to get data for. Once you have that you can do a print_r($mydata); to see all the fields that are available, which are a ton including the aircraft data, airfields, pilot, etc... Hope this helps. Quote Link to comment Share on other sites More sharing options...
Jeff Posted June 23, 2010 Report Share Posted June 23, 2010 Okay... I can get the map to show on the front page with this: Example: <img src="http://www.gcmap.com/map?P=KTPA-KMCO,KMCO-KMHT,KMHT-KMDW,KMDW-KLAS&PM=pemr%3Adiamond7%2B%25U&MS=bm&DU=mi" border="0" title="Flight Map" alt="Flight Map" /> and under the map, I get this: KTPA-KMCO,KMCO-KMHT,KMHT-KMDW,KMDW-KLAS by using this code: <?php $pireps = PIREPData::getRecentReportsByCount('20'); //20 = # of records foreach($pireps as $pirep) { echo $pirep->depicao.'-'.$pirep->arricao.','; } ?> but, how can I get it to actually draw the lines on the map instead of it just showing the ICAO's under the map? Can you give me a step-by-step process for this please? This is on my home page of my site. click my badge to go there. Quote Link to comment Share on other sites More sharing options...
Jeff Posted June 23, 2010 Report Share Posted June 23, 2010 Here is how I have it in the frontpage_main.tpl <img src="http://www.gcmap.com/map" alt="" width="700" height="360" /> <?php $pireps = PIREPData::getRecentReportsByCount('20'); //20 = # of records foreach($pireps as $pirep) { echo $pirep->depicao.'-'.$pirep->arricao.','; } ?> Quote Link to comment Share on other sites More sharing options...
CPC900 Posted June 24, 2010 Report Share Posted June 24, 2010 But Jeff, how do you get the lines to show ON the map? It just shows a blank map with the flights listed in text underneath?! What is the point of the map?! Actually, wait....you are asking for that same thing, aren't you? Sorry. Quote Link to comment Share on other sites More sharing options...
Jeff Posted June 24, 2010 Report Share Posted June 24, 2010 But Jeff, how do you get the lines to show ON the map? It just shows a blank map with the flights listed in text underneath?! What is the point of the map?! That's what I was asking 3 posts up. I'd like to know how to get them to show the lines, because all it is showing is the ICAO codes with a blank map. Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted June 24, 2010 Report Share Posted June 24, 2010 Here you go <?php $flights = PIREPData::getRecentReportsByCount(10); $string = ""; foreach($flights as $flight) { $string = $string.$flight->depicao.'+-+'.$flight->arricao.',+'; } ?> <table> <tr> <th>LAST 10 FLIGHT LEGS</th> </tr> <tr> <td><p align="center"><img src="http://www.gcmap.com/map?P=<?php echo $string ?>&MS=bm&MR=240&MX=650x360&PM=pemr:diamond7:red%2b%22%25I%22:red&PC=%230000ff" /><br /> Maps generated by the <a href="http://www.gcmap.com/">Great Circle Mapper</a> - copyright © <a href="http://www.kls2.com/~karl/">Karl L. Swartz</a>.</p></td> </tr> </table> Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted June 24, 2010 Report Share Posted June 24, 2010 I should have commented on the above. It builds a string to insert into the URL image call. from the last 10 pireps that have been filed. Change the number in the () to change the amount of flights to display. The settings at the end of the URL are taken from the gcmap.com website. You can change it to look like you wish using these variables. Quote Link to comment Share on other sites More sharing options...
Jeff Posted June 24, 2010 Report Share Posted June 24, 2010 Jeff, I was hoping that you would see this, as I knew you would get it working for me. I appreciate your help bud, thank you so much. Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted June 24, 2010 Report Share Posted June 24, 2010 No problemo Happy to help. Quote Link to comment Share on other sites More sharing options...
CPC900 Posted June 24, 2010 Report Share Posted June 24, 2010 Yes, thanks again Jeff!!! Quote Link to comment Share on other sites More sharing options...
CrashGordon Posted June 26, 2010 Report Share Posted June 26, 2010 Depending on what page you place this, copyright © may get a question mark in a diamond displayed. It can be avoided by using copyright © in your code. Quote Link to comment Share on other sites More sharing options...
md82 Posted June 28, 2010 Report Share Posted June 28, 2010 got the map on my homepage, now I want to put the map in pilot profiles.. Whats the code so that it only shows that pilots last flights ? thanks! Quote Link to comment Share on other sites More sharing options...
CPC900 Posted September 14, 2010 Report Share Posted September 14, 2010 Sorry, but....what would I change to add an individual's map to their profile(profile_main.tpl) page? I want to show THEIR last number of flights there as well. Quote Link to comment Share on other sites More sharing options...
Wildone Posted April 3, 2014 Report Share Posted April 3, 2014 Hello guys, I have used the code from the previous page and implemented it in the pilot_public_profile.tpl so it displays the map of pilots flights. But I am struggling with a problem, namely when the pilot has not flown any flights just over the blank map image, the error message pop up: Warning: Invalid argument supplied for foreach() in .../pilot_public_profile.tpl on line 102 I have tried playing with a if function, but it doesnt work for me, or maybe I did it in wrong way. Can anyone help me to solve this problem? My code is: <table id="pilotmap" style="border-collapse:collapse; width:590px;"> <thead> <tr> <th style="width:100%">Last 10 flights</th> </tr> </thead> <tbody> <tr> <td> <?php $string = ""; foreach($pireps as $flight) { $string = $string.$flight->depicao.'+-+'.$flight->arricao.',+'; } ?> <p align="center"><img src="http://www.gcmap.com/map?P=<?php echo $string ?>%0D%0A&PM=b%3Asquare3%3Ablack%2B%22%25N%2213r%3Ablack&MS=wls&DU=mi" id="thumb" style="width:590px; height:360px;"/> <br /> Maps generated by the <a href="http://www.gcmap.com/">Great Circle Mapper</a> - copyright © <a href="http://www.kls2.com/~karl/">Karl L. Swartz</a>.</p></td> </tr> </tbody> </table> P.S. And one more thing, how do I make it to get the values of last 10 flights? Because in the original code from the previous page, there was such a line of code $flights = PIREPData::getRecentReportsByCount(10); but I did delete it. Cheers! Quote Link to comment Share on other sites More sharing options...
Wildone Posted April 18, 2014 Report Share Posted April 18, 2014 Anyone? Quote Link to comment 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.