-
Notifications
You must be signed in to change notification settings - Fork 17
Feature/refactor mercator layer #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/refactor mercator layer #41
Conversation
|
@Sufaev, could you remove the SurfaceText changes from this pull-request? That particular commit is causing merge conflicts with the You can do it by removing the "Add SurfaceText rotation" commit as follows (assuming you are on the Once removed, you can force-push the branch again: This will update the branch and remove the conflicting commit. When making pull-requests it is best if you work from the head of the And then do a: When you work on a new feature. |
|
It was my fault if I create this branch from surface text. I will clean up it tomorrow. |
|
Done. |
Fixed the formatting in BasicMercatorTiledImageLayer and MercatorTileUrlBuilder to fit in with the formatting standards.
Changed the makeLevels() method to receive two string parameters, namely: the dataset-name and the data-cache-name. We cannot just rely on a single name parameter. The values for these might be different for each layer.
Modified the MercatorTileUrlBuilder class by adding a private constant integer to represent the default first-level-offset value. In our case this value is 3. A protected constructor was added that initialized the firstLevelOffset field to this private constant integer. This allows us to not to have to specify this value each time we instantiate a subclass of MercatorTileUrlBuilder.
|
@Sufaev, I made a couple of changes. Let me know what you think. I'll just explain some of them here:
I then refactored the The tile above is an example of the old I don't know why this is. It could be the image post-processing logic in As a last task, I removed the old |
|
@wcmatthysen NUM_LEVELS must be affected by first-level-offset, because num levels is a general amount of zoom levels available in map sourse and first-level-offset is an offset between source zero zoom and zero level in wwd levelset. Amount of levels in levelset should equals general num levels minus first-level-offset, because first-level-offset is than added to current rendered level in url builder and if you will not subtract first-level-offset from num_levels than program will try to get more levels than map source can provide. I simplified dataset-name and data-cache-name to be set by short map name just for simplicity when using build-in levelset builder. This approach defines root folder for all mercator maps cache and only allows to configure last sub-folder name. But if you wish to specify them manually, than it is ok for me. Default firstLevelOffset in MercatorTileUrlBuilder is ok. It was equals 3 in my source code, but when I have created pull request I have removed constant value and replace it by parameter. Good solution to have both parametrized and default constructors. I like it. OSM URL Builder should request tiles from random sub-domain a, b or c to speedup downloading. |
|
@Sufaev, ok, I understand the Nice, the "abc" optimisation can work great. It should just be where |
Refactored the OSMMapnikLayer class to make use of the modified superclass constructor. Thus, we no longer have our own makeLevels() method, but instead we call the super-class constructor, relying on the makeLevels() method there to correctly populate the AVList parameters. The internal URLBuilder class was also modified to extend from MercatorTileUrlBuilder instead of TileUrlBuilder. This means that the getMercatorURL() method had to be implemented.
|
@wcmatthysen I do not remember why we start using random. You can try to use sequential access. |
|
@Sufaev, I looked into this a bit and saw from the OpenStreetMap Wiki a description regarding the different server-names:
So, basically the a, b or c prefixes are meant for browser optimisation. It doesn't really affect us. You can test it by running a ping on the different server-names and you'll see they all point to the same IP-address. I think for our purposes we can probably just work with: https://a.tile.openstreetmap.org |
|
Ok. Than we do not need this optimization. |
|
@Sufaev, I'm just going to modify the branch again. I think we can add the I just have to see if I can get this to work. |
|
Most map apis will reqire a key. It is a good idea in general. |
Modified the OSMCycleMapLayer class to also make use of the modified superclass constructor. This is basically the same refactor strategy that was applied to the OSMMapnikLayer. However, the difference here is that we now have an addtional getter and setter method to get/set the APIKey respectively. The reason for this is that if you want to use the OSM-Cycle-Map from thunderforest you need to supply a valid API-key or else you will get tiles with watermarks. By adding the getter and setter methods we can now configure this layer in the worldwind.layers.xml file to have the correct API-key at runtime.
|
@Sufaev, I added the I have tested this feature and it works. |
|
I see the build is failing. However, it looks like a certificate issue with Oracle's site: https://stackoverflow.com/questions/55878548/travis-ci-couldnt-install-openjdk11 |
|
In the original issue #38, there are additional layers such as OTMLayer, WikiLayer and GoogleLayer. I suppose we can also add the OTMLayer and WikiLayer as new layers. I'm not sure about the licensing around GoogleLayer. Would it be best just to leave that out? Also, is it actually ok (in terms of licensing) to include OTMLayer and WikiLayer? |
Added a new class called OpenTopoMapLayer. This layer implementation was provided by @Sufaev in issue #38. Also added the layer to the worldwind.layers.xml file as a commented-out layer just above the OSM-layers to allow for easy testing.
Moved the getURLBuilder() method from the OSMCycleMapLayer up to the BasicMercatorTiledImageLayer as this method is useful and can be re-used in other locations. Refactored the OSMCycleMapLayer as a result of this so that we now call the base-class method when we want to get a handle on the URLBuilder.
Added a new class called WikimapiaLayer. This layer implementation was provided by @Sufaev in issue #38. Also added the layer to the worldwind.layers.xml file as a commented-out layer just below the OSM-layers to allow for easy testing.
|
I didn't want to add the Google-layer as I'm unsure about the license restrictions. |
|
I've been using a build of WWJ-CE for almost a couple of months. Today I pulled the develop branch and rebuilt my jars in order to test GDAL changes. But I noticed errors in my project (built on top of WWJ) related to the MercatorTiledImageLayer class. I updated my code to work with the changes in the Mercator layer and rebuilt my project. However, now when I try to run I am getting the following error on every layer that is attempting to be loaded:
I ran into this before (several weeks ago) when I was testing a build of WWJ-CE using Java 9. So I took a look at the gradle build information to verify that it is set up to build against Java 1.8... which it is. I can't figure out what's going on. The symptoms are exactly like the ones I experienced when I built WWJ-CE using Java 1.9. Any ideas about what the problem might be? |
|
This issue was that the platform being used by the gradle build was JDK 11. I hadn't noticed the "Platform for build scripts" section in "Gradle project". Once I unchecked the "Inherit" checkbox I was able to choose JDK 8 as the build platform. And after I built using JDK 8 the errors went away. |


Simplify MercatorTiledImageLayer code. Make it exdended from BasicTiledImageLayer.