mousebird-consulting-inc / WhirlyGlobe

WhirlyGlobe Development
Other
828 stars 254 forks source link

ImageChopper multires don't seems to work #31

Closed mackoj closed 9 years ago

mackoj commented 11 years ago

Hi,

How can I do and use multires images ?

Best regards,

mousebird commented 11 years ago

Here's an example that I used the other day: ImageChopper world.topo.200408.3x21600x10800.png world_4level world_4level -multires 3 -outSize 256 -outformat jpeg

That takes a whole world image, chops it up 4 levels (0-3) and writes it to a directory named "world_4level" and also calls the resulting image set "world_4level". Output images are 256 pixels and the output format is jpeg.

There's one bug that I'm aware of, though. The plist file it creates will claim the images are tiff. Right now you you just go into the plist and change that to "jpg".

mackoj commented 11 years ago

Great ! Thanks and for loading them I just use addSphericalEarthLayerWithImageSet ?

mousebird commented 11 years ago

Right.

mackoj commented 11 years ago

-outformat is not recognize so I'm trying with -texTool /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool instead.

mousebird commented 11 years ago

If you're not using the develop branch, you should switch to that.

mackoj commented 11 years ago

Ok so I switch to develop_2_2 and now the command works perfectly but the images don't seems to load even after modifying the plist.

mousebird commented 11 years ago

Use develop, not develop_2_2. That's the 2.2 development tree and it's fairly unstable.

However, that's probably not the problem. Make sure the plist and all the individual images are imported into your project.

mackoj commented 11 years ago

Ok I will switch again. I but in the code you don't seems to use maxLevel property from the plist.

mackoj commented 11 years ago

Sorry but I still don't succeed to make it work.

But I think I figure where it bug.

It quit in TextureGroup.mm.

    if (x >= numX || y >= numY)
        return nil;

And if I hide this two line it returns /path_blablabla/mapWithIsland_4level_0x0 instead of /path_blablabla/mapWithIsland_4level_0x0x0.

mousebird commented 11 years ago

My mistake above. You should be calling addQuadSphericalEarthLayerWithImageSet That one invokes a quad tree paging layer, which is what you need for that variety of image set.

mackoj commented 11 years ago

Ok, now it's bugging in [ImageDataSource initWithInfo:] the info dict is nil.

mousebird commented 11 years ago

That means it didn't load the dictionary. Make sure you're passing in the right name and the plist is in the bundle.

mackoj commented 11 years ago

I fix it with this.

- (id)initWithInfo:(NSString *)infoName
{
    self = [super init];

    if (self)
    {
        NSString *fullPath = [[NSBundle mainBundle] pathForResource:infoName ofType:@"plist"];

        // This should be the info plist.  That has everything
        NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:infoName ofType:@"plist"]];
        if (!dict)
        {
            return nil;
        }
        // If the user specified a real path, as opposed to just
        //  the file, we'll hang on to that
        basePath=[fullPath stringByDeletingLastPathComponent];
        ext = [dict objectForKey:@"format"];
        baseName = [dict objectForKey:@"baseName"];
        maxZoom = [[dict objectForKey:@"maxLevel"] intValue];
        pixelsSquare = [[dict objectForKey:@"pixelsSquare"] intValue];
        borderPixels = [[dict objectForKey:@"borderSize"] intValue];    
    }

    return self;
}

I just fix basePath with the good fullPath .

mousebird commented 11 years ago

It's expecting you to pass in the full path, rather than just the base name. But that's fine.

mackoj commented 11 years ago

Thanks for the help.

mousebird commented 11 years ago

Just a note for myself. Fix the bad image type coming out of ImageChopper. Try multiple search paths in SphericalEarthQuadLayer.mm

mousebird commented 9 years ago

I'm just deprecating ImageChopper. Better to use TileMill or a command line GDAL tool.