Skip to content

create world files#93

Closed
ruester wants to merge 5 commits into
MapServer:mainfrom
faegi:world_files
Closed

create world files#93
ruester wants to merge 5 commits into
MapServer:mainfrom
faegi:world_files

Conversation

@ruester
Copy link
Copy Markdown

@ruester ruester commented Feb 21, 2014

When caching to disk or tiff it is useful to also create world files for the images.
So we are able to generate all tiles using mapcache_seed and then use the same raster data for a WMS service.

To use this feature following has to be added to the configuration file:

<cache ...>
    <create_world_file/>
</cache>

We used the file extension ".wld" for the world files as suggested by MapServer (see here).

Comment thread lib/cache_disk.c Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we remove this function, and instead factor in a forced extension in _mapcache_cache_disk_template_tile_key ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something like:

static void _mapcache_cache_disk_tilecache_tile_key(mapcache_context *ctx, mapcache_tile *tile, char **path, char *extension)

and if extension == NULL we use the current behaviour of the function?
Otherwise we set the extension to "wld" ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, exactly

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be a bigger change...

All generic functions

lib/cache_disk.c:833:    dcache->tile_key = _mapcache_cache_disk_tilecache_tile_key;
lib/cache_disk.c:835:    dcache->tile_key = _mapcache_cache_disk_arcgis_tile_key;
lib/cache_disk.c:837:    dcache->tile_key = _mapcache_cache_disk_template_tile_key;

have to get this parameter, although they maybe never will use it.

As well as the interface in mapcache.h has to be changed:

struct mapcache_cache_disk {
  ...
  void (*tile_key)(mapcache_context *ctx, mapcache_tile *tile, char **path);
};

As an alternative we could implement a function to change the extension of a filename and use the current version of _mapcache_cache_disk_tilecache_tile_key.
But this could be as dirty as the internal API change...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both options are OK for me, as long as we're not duplicating the code just to use another extension

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I'll have a look at it...

the strstr function is already called in mapcache_util_str_replace
Instead we use replace_file_extension to generate the filename for the world file
Base automatically changed from master to main January 15, 2021 22:57
@jbo-ads
Copy link
Copy Markdown
Member

jbo-ads commented Mar 10, 2021

@ruester - Is this pull request still relevant?

@ruester
Copy link
Copy Markdown
Author

ruester commented Mar 15, 2021

As this PR is very old and was not merged till now, we can close it... If someone needs this feature they can use these commits to implement it for a newer version of mapcache 👍

@ruester ruester closed this Mar 15, 2021
@jmckenna
Copy link
Copy Markdown
Member

@ruester we're doing a push for the upcoming 1.12.0 release and these changes could be included. Please re-open this as it is a good enhancement for the community.

@jmckenna jmckenna added this to the 1.12.0 milestone Mar 15, 2021
@ruester
Copy link
Copy Markdown
Author

ruester commented Mar 15, 2021

Oh ok, sure you can add this, but I will have no time for rebasing the commits or fix the implementation if needed..

@ruester ruester reopened this Mar 15, 2021
@jmckenna
Copy link
Copy Markdown
Member

ok thanks for explaining. Closing.

@jmckenna jmckenna closed this Mar 15, 2021
jbo-ads added a commit to jbo-ads/mapcache that referenced this pull request Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants