PDA

View Full Version : Placename/boundary caching


KevinNCSU
07-31-2007, 02:19 PM
Are there cache packs for the placename and country boundary layers available for download? I've got imagery I want caching thanks to help from all the threads and programs people have written, but haven't seen anything mentioned about the placename or boundary layer data.

bull
07-31-2007, 10:11 PM
http://www.worldwindcentral.com/wiki/Add-on:Classic_Placenames_cache_pack

I think there are some boundary packs on there somewhere too.

tve
08-01-2007, 04:23 AM
Here you go...


Cheers!
-tve

KevinNCSU
08-01-2007, 02:02 PM
Excellent, thanks a ton guys!

tve
08-03-2007, 09:16 AM
I received a request for apps to fetch the other layers... so here you go....

The high res files, I have limited to my area of interest. You need to modify the lat/long angle loops and sector geometry to your area of interest....

KevinNCSU
08-03-2007, 01:46 PM
Thanks alot! =)

KevinNCSU
08-03-2007, 02:51 PM
For the fetching and caching of political boundaries, they seem to be downloading correctly, but they won't appear in world wind.

When I compare the cache of the one I let connect to the internet to the one that doesn't, the internet one seems to have PNG files and DDS files while the one whose cache is populated by the fetch scripts only has the DDS.

Any idea what might be causing this?

toolshed
08-03-2007, 03:01 PM
When I compare the cache of the one I let connect to the internet to the one that doesn't, the internet one seems to have PNG files and DDS files while the one whose cache is populated by the fetch scripts only has the DDS.

I see this too. The correct DDS files are 257KB in size. Some of the ones downloaded are 5KB in size. When you look at the 5KB files with a binary reader, they have png headers.

EDIT: Just looked at the source. The URLBuilder class contains the following:


sb.append("&format=image/png");
sb.append("&styles=countryboundaries");
sb.append("&bgcolor=0x000000");
sb.append("&transparent=true");

KevinNCSU
08-03-2007, 03:24 PM
The CountryBoundaries file in WorldWind contains the same lines though. I think you might be right about it being a problem with the 5KB vs 257KB files, though I'm not sure what to do about it.

Nevermind previous edit, they should definately be 257k when compared to the WorldWind cached data

toolshed
08-03-2007, 03:42 PM
edit: or the 5KB ones might just be empty area with no boundaries, like ocean?

No, I just deleted level 0 (they were all correct DDS files) and refetched through the getPolitical call. Now they are all 5KB png files. There seems to be a missing conversion.

toolshed
08-03-2007, 03:54 PM
Found fix.

replace run method in DownloadPostProcessor with this:


public ByteBuffer run(Retriever retriever)
{
if (retriever == null)
{
String msg = WorldWind.retrieveErrMsg("nullValue.RetrieverIsNull");
WorldWind.logger().log(java.util.logging .Level.FINE, msg);
throw new IllegalArgumentException(msg);
}

try
{
if (!retriever.getState().equals(Retriever. RETRIEVER_STATE_SUCCESSFUL))
return null;

if (retriever instanceof HTTPRetriever)
{
HTTPRetriever htr = (HTTPRetriever) retriever;
if (htr.getResponseCode() != HttpURLConnection.HTTP_OK)
{
System.out.println( "http error response" );
}
}

URLRetriever r = (URLRetriever) retriever;
ByteBuffer buffer = r.getBuffer();

final File outFile = WorldWind.dataFileCache().newFile(tile.g etPath());

if (buffer != null)
{
String contentType = r.getContentType();
if (outFile.getName().endsWith(".dds"))
{
// Convert to DDS and save the result.
buffer = DDSConverter.convertToDDS(buffer, contentType);
}

WWIO.saveBuffer(buffer, outFile);
return buffer;
}
}
catch (java.io.IOException e)
{
e.printStackTrace();
}
return null;
}
}

KevinNCSU
08-03-2007, 07:01 PM
Nice work, looks like that handles the conversions, are political boundaries showing up for you now? They're still not for me yet =/

toolshed
08-06-2007, 05:49 PM
Yeah, I see that now. The files are converted, but they contain zeros.:confused:

tve
08-07-2007, 01:57 AM
Not sure why you guys are having problems. Use the original code I posted. Even though it has the png file extension. Just use it as posted. I verified it works. I'm just using parts of the code from the distribution.

Maybe the problem is that you didn't add the layer in the correct order?

Does your app load layers something similar to this order?

private BasicDemo.LayerAction[] layers = new BasicDemo.LayerAction[]{
new BasicDemo.LayerAction(new SkyColorLayer(), false),
new BasicDemo.LayerAction(new BMNGSurfaceLayer(), true),
new BasicDemo.LayerAction(new LandsatI3(), true),
new BasicDemo.LayerAction(new USGSDigitalOrtho(), false),
new BasicDemo.LayerAction(new USGSUrbanAreaOrtho(), false),
new BasicDemo.LayerAction(new USGSTopographicMaps(), false),
new BasicDemo.LayerAction(new EarthNASAPlaceNameLayer(), true),
new BasicDemo.LayerAction(new CountryBoundariesLayer(), true),
new BasicDemo.LayerAction(new CompassLayer(), true),
};

-tve

tve
08-07-2007, 02:14 AM
oops... may have spoken too soon. I seem to be having problems now that I tried moving my images out of the way... hang on...
-tve
Not sure why you guys are having problems. Use the original code I posted. Even though it has the png file extension. Just use it as posted. I verified it works. I'm just using parts of the code from the distribution.

tve
08-07-2007, 02:23 AM
oops... may have spoken too soon. I seem to be having problems now that I tried moving my images out of the way... hang on...
-tve

I'm thinking that the problem may be something that changed on the NASA servers. This might be why that layer isn't enabled by default? TAG?

It did work for me at one point...., but it doesn't now.

-tve

KevinNCSU
08-07-2007, 06:17 PM
I don't think its a problem with the fetch scripts now either. When I clear out my cache and just run the program normally connected to the internet it downloads the dds files for the politcal boundaries but they still never show on screen

KevinNCSU
08-10-2007, 08:44 PM
The files seem to be downloading and converting correctly now, I'm guessing something was wrong with the NASA servers before.

withak
08-10-2007, 09:15 PM
Not an uncommon issue. :)