GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
simpleGeoRSS and georss-rome 0.9.5--> line or polygon?  XML
Forum Index -> General
Author Message
gforty



Joined: 06/02/2007 15:37:39
Messages: 7
Offline

Hello,
first off let me say thanks to Marc for georss-rome module..awesome product.

I was wondering if georss-rome could handle the following simpleGeoRSS types:
<georss:line>45.256 -110.45 46.46 -109.48 43.84 -109.86</georss:line>

and

<georss:polygon>
45.256 -110.45 46.46 -109.48 43.84 -109.86 45.256 -110.45
</georss:polygon>

Currently I can pass a feed with a <georss:point> with no problem but when I pass either of the two above I get nothing(no error, no SyndFeedImpl.entries[27].modules[0].longitude=).
My code is as follows:

Code:
                     SyndFeed feed = input.build(new XmlReader(url));
                     System.out.println(feed.toString());
                     out.println(convert.getJSON(feed));
 


I print out the feed to string and look for longitude or latitude but thye dont exist.

Here is my feed:
Code:
     <?xml version="1.0" encoding="utf-8"?>
     <feed xmlns="http://www.w3.org/2005/Atom" 
           xmlns:georss="http://www.georss.org/georss" 
           xmlns:gml="http://www.opengis.net/gml">
        <title>Earthquakes</title>
        <subtitle>International earthquake observation labs</subtitle>
        <link href="http://example.org/"/>
        <updated>2005-12-13T18:30:02Z</updated>
        <author>
           <name>Dr. Thaddeus Remor</name>
           <email>tremor@quakelab.edu</email>
        </author>
        <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
        <entry>
           <title>M 3.2, Mona Passage</title>
           <link href="http://example.org/2005/09/09/atom01"/>
           <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
           <updated>2005-08-17T07:02:32Z</updated>
           <summary>We just had a big one two.</summary>
           <georss:line>45.256 -110.45 46.46 -109.48 43.84 -109.86</georss:line>
           </entry>
     </feed>
 


Thanks in advance!
marc



Joined: 08/12/2005 07:39:47
Messages: 4416
Offline

Hi gforty

Lines and polygons are not yet implemented in the georss-rome module as I don't need it myself and I was waiting for someone to ask for it.
Implementing it would be a piece of cake. What methods would you expect?
I guess the best is to introduce a new class GeoRSSPoint and the GeoRSS module will get the methods :
Code:
 Collection<GeoRSSPoint> getPolygon()
 Collection<GeoRSSPoint> getLine()
 setPolygon(Collection<GeoRSSPoint>)
 setLine(Collection<GeoRSSPoint>)
 

What do you think?


Marc

[WWW]
gforty



Joined: 06/02/2007 15:37:39
Messages: 7
Offline

Hey Marc,
Thanks for your reply!

That would be great.
Currently my only need is to extract the simplerss and pass it along to another mapping application so the easier the better!

Thanks!
marc



Joined: 08/12/2005 07:39:47
Messages: 4416
Offline

Hi gforty

I have released a new version today 0.9.6 : http://georss.geonames.org/

Would you like to test it and tell me whether it works alright for you?

Cheers

Marc

[WWW]
gforty



Joined: 06/02/2007 15:37:39
Messages: 7
Offline

Marc,
thanks so much for the quick code addition!
I have not been able to test it yet as I have another pressing issue.

As soon as I have some time I will test it.

Not 100% sure about how to implement SimpleModuleImpl .

Currently I use your module as follows:

Code:
 
                 SyndEntry entry = (SyndEntry) it.next();
                 GeoRSSModule geoRssModule = GeoRSSUtils.getGeoRSS(entry);
 
                     itemLat = Double.toString(geoRssModule.getLatitude());
                     itemLon = Double.toString(geoRssModule.getLongitude());
 
 //Pretty much how you advised. Using GeoRSSUtils.
 


How would I expose the getLine() and the getPolygon() within SimpleModuleImpl.


Thanks again.
Graham
marc



Joined: 08/12/2005 07:39:47
Messages: 4416
Offline

Hi Graham

In my test I am using this code snippet :
Code:
 geoRSSModule = (SimpleModuleImpl) GeoRSSUtils.getGeoRSS(entry);
 Collection lineParsed = geoRSSModule.getLine();



