rss news feed

related to google map nd rss feed news

Page 1 of 1

2 Replies - 1012 Views - Last Post: 13 April 2010 - 04:16 AM

#1 annakhan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 11-April 10

rss news feed

Posted 11 April 2010 - 11:12 AM

Hi ..plz can any one help me or guide me...
m working on my final project which is related to rss feeds
and i want to display rss news in google map info window..
can any one plzzzzzzzzzz guide me how can i do too urgent..:(
Is This A Good Question/Topic? 0
  • +

Replies To: rss news feed

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4914
  • View blog
  • Posts: 13,303
  • Joined: 18-April 07

Re: rss news feed

Posted 11 April 2010 - 03:38 PM

Well, first you need to gather the required information to build everything together. So to help you do that I have found the following link which describes how you go about creating an Info Window for a Google map. Each GMap2 object has an associated info window. You can only have one info on the map at any one time, but you can move it around and such. The link below will tell you more plus provide a demo...

Google Maps API - Info Windows

Now that you have got the info to show you how to create an Info Window, you need to find some RSS feed sources. That part is easy and many of them are found on the web. You can even find some right here on DIC.

Last part you need depends on your programming language of choice. If you are into PHP you can code up a script which reads the RSS, parses it into a news headline and then pass it to a document.createTextNode call on the Info Window to display it. But keep in mind that you also need a point of reference on the map. So besides having a RSS news header like "DIC tells n00bs 'You are not alone'" you also need to associate a place on the globe from where the headline occurs. An appropriate spot might be from the middle of Albuquerque New Mexico USA (where DIC's very own webmaster is from).

So I suggest you read up on how to use a server side programming language to connect to remote sites and pull in RSS news feeds. Once you get that part working, passing a headline to a page's javascript is pretty straight forward...

Inside a PHP page you print the headline in the map javascript...

var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
map.openInfoWindow(map.getCenter(), document.createTextNode("<?php echo "$newsheadline"; ?>")); 

Notice the PHP content inside the javascript code above. Now you have some of the pieces and a direction. Plenty to get you started. Enjoy!

"At DIC we be Info Window creating code ninjas... at the DIC drive through window we serve fries along with our info." :snap:
Was This Post Helpful? 0
  • +
  • -

#3 annakhan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 11-April 10

Re: rss news feed

Posted 13 April 2010 - 04:16 AM

wll thxs...i hav gone through all thz sites..
but my map contains more than 100 markers(for cities) i want to display current news related to each city in its info window..
where as my map takes the markers from data base table..
here is my code

<script src=";v=2&amp;key=key" type="text/javascript"></script>



<div id="map" style="width: 600px; height: 450px"></div>

<script type="text/javascript">

var map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GScaleControl());
map.setCenter(new GLatLng(31.31610138349565, 70.927734375), 5);

// Creates a marker whose info window displays the given number
function createMarker(point, number)
var marker = new GMarker(point);
// Show this markers index in the info window when it is clicked
var html = number;
GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);});
return marker;

$link = mysql_connect("localhost", "root", "") or die("Could not connect: " . mysql_error());
mysql_selectdb("news",$link) or die ("Can\'t use dbmapserver : " . mysql_error());

$result = mysql_query("SELECT * FROM cities",$link);
if (!$result)
echo "no results ";
while($row = mysql_fetch_array($result))
echo "var point = new GLatLng(" . $row['lat'] . "," . $row['lng'] . ");\n";
echo "var marker = createMarker(point);\n";
echo "map.addOverlay(marker);\n";
echo "\n";


so what should i do now...
should i create another table for news...
or somthng else..??:(
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1