Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Modified the test_osm

  • Loading branch information...
commit 08ef2d4c811019f8ae3e8bf5d370a9acdd1d881c 1 parent 8eb4ea7
@Buddhima Buddhima authored buddhima committed
Showing with 114 additions and 119 deletions.
  1. +114 −119 test_osm.php
View
233 test_osm.php
@@ -1,119 +1,114 @@
-<?php
-// We are a valid Joomla entry point.
-define('_JEXEC', 1);
-
-// Setup the base path related constant.
-define('JPATH_BASE', dirname(__FILE__));
-
-// Maximise error reporting.
-error_reporting(E_ALL);
-ini_set('display_errors', 1);
-
-// Bootstrap the application.
-require dirname(__FILE__).'/tests/bootstrap.php';
-
-class OsmApp extends JApplicationWeb
-{
- /**
- * Display the application.
- */
- function doExecute(){
- $key = "8DVVqjUxRiruXsMYZegClYbWODIMoKZxLl8w9pXR";
- $secret = "HvZkpFOsyq9oD7GEHYASyRgzKasRAMsvQ53Qb483";
-// $key = "9o2s3leTWNqLhg4NvBguBR2fT4M8Q7nYSORwRP0W";
-// $secret = "ZJrLaPyu3gANBDVH5v2x5Heiw04t4cybquFvNTSb";
-
- $option = new JRegistry;
- $option->set('consumer_key', $key);
- $option->set('consumer_secret', $secret);
- $option->set('sendheaders', true);
-
- $oauth = new JOpenstreetmapOauth($option);
-
-
- //$access_token = array('key' => '617544537-uMhDHjkCPGbgsb8NASkyWOfQj6wkIGWNjtZOIxDX', 'secret' => 'x9VpWp0tGK7q7lIlTyij7c0kfpRKWEWNJo2daPqHU8');
- //$oauth->setToken($access_token);
-
- // $new_token = $oauth->authenticate();
-
-// $oauth->setToken($new_token);
-
- $oauth->authenticate();
- $osm=new JOpenstreetmap($oauth);
-// $osm=new JOpenstreetmap();
- $changeset= $osm ->changesets;
- //$result = $changeset -> readChangeset($oauth, '14153877');
-
- //print_r($result);
- //echo '<br />';
-
- $element=$osm->elements;
- //$result= $element->createNode($oauth, '1', '34', '54', array("A"=>"Apple","B"=>"Ball"));
-
- $gps=$osm->gps;
-
- $changesets = array
- (
-// array
-// (
-// "A"=>"Apple",
-// "B"=>"Ball",
-// "c"=>"Call"JTwitterPlaces
-// ),
-// array
-// (
-// "B"=>"Ball"
-// ),
- array
- (
- "comment"=>"my changeset comment",
- "created_by"=>"JOSM/1.0 (5581 en)"
- ),
- array
- (
- "A"=>"Apple",
- "F"=>"Apple",
- "B"=>"Ball"
- )
- );
-
-// $result = $changeset ->createChangeset($changesets);
-// $result = $changeset ->updateChangeset($oauth, '14153877',array("C"=>"Cat","D"=>"Dogs"));
- //$result = $changeset ->closeChangeset($oauth, '14153877');
- //$result = $changeset -> readChangeset($oauth, '14153877');
-// $result=$element->createNode($oauth, '14153708', '5.5', '6.7', array("C"=>"Cat","D"=>"Dogs"));
-// print_r($result);
- echo '$$$$<br />';
-// $result = $changeset -> readChangeset('10');
- print_r($result);
- echo '<br />';
-// $result=$element->readElement($oauth, 'node', '2050021859');
- $result=$element->readElement('node', 123);
- print_r($result);
-
- //$result = $changeset ->updateChangeset($oauth, '1',$tags);
-
-// print_r($result);
-// echo '<br />';
-
-// $node_list=array(array(4,5),array(6,7));
-// $result = $changeset ->expandBBoxChangeset($oauth,'1',$node_list);
-// print_r('DDDDPPPPP');
- //print_r($new_token);
- $result =$gps->downloadTraceMetadetails('1370260','bswije','buddhima');
- print_r($result);
-
- }
-}
-
-$web = JApplicationWeb::getInstance('OsmApp');
-JFactory::$application = $web;
-
-$session = JFactory::getSession();
-if($session->isActive() == false){
- $session->initialise(JFactory::getApplication()->input);
- $session->start();
-}
-
-// Run the application
-$web->execute();
+<?php
+/**
+ * An example JOpenstreetmap application built on the Joomla Platform.
+ *
+ * To run this example, copy or soft-link this folder to your web server tree.
+ *
+ * @package Joomla.Examples
+ * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE
+ */
+
+// We are a valid Joomla entry point.
+define('_JEXEC', 1);
+
+// Setup the base path related constant.
+define('JPATH_BASE', dirname(__FILE__));
+
+// Maximise error reporting.
+error_reporting(E_ALL);
+ini_set('display_errors', 1);
+
+// Bootstrap the application.
+require dirname(__FILE__) . '/tests/bootstrap.php';
+
+/**
+ * An example JApplicationWeb application class.
+ *
+ * @package Joomla.Examples
+ * @since 12.3
+ */
+class OsmApp extends JApplicationWeb
+{
+ /**
+ * Display the application.
+ *
+ * @return void
+ */
+ function doExecute()
+ {
+
+ // Provide the key and secret obtained from Open Street Map account
+ $key = "8DVVqjUxRiruXsMYZegClYbWODIMoKZxLl8w9pXR";
+ $secret = "HvZkpFOsyq9oD7GEHYASyRgzKasRAMsvQ53Qb483";
+
+ // Create a new Jregistry to store key and secret
+ $option = new JRegistry;
+ $option->set('consumer_key', $key);
+ $option->set('consumer_secret', $secret);
+ $option->set('sendheaders', true);
+
+ // Oauth authentication purposes
+ $oauth = new JOpenstreetmapOauth($option);
+
+ $oauth->authenticate();
+
+ // Create a new base object with authentication
+
+ $osm = new JOpenstreetmap($oauth);
+
+ // A new base object without authentication
+ // $osm=new JOpenstreetmap();
+
+ // New changeset object obtained
+ $changeset = $osm ->changesets;
+
+ // New element object obtained
+ $element = $osm->elements;
+
+ // New gps object obtained
+ $gps = $osm->gps;
+
+ $changesets = array
+ (
+ "comment" => "my changeset comment",
+ "created_by" => "JOSM/1.0 (5581 en)"
+ );
+
+ // Creates a new changeset
+ $result = $changeset ->createChangeset($changesets);
+
+ // Prints the number of newly created changeset
+ print_r($result);
+ echo '<br />';
+
+ // Reads the 'node' with id = 123
+ $result = $element->readElement('node', 123);
+
+ // Prints the detail about the node read
+ print_r($result);
+ echo '<br />';
+
+ // Download Metadetails of a trace
+ $result = $gps->downloadTraceMetadetails('1370260', 'username', 'password');
+
+ // Prints the downloaded metadetails
+ print_r($result);
+ echo '<br />';
+
+ }
+}
+
+$web = JApplicationWeb::getInstance('OsmApp');
+JFactory::$application = $web;
+
+$session = JFactory::getSession();
+
+if ($session->isActive() == false)
+{
+ $session->initialise(JFactory::getApplication()->input);
+ $session->start();
+}
+
+// Run the application
+$web->execute();
Please sign in to comment.
Something went wrong with that request. Please try again.