![]() |
||
Geocache ClassThis class is contained in the file Geocache.inc.php and encapsulates a single geocache. It uses the class Waypoint.inc.php internally which itself use the OCFParser.inc.php and db-mysql.inc.php internally. Distance CalculationsGeoDistanceContext: GeocacheUsed for short distances under a few kilometersPlease note that this does not keep the earth radius in mind and assumes that the earth is flat which is okay for small distances which normally are found between multiple locations in a multi- or puzzle cache. This function returns the distance in kilometers or miles of both coordinates given. Return value Float $lat1, $long1 define the geographic coordinates of the first location. $lat2, $long2 define the geographic coordinates of the second location. $unit can be either "k" for kilometers or "m" for miles. Usage
$geocache->geoDistance($lat1, $long1, $lat2, $long2 [, $unit="k"])
Example
<?php
0.759055276494 km GreatCircleDistanceContext: GeocacheUsed for larger distancesReturn value Float $lat1, $long1 define the geographic coordinates of the first location. $lat2, $long2 define the geographic coordinates of the second location. $unit can be either "k" for kilometers or "m" for miles. Usage
$geocache->greatCircleDistance($lat1, $long1, $lat2, $long2 [, $unit="k"])
Example
<?php
0.758561474561 km GetRealWaypointsContext: GeocacheReturns all waypoints that are not parking waypointsOnly useful if used on multi- or puzzle caches. Return value Array of Geocache Waypoint objects. Usage
$geocache->getRealWaypoints()
Example
<?php
Puzzle #1 Puzzle #2 The Cache GetLinearDistancesContext: GeocacheReturns the distances between all waypoints that are not parking waypointsOnly useful if used on multi- or puzzle caches. Return value Array of float values. $unit can be either "k" for kilometers or "m" for miles. Usage
$geocache->getLinearDistances([$unit="k"])
Example
<?php
The distance between waypoint #1 and #2 is 4.61511361456 km The distance between waypoint #2 and #3 is 6.88085775201 km GetHikeLengthContext: GeocacheReturns the complete length of the hike between all waypoints that are not parking waypointsOnly useful if used on multi- or puzzle caches. Return value Float value: distance in kilometers or miles. $unit can be either "k" for kilometers or "m" for miles. Usage
$geocache->getHikeLength([$unit="k"])
Example
<?php
The complete hike length is 11.4959713666 km File exportsendOCFContext: GeocachePrompts the user to download the OCF file containing the data of the given geocache.This function send specific headers prompting the user to download the file instead of directly displaying it in the browser. The filename automatically used by the browser can be defined by the optional parameter. Please note: You must not output any characters before or after this functions is called so if your script does not have to do anything else after this function is called you can safely exit here. Return value none $filename is the filename to be displayed as default value when the user downloads the file. Usage
$phpgc->sendOCF([$filename="geocache.ocf"])
Example
<?php
sendKMLContext: GeocachePrompts the user to download the KML file containing the data of the given geocache.This function send specific headers prompting the user to download the file instead of directly displaying it in the browser. The filename automatically used by the browser can be defined by the optional parameter. As the KML format does not support most of the geocache data the export only includes the name, title and the coordinates of the given geocache. Further information: The KML format ("Keyhole Markup Language") is the file format used by Google Earth. KML documentation Please note: You must not output any characters before or after this functions is called so if your script does not have to do anything else after this function is called you can safely exit here. Return value none $filename is the filename to be displayed as default value when the user downloads the file. Usage
$phpgc->sendKML([$filename="geocache.kml"])
Example
<?php
sendGPXContext: GeocachePrompts the user to download the GPX file containing the data of the given geocache.This function send specific headers prompting the user to download the file instead of directly displaying it in the browser. The filename automatically used by the browser can be defined by the optional parameter. As the GPX format does not support most of the geocache data the export only includes the name, title, url and the coordinates of the given geocache. Further information: The GPX format ("GPS Exchange Format") is a light-weight XML data format for the interchange of GPS data (waypoints, routes, and tracks) between applications and Web services on the Internet. GPX documentation Please note: You must not output any characters before or after this functions is called so if your script does not have to do anything else after this function is called you can safely exit here. Return value none $filename is the filename to be displayed as default value when the user downloads the file. Usage
$phpgc->sendGPX([$filename="geocache.gpx"])
Example
<?php
sendLOCContext: GeocachePrompts the user to download the LOC file containing the data of the given geocache.This function send specific headers prompting the user to download the file instead of directly displaying it in the browser. The filename automatically used by the browser can be defined by the optional parameter. As the LOC format does not support most of the geocache data the export only includes the name and the coordinates of the given geocache. Further information: The LOC format is the original download format for the search results page on Geocaching.com. Please note: You must not output any characters before or after this functions is called so if your script does not have to do anything else after this function is called you can safely exit here. Return value none $filename is the filename to be displayed as default value when the user downloads the file. Usage
$phpgc->sendLOC([$filename="geocache.loc"])
Example
<?php
getOCFContext: GeocacheCreates OCF code containing all data of the given geocacheThe OpenCacheFormat (OCF) is currently the only format that allows for the complete data of a single geocache to be exported and imported in XML. Further information: The OpenCacheFormat (OCF) is a completely free XML schema definition. More information is available on the SourceForge.net project page. Return value String Usage
$phpgc->getOCF()
Example
<?php
<?xml version="1.0" encoding="iso-8859-1"?> <ocf xmlns="http://opencacheformat.sourceforge.net/xsd/1.0"> <version>1.0</version> <date>2006-05-29 17:39:15</date> <caches> <cache> <srcid>1</srcid> <name>GCVXFF</name> <src>GEOCACHING.COM</src> <lang>de</lang> <owner>cscout</owner> <placed>2006-05-07</placed> <logurl>http://www.geocaching.com/seek/cache_details.aspx?guid=51b7aaa1-e879-42e5-b763-81c051bbba55</logurl> <url>http://www.geocaching.com/seek/cache_details.aspx?guid=51b7aaa1-e879-42e5-b763-81c051bbba55</url> <type>traditional</type> <size>small</size> <title>GCVXFF</title> <country>de</country> <state>nrw</state> <city>Haltern am See</city> <long>7.18574</long> <lat>51.7064</lat> <difficulty>2</difficulty> <terrain>4</terrain> <description><![CDATA[Der Cache befindet sich an einer Kreuzung von einigen Wegen mitten im Wald. <br>Dieser Cache eignet sich auch gut in Verbindung mit <a href= "http://www.geocaching.com/seek/cache_details.aspx?wp=gcvada" target="_blank">Gotteshäuser: Heilig Kreuz - Haltern am See</a>. <br> <br> Ich würde auf jeden Fall jedem den Spoiler empfehlen.]]></description> <waypoints> <waypoint> <pointtype></pointtype> <name></name> <title></title> <description></description> <long></long> <lat></lat> </waypoint> <waypoint> <pointtype>cache</pointtype> <name>FINAL</name> <title>Der Cache</title> <description>Hier befindet sich der Cache.</description> <long>7.18573</long> <lat>51.7064</lat> </waypoint> </waypoints> <attributes> <attribute name="wheelchair" value="1"/> <attribute name="parking" value="1"/> <attribute name="stroller" value="1"/> <attribute name="stealth" value="1"/> <attribute name="dogs" value="1"/> <attribute name="bicycles" value="1"/> <attribute name="horses" value="1"/> <attribute name="kids" value="1"/> <attribute name="short" value="1"/> <attribute name="247" value="1"/> </attributes> </cache> </caches> </ocf> getKMLContext: GeocacheCreates KML code containing data of the given geocacheAs the KML format does not support most of the geocache data the export only includes the name, title and the coordinates of the given geocache. Further information: The KML format ("Keyhole Markup Language") is the file format used by Google Earth. KML documentation Return value String Usage
$phpgc->getKML()
Example
<?php
<?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://earth.google.com/kml/2.0"> <Placemark> <description>Haardliner</description> <name>GCVXFF</name> <LookAt> <longitude>7.18574</longitude> <latitude>51.7064</latitude> </LookAt> <visibility>0</visibility> <Point> <altitudeMode>relativeToGround</altitudeMode> <coordinates>7.18574,51.7064,50</coordinates> </Point> </Placemark> </kml> getGPXContext: GeocacheCreates GPX code containing data of the given geocacheAs the GPX format does not support most of the geocache data the export only includes the name, title, url and the coordinates of the given geocache. Further information: The GPX format ("GPS Exchange Format") is a light-weight XML data format for the interchange of GPS data (waypoints, routes, and tracks) between applications and Web services on the Internet. GPX documentation Return value String Usage
$phpgc->getGPX()
Example
<?php
<gpx version="1.1" creator="OCFConverter"> <metadata> <desc>GCVXFF</desc> <link href="http://www.geocaching.com/seek/cache_details.aspx?guid=51b7aaa1-e879-42e5-b763-81c051bbba55"/> <keywords>geocache</keywords> </metadata> <wpt lat="51.7064" long="7.18574"> <name>GCVXFF</name> <desc>Haardliner</desc> <sym>GEOCACHE</sym> <type>GEOCACHE</type> </wpt> </gpx> getLOCContext: GeocacheCreates LOC code containing data of the given geocacheAs the LOC format does not support most of the geocache data the export only includes the name, title, url and the coordinates of the given geocache. Further information: The LOC format is the original download format for the search results page on Geocaching.com. Return value String Usage
$phpgc->getLOC()
Example
<?php
<?xml version="1.0" encoding="UTF-8"?> <loc version="1.0" src="OCF"> <waypoint> <name id="GCVXFF">Haardliner</name> <coord lat="51.7064" lon="7.18574"/> <type>Geocache</type> <link text="Cache Details">http://www.geocaching.com/seek/cache_details.aspx?guid=51b7aaa1-e879-42e5-b763-81c051bbba55</link> </waypoint> </loc> » Using PHPGeocache » Extending PHPGeocache » PHPGeocache class » Geocache class » Waypoint class » GeocacheDB class »Google Maps API Mashup » API documentation Geocache
|
||
