Set 11: Mashups (emphasis on Google tools) IT452 Advanced Web and Internet Systems.

Slides:



Advertisements
Similar presentations
Surrey Libraries Computer Learning Centres January 2012 Internet Searching Teaching Script Totally New to Computers Internet Searching.
Advertisements

WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
JQUERY/AJAX ALIREZA KHATAMIAN DELARAM YAZDANSEPAS.
Google Maps API. Today’s Objectives Get Google Maps working: desktop + mobile Get clustering data complete, data onto a map.
L. Grewe. YQL – what is it Yahoo! Query Language.
Point Mashups Peterson. Icons Info Marker Random Points.
CHAPTER 26 CREATING LOCATION-AWARE WEBPAGES USING GEOLOCATION.
11 Using the Google Maps API. 2 Objectives You will be able to Use the Google Maps API to display a map of any location on an HTML page. Programatically.
More APIs: Web Services CMPT 281. Announcements Project milestone Lab: – Web services examples.
Create Your Own Webpage. Today’s Agenda Cut & paste code Notepad++ or Notepad at home FTP Web Hosting Wordpress.
Set 5: Web Development Toolkits IT452 Advanced Web and Internet Systems.
1 ‘Dynamic’ Web Pages So far, we have developed ‘static’ web-pages, e.g., cv.html, repair.html and order.html. There is often a requirement to produce.
Writing All Your Code In OpenEdge Architect Peter van Dam.
1 HTML and CGI Scripting CSC8304 – Computing Environments for Bioinformatics - Lecture 10.
GIS technologies and Web Mapping Services
Chapter 16 The World Wide Web Chapter Goals ( ) Compare and contrast the Internet and the World Wide Web Describe general Web processing.
Chapter 16 The World Wide Web Chapter Goals Compare and contrast the Internet and the World Wide Web Describe general Web processing Describe several.
Server-side Scripting Powering the webs favourite services.
Lirida Kerçelli Ayşe Sezer The Google AJAX Search API.
JavaScript, Fourth Edition Chapter 12 Updating Web Pages with AJAX.
Programming games Examples: Audio example. Google Maps api. Classwork: show more complex video. Classwork/Homework: Find place (lat and long) for basic.
Google Maps API. Static Maps send an HTTP GET request receive an image (PNG, GIF, JPEG) no javascript needed encode params in URL example:
HOW WEB SERVER WORKS? By- PUSHPENDU MONDAL RAJAT CHAUHAN RAHUL YADAV RANJIT MEENA RAHUL TYAGI.
Tutorial 1: Browser Basics.
The Internet TCIP/IP  TCP/IP stands for Transmission Control Protocol/Internet Protocol, which is a set of networking protocols that allows two or more.
Lesson 1 What Is the World Wide Web?. Objectives Upon completion of this lesson, you should be able to: Explain what the World Wide Web is and how it.
Enabling High-Quality Printing in Web Applications
JavaScript – Quiz #9 Lecture Code:
Cross Site Integration “mashups” cross site scripting.
MIS 424 Professor Sandvig. Overview  Why Analytics?  Two major approaches:  Server logs  Google Analytics.
Technical Workshops | Esri International User Conference San Diego, California Supporting High-Quality Printing in Web Applications with ArcGIS 10.1 for.
Mashups Damon Hearne
Dr. Martin Zhao Sept 4, Topics HTML and related tutorials on w3schools.com Related HTML tags Adding interesting features using JavaScript What is.
Information Retrieval and Web Search Crawling in practice Instructor: Rada Mihalcea.
1 CSC160 Chapter 7: Events and Event Handlers. 2 Outline Event and event handlers onClick event handler onMouseOver event handler onMouseOut event handler.
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Intermediate Perl Programming Class Three Instructor:
JQuery and AJAX WEB Technologies : PHP Programming Language.
5 Copyright © 2010, Oracle and/or its affiliates. All rights reserved. Other Administrator Tasks.
Implementation of Google Map in Drupal Create in Miyula Zeng, XiaoHang Zou,
Don McGregor Research Associate MOVES Institute
Mapping Like Google Edward Svirsky Presented by Mark Scheel.
ArcGIS Server Overlays. The “REST” endpoint, v 9.3 or higher: …ArcGIS/rest/servicesArcGIS/rest/services.
Mashups in the JavaServer Faces World Ed Burns Hazem Saleh.
AJAX CS456 Fall Examples Where is AJAX used? Why do we care?
Google Map API The Google Maps API lets you embed Google Maps in your own web pages with JavaScript The API provides a number of utilities for manipulating.
Mashups for the Nontechies: Yahoo! Pipes Jody Condit Fagan Digital Services Librarian James Madison University
Internet Explorer. 2 Menu bar Command bar Back & forward buttons Search bar (type word or phrases )
CONTACTING OTHER SERVERS.
GEOVISUALIZATION: VISUALIZE THAT ON A MAP Sarah G. Park April 14, 2016.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
NCCUCS 軟體工程概論 Lecture 5: Ajax, Mashups April 29, 2014.
My school map mashup Ave Wrigley. Why? Ofsted.
Creating Databases Example using Google Maps API + file creation. Dollar sign problem. Classwork/Homework: [catch up]. Work on final project.
Google Maps API. Contents: 1. Google Maps API Key 2. Create a Basic Google Map 3. Google Maps Overlays 4. Google Maps Events 5. Google Maps Controls 6.
1 Bus Tracker A Google Maps Application. 22 Objectives You will be able to Add an icon to a map created with the Google Maps API. Use Ajax techniques.
Lesson 11: Web Services and API's
ISC440: Web Programming 2 Web APIs Google Maps API
Weebly Elements, Continued
Web Services application that operates over a network
CHAPTER 9 APIS. CHAPTER 9 APIS WHAT IS AN API?
Lesson 11: Web Services & API's
Getting web pages First we need to get the webpage by issuing a HTTP request. The best option for this is the requests library that comes with Anaconda:
IST256 : Applications Programming for Information Systems
Lesson 11: Web Services and API's
MIS JavaScript and API Workshop (Part 3)
Chapter 16 The World Wide Web.
Ajax and JSON Jeremy Shafer Department of MIS Fox School of Business
Client-Server Model: Requesting a Web Page
Ajax and JSON Jeremy Shafer Department of MIS Fox School of Business
CGI II: Cookies & Stuff Web Programming.
Presentation transcript:

Set 11: Mashups (emphasis on Google tools) IT452 Advanced Web and Internet Systems

Examples Student examples For more info: –Maps : h ttp://developers.google.com/maps/documentation/javascripth ttp://developers.google.com/maps/documentation/javascript –Search:

Why Mashup? Add better UI to the data Combine multiple sources of data Both

Where is the data from? Web service –Accessed directly via REST/SOAP –Accessed via JS library –Accessed via a feed (RSS etc.) Screen scraping –Simply “GET” a webpage, and it returns the HTML text. Use Perl to search/filter the content you need.

A Basic Map Google Maps JavaScript API Example <!— var map; function initialize() { var myOptions = { zoom: 8, center: new google.maps.LatLng( ,-76.49), mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById('map'), myOptions); } google.maps.event.addDomListener(window, 'load', initialize); --> Visit Google’s API for all options! developers.google.com/maps/documentation/javascript

Map with Address Lookup intranet.cs.usna.edu/~nchamber/it452/examples/google/map2.html

Map with Address Lookup (JS) How do we lookup an address and put it on the map? // Create a google geocoder object var geocoder = new google.maps.Geocoder(); // Call their geocode function (ajax) with an address geocoder.geocode( {address: “17 Main St”}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { var latlon = results[0].geometry.location; } });

Map with Address Lookup (JS) var map; var currentCenter; var geocoder; // Almost the same as before. function initialize() { geocoder = new google.maps.Geocoder();... } // Move map to given location. function moveMap() { var addr = document.getElementById("myaddr").value; geocoder.geocode( {address: addr}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); map.setZoom(12); var marker = new google.maps.Marker({ map: map, // current map object position: results[0].geometry.location }); } else { alert("Geocode not successful: " + status); } }); }

Markers on a Map var ii = 0; var addresses = [ "50 west street, annapolis md", "132 dock street, annapolis md", "2002 annapolis mall, annapolis md" ]; function drop() { ii = 0; for (var xx = 0; xx < addresses.length; xx++) setTimeout(addNextMarker, xx * 200); } function addNextMarker() { addMarkerAddress(addresses[ii++]); } Drop Markers