Marc

[WWW]
gforty



Joined: 06/02/2007 15:37:39
Messages: 7
Offline

Hello Marc,
I began using your code today and I was wondering if you could see if I was doing something wrong..
Code:
 //within while loop
                 GeoRSSModule geoRssModule = GeoRSSUtils.getGeoRSS(entry);
                 SimpleModuleImpl simpleRSSModule = (SimpleModuleImpl) GeoRSSUtils.getGeoRSS(entry);
 
 


Then I test if simpleRSSModule is null:
Code:
                 if(simpleRSSModule != null)
                 {
                     Collection collection = simpleRSSModule.getLine();
                     System.out.println("LINE________________________"+collection.toString());
                 }
 

If I throw the xml document in my previous post (which contains a line), I get nothing.

Also if I test for null on the geoRssModule :
Code:
                 if(geoRssModule != null)
                 {
                     itemLat = Double.toString(geoRssModule.getLatitude());
                     itemLon = Double.toString(geoRssModule.getLongitude());
                     itemGeoLink = "<br><br><br><a href=# onclick=top.myframe.alertMe('"+
                             itemLat+"','"+itemLon+"')>CLICK</a>"+itemLat + " " + itemLon;
                 }
 

I get a class cast exception which points to :
Code:
                 SimpleModuleImpl simpleRSSModule = (SimpleModuleImpl) GeoRSSUtils.
                         getGeoRSS(entry);
 


So I am probably using your module incorrectly, could you offer some advice?

Thanks, Graham
marc



Joined: 08/12/2005 07:39:47
Messages: 4416
Offline

Hello Graham

Looks like a bug somewhere.

Did you also look at the very recent contribution of Rune Aasgaard : http://georss.geonames.org/
His implementation is more sophisticated, though not yet fully implemented. Parsing polygons and lines should already work. It does not make sense to develop two different versions at the same time. I would like to go with his implementation and drop the other release.

Marc

[WWW]
gforty



Joined: 06/02/2007 15:37:39
Messages: 7
Offline

Hello Marc,
thanks again for your module!
I will continue to use your implementation as I am too far at this point (although I notice that Rune's is an implementation of you module.)
For what I need to accomplish (basically just identify georss of any kind and extract the resulting values [even as just a String would suffice], I will try to make your module work.

Thanks again for the speedy code addition!

Graham


PLUS: I believe Rune Aasgaard's Implementation requires Java 1.6.

gforty



Joined: 06/02/2007 15:37:39
Messages: 7
Offline

Marc,
I was thinking about modifying your SimpleParser and SimpleParserImpl to return a String for the getLine() and getPolygon().
Does this sound reasonable?

As I said in the last post, The other implementation seems to use java 1.6 and I cannot leave 1.5...

Thanks, Graham
marc



Joined: 08/12/2005 07:39:47
Messages: 4416
Offline

If you have a use case for a line and polygon String it can be worth exposing the interface. And let me know about your fixes so that I can incoporate them in case we (=you) really don't want to go with the other implementation.

As for the other implementation :
Rune has finished a new release of his version.. You might want to give it a try.

Would you mind elaborating on the java1.6 probs? I thought it was compiled with a java 1.4 setting.

Marc

[WWW]
gforty



Joined: 06/02/2007 15:37:39
Messages: 7
Offline

Mark,
I was getting the following when using the other implementation:

class file has wrong version 50.0, should be 49.0.

I searched for this error and found posts that mentioned java version.
Perhaps I am wrong on this?

AFA making changes to your module, I struggled with it for quite a while but I have to say, I am not comfortable with modules so I abandoned.
I am using the Rome.getForeignMarkup() and then parsing that for georss.
My boss wanted something quick.
Hopefully I will have some time to experiment further with your module.
I will take a look at Rune's again.
Thanks again.
Graham



DISREGARD above.

I downloaded the latest by Rune and it compiled with no problems and it works great....
Not sure why I got the above error on the previous version.

Just real quick I was able to return the type using System.out.println(geoRssModule.getGeometry()).
which returns
com.sun.syndication.feed.module.georss.geometries.Polygon@6f8b2b
com.sun.syndication.feed.module.georss.geometries.LineString@9bad5a

etc...
etc...

Thanks to Marc and Rune!

Cheers.
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team