We do something similar to display tiles from a range of services (google maps,
osm, wmts, etc...) in uDig. We gather up the tiles into a collection of grid
coverages for display. We do however load the tiles in a background thread and
refresh the screen as they come in (with the option of loading them into a
memory or disk based cache).
I expect you are running into trouble with images being loaded gradually; and
your mapMove gives you a chance to redraw the same image now that it has
content. You may wish to try and force the content to load (and listen to the
image so you can tell when it is done); or save the content to disk and render
from that ...
We did back port the tile code in GeoTools 2.5.x but there was not enough
enough collaboration to complete the effort. Since that time a google summer of
code project has made the uDig tile rendering / fetching system much more
capable. If anyone is interested in porting the work into an unsupported module
is welcome to, the uDig code base would happily track the change to prevent
duplication of future effort.
--
Jody Garnett
On Thursday, 9 June 2011 at 9:10 AM, Alexander Lanin wrote:
> Hi,
>
> I'm trying to get osm tiles (256x256px images) to display in my JMapPane.
> What I do is: I download tiles from http://tile.openstreetmap.org/ (then I
> cache etc.) and then:
>
> StyleBuilder sb = new StyleBuilder();
> Style style = sb.createStyle(sb.createRasterSymbolizer());
> GridCoverageFactory gridFactory = new GridCoverageFactory(); GridCoverage2D
> grid = gridFactory.create("GridCoverage-" + tile.getUniqueId(),
> tile.getImage(), tile.getEnvelope()); MapLayer layer = new MapLayer(grid,
> style); _map.getMapContext().addLayer(layer);
> _map.repaint();
>
> With _map being a JMapPane.
>
> While this works most of the time, some tiles/layers are sometimes not
> rendered. Actually every time there are some tiles/layers missing.
>
> Interestingly when using JMapPane.moveImage in a completely unrelated part
> of my code (panning) all the tiles show up. I already tried to use
> moveImage(1,1) after addLayer, but that just messes everything up.
>
> Sometimes I get this message:
> 09.06.2011 00:09:30
> org.geotools.renderer.lite.gridcoverage2d.GridCoverageRenderer
> prepareFinalImage
> INFO: The destination envelope does not intersect the envelope of the source
> coverage.
> But that's just 10% of the time tiles/layers are missing.
>
> Am I even on the right track for displaying these images? And why doesn't it
> work? :-)
>
> Oh and I'm using geotools 8.0-M.0 + fix from
> http://jira.codehaus.org/browse/GEOT-3555
>
> Regards,
> Alex
>
>
> ------------------------------------------------------------------------------
> EditLive Enterprise is the world's most technically advanced content
> authoring tool. Experience the power of Track Changes, Inline Image
> Editing and ensure content is compliant with Accessibility Checking.
> http://p.sf.net/sfu/ephox-dev2dev
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> (mailto:[email protected])
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users