Markers on a Map 1.Send Google an address. 2.Receive the lat/lon coordinates. 3.Create a marker at that location. function addMarkerAddress(addr) { geocoder.geocode( { 'address': addr}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { var marker = new google.maps.Marker({ map: map, // current map object position: results[0].geometry.location, animation: google.maps.Animation.DROP }); } else alert("Geocode not successful: " + status); }); }

Directions on a Map var map; var directionDisplay; var directionsService = new google.maps.DirectionsService(); // Create the map, set at static lat/lon position. function initialize() {... map init... // Initialize the directions object. directionsDisplay = new google.maps.DirectionsRenderer(); directionsDisplay.setMap(map); directionsDisplay.setPanel(document.getElementById("route")); } // Use the directions service API. function getDirections() { var start = "121 Blake Road Annapolis, MD 21402"; var end = document.getElementById("myaddr").value; var request = { origin:start, destination:end, travelMode: google.maps.DirectionsTravelMode.DRIVING }; directionsService.route(request, function(response, status) { if (status == google.maps.DirectionsStatus.OK) directionsDisplay.setDirections(response); }); } intranet.cs.usna.edu/~nchamber/it452/examples/google/map-directions.html

Search on your Site Google Custom Search Element API Example <!-- 1. Create a "custom search engine" using your own google account. You can specify individual subsets of websites to search, or "all web" in preferences Custom Search API --> google.load('search', '1'); google.setOnLoadCallback(function() { var customSearchOptions = {}; var customSearchControl = new google.search.CustomSearchControl(‘XXXXXX', customSearchOptions); customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET); customSearchControl.draw('results'); }, true); Loading... Search box and results.

Yelp + Google Mashup? intranet.cs.usna.edu/~nchamber/it452/examples/google/searchYelp.html Results Taco Bell California Tortilla Toro Bravo Macho Taco Chipotle …

Yelp + Google Mashup? <!-- var map; // Create the map, set at static lat/lon position. function initialize() { var myOptions = { zoom: 8, center: new google.maps.LatLng( ,-76.49), mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById("map"), myOptions); } // Setup your Ajax settings.... // Display the results on the page >

Yelp + Google Mashup? <!-- var map; // Create the map, set at static lat/lon position.... // Setup your Ajax settings. function getFood() { // Setup your Ajax settings. var ajaxSettings = { type: "GET", url: "yelp.pl?query=" + $('#eat').val(), success: printFood, error: function(xhr, status, error) { alert("error: " + error); } }; // Make the call. $.ajax(ajaxSettings); } // Display the results on the page. function printFood(data) { $('#results').append(" Your Results "); var eateries = data.split("\n"); for( var ii = 0; ii < eateries.length; ii++ ) { $('#results').append(" " + eateries[ii] + " ").css("color","blue"); } -->

Yelp + Google Mashup (Perl) #!/usr/bin/perl use CGI ":standard"; use strict; use LWP::Simple "!head"; use LWP::UserAgent; use use use Net::OAuth; # OAuth help! use POSIX; # rounding use JSON; # JSON processing my $terms = param("query"); if( !$terms || $terms =~ /undef/ ) { exit; } print "Content-Type: text/plain; charset=UTF-8\n\n"; # My Yelp Keys my $consumerKey = "iQ_2W5fPGiRiygGkEnp_RQ"; my $consumerSecret = "K-KsBVjZYYCELCSoIMjEwBN95_w"; my $token = "5M6DCKhMN174yFMkXs9_4x0nbCr-s-7-"; my $tokenSecret = "CQwsoXiAxuHL6PG9VDT4GiJ35dI"; my $randomChars = "abcd". floor(rand()* ); # We need to send the current time, but Yelp's servers are ~8 minutes ahead of us. my $time = time() + 8*60;

# Build the OAuth request! my $request = Net::OAuth->request('protected resource')->new( consumer_key => $consumerKey, consumer_secret => $consumerSecret, token => $token, token_secret => $tokenSecret, request_url => ' request_method => 'GET', signature_method => 'HMAC-SHA1', timestamp => $time, nonce => $randomChars, extra_params => {'term' =>$terms, 'location' =>"Annapolis MD"} ); my $ua = LWP::UserAgent->new; $request->sign; # Make the HTTP GET request. my $res = get($request->to_url); # Put the text into a JSON object. my $json = new JSON; my $json_text = $json->allow_nonref->utf8->relaxed->decode($res); # Read the business names from the JSON! for( my $ii = 0; $ii {businesses}}; $ii++ ) { print $json_text->{businesses}[$ii]->{name}. "\n"; } (Perl continued)

What did I leave out? Put Yelp details on the map –Use Yelp addresses to create markers on the map? –Use Yelp stars to select different marker images? What kind of google tools, markers, etc. are there? – pt/referencehttps://developers.google.com/maps/documentation/javascri pt/reference Don’t have to use Yelp! –Lots of websites, lots of data formats. –Screen scrape…just GET a webpage and use regular expressions.