GeoNames Layer for WorldWind Java
This is the first iteration of a layer that displays city names for the current view, off the GeoNames web service.
Download GeoNamesLayer.java, remove the .txt extension and add to the SDK layers.Earth package. Note that you may have to refactor the removeAllRenderables() method call into clearRenderables() for 0.4.1 - see this post comments.
Right now the layer will start showing names below 1500km but doesn't cache anything. It just sends requests to the service and displays the latest results. Sometime, names disappear, then reappear... more work is to be done to smooth things out. The service doesn't let you know whether a location is a large city or a tiny village either.
Still it provides many more world city names then are now displayed in WWJ. GeoNames also offers many kinds of geographic features that could be combined here, including the locations for which there is a geo referenced article in Wikipedia.
Download GeoNamesLayer.java, remove the .txt extension and add to the SDK layers.Earth package. Note that you may have to refactor the removeAllRenderables() method call into clearRenderables() for 0.4.1 - see this post comments.
Right now the layer will start showing names below 1500km but doesn't cache anything. It just sends requests to the service and displays the latest results. Sometime, names disappear, then reappear... more work is to be done to smooth things out. The service doesn't let you know whether a location is a large city or a tiny village either.
Still it provides many more world city names then are now displayed in WWJ. GeoNames also offers many kinds of geographic features that could be combined here, including the locations for which there is a geo referenced article in Wikipedia.
7 comments:
hello patrick,
i have a little problem with your layer.removeAllRenderables() in private void parseDoc ( RenderableLayer layer, Document xmlDoc )
there is no removeAllRenderables in RenderableLayer
thanks in advance for your answer
You are right, this method has been introduced after 0.4.1 and will be available in the next release. For now you can use clearRenderables().
hello patrick,
i have found it before but it was a private method :) a simple call from a pseudo removeAllRenderables to clearRenderables has solve it
thanks for your work
autoreverse from worldwind forum
a question : when the next release ?
Hello patrick,I added GeoNamesLayer but I can't find clearRenderables() method (which class it belongs to?) Then I tried to replace layer.removeAllRenderables() with
layer.getRenderables().clear();
but it generates ConcurrentModificationException,then I tried also to acquire a lock both this object and the collection too but it still generates ConcurrentModificationException. thank you, Angelo
Ups, I didn't notice it is a private method, now I make it public and it works fine...thanks...
Angelo
Hi,
I would like to use the layer in my Application. The Comments say Copyright (C) 2001, 2007 United States Government [...]
All Rights Reserved.
What license is this Code under? Can I use/distrube it?
Some of the code i post end up in the WWJ SDK and thus falls under the NOSA license. As for the GeoNamesLayer, you can do whatever you want with it, the copyright is just a cut-n-paste of some SDK source.
Post a Comment