[Openstreetmap-dev] Using osmServerClient ?

SteveC steve at fractalus.com
Tue May 31 10:30:19 BST 2005


If I compile and run it I get

steve at turbo dist $ java OpenStreetTest
grabbing nodes...
Spent 1785 in request
Calling getNodes took 1855.0ms
reading Lines...
Spent 2764 in request
Calling getLines took 2764.0ms
done getting lines!
Got 1697 nodes and 1755 lines




* @ 29/05/05 04:38:35 PM magne at samfundet.no wrote:
> I've been trying to extract data from OSM by using osmServerClient,
> but with little luck.  What I do is that is I create an
> instance of osmServerClient() and calls getNodes (..) on it.
> No matter what LatLonPoints I feed it, I get 0 nodes back.
> The applet works as it should (even when I start it locally from
> dist/applet.sh), so it must be a really stupid mistake I do somewhere :)
> 
> I have tried both with and without calling login() first.  Login seems
> to work as it should, since I get an error when I give an invalid
> username/password.   Since getNodes() doesn't require a login, the 
> test program below is without it.
> 
> The short example program below tries to extract the points from
> an area around my home town:
> 
> 
> OpenStreetTest.java
> > import org.openstreetmap.client.*;
> > import com.bbn.openmap.LatLonPoint;
> > import java.util.*;
> > 
> > public class OpenStreetTest
> > {
> >     public static void main (String[] args) throws Exception {
> >         osmServerClient client = new osmServerClient();
> >         // retrieve data set for Trondheim, Norway
> >         // 63.42216N  010.39334E 
> >         LatLonPoint a = new LatLonPoint(64.0, 10.0);
> >         LatLonPoint b = new LatLonPoint(63.0, 11.0);
> > 
> >         Hashtable h = client.getNodes (a, b);
> >         Vector v    = client.getLines (h);
> >         System.out.println("Got " + h.size() + " nodes and "  + 
> >                             v.size() + " lines");
> >     }
> > }
> 
> Output from the program is:
> > % java OpenStreetTest
> > grabbing nodes...
> > result = []
> > Spent 1519 in request
> > Calling getNodes took 1703.0ms
> > reading Lines...
> > result = []
> > Spent 217 in request
> > Calling getLines took 220.0ms
> > done getting lines!
> > Got 0 nodes, and 0 lines
> 
> 
> 
> Any clues on what I do wrong?
> 
> --Magne
> 
> 
> _______________________________________________
> Openstreetmap-dev mailing list
> Openstreetmap-dev at vr.ucl.ac.uk
> http://bat.vr.ucl.ac.uk/cgi-bin/mailman/listinfo/openstreetmap-dev
> 

have fun,

SteveC steve at fractalus.com http://www.fractalus.com/steve/




More information about the dev mailing list