kaktus40 / Cesium-GeoserverTerrainProvider

plug in to use geoserver as terrain provider
Other
356 stars 140 forks source link

BBOX is outside of WGS84 limits #22

Closed ihor-hrechka closed 7 years ago

ihor-hrechka commented 7 years ago

Hi!

I am trying to load BIL data from geoserver, but templateToURL(urlParam, x, y, level, provider) function attaches wrong bbox values to URL (see screenshot bellow). What can be the reason?

image

P.s. Cesium version 1.33 P.p.s. Let me know if you need more details!

Thank you in advance!

kaktus40 commented 7 years ago

Hello, could you send your WMS capabilities document?

ihor-hrechka commented 7 years ago

Hello, thanks for the answer!

I can't send full xml, but I made two screenshots:

Geoserver GetMap capabilities: capture_1

And description of layer, which I'm trying to load: capture_2

Is it enough? Or you need more info?

kaktus40 commented 7 years ago

It seems that all is correct. I'm sorry but I take vacation and I can't help you until 19/08/2017...

ihor-hrechka commented 7 years ago

Ok, I will wait! If new observations will come, I will let you know!

Have a good vacation!

ihor-hrechka commented 7 years ago

Hi! I hope you are back and your vacation was perfect! :)

I am still having an issue, described above.

Here my source code:

// create viewer
viewer = new Cesium.Viewer("map", {
        animation: false,
        timeline: false,
        homeButton: false,
        baseLayerPicker: false,
        navigationHelpButton: false,
        geocoder: false,
        infoBox: false,
        sceneModePicker: false,
        fullscreenButton: false,
        imageryProvider: new Cesium.createOpenStreetMapImageryProvider({
            url: "https://a.tile.openstreetmap.org/"
        }),
        contextOptions: {
            webgl: { preserveDrawingBuffer: true }
        }
});

// create terrain provider
var geoserverTerrainProvider = new Cesium.GeoserverTerrainProvider({
    url: geoServerUrl,
    layerName: "sf:sfdem"
});

// attach terrain provider
viewer.scene.globe.terrainProvider = geoserverTerrainProvider;

Request looks like this (bbox looks strange): capture

And response is ServiceExceptionReport:

<ServiceException>
      Error rendering coverage on the fast path  java.lang.NullPointerException
</ServiceException>

Do you have any idea what can be the reason?

Thanks!

kaktus40 commented 7 years ago

It's very strange, from what I understand, your layer sf:dem has the next bounding box in CRS:84:

For record, the bbox for CRS:84 in WMS request is define in this order: '{south},{west},{north},{east}' so the biggest rectangle that can be requested should be bbox=-103.871006, 44.3702, -103.6293,44.5016 and you have a request with bbox= -181,-91,1.40,91

Could you add some line codes in the code of plugin? After line 368 (retour = Cesium.defined(scratchRectangle);), could you add the next lines and show me the result:


                            if(retour){
                                console.log('reference: west'+rectReference.west+'; south:'+rectReference.south+'; east:'+rectReference.east+'; north:'+rectReference.north);
                                console.log('calcul: west'+rectangleCalcul.west+'; south:'+rectangleCalcul.south+'; east:'+rectangleCalcul.east+'; north:'+rectangleCalcul.north);
                                console.log('result: west'+scratchRectangle.west+'; south:'+scratchRectangle.south+'; east:'+scratchRectangle.east+'; north:'+scratchRectangle.north);
                            }
ihor-hrechka commented 7 years ago

I added this lines here: capture

Result from console: capture1

ihor-hrechka commented 7 years ago

Sorry, I closed issue by mistake.

ihor-hrechka commented 7 years ago

I also made one screenshot of templateToURL(urlParam, x, y, level, provider) values. Maybe it can be helpfull: capture2

kaktus40 commented 7 years ago

Well from what I see, all work well as I defined. I should add a max limit to rectangle according to the tilingScheme. This limit should be adaptable also.

kaktus40 commented 7 years ago

Hello which is the version of geoserver. It seems there some issues with old versions Le 29 août 2017, à 08:48, IgorGrechka notifications@github.com<mailto:notifications@github.com> a écrit:

I also made one screenshot of templateToURL(urlParam, x, y, level, provider) values. Maybe it can be helpfull: [capture2]https://user-images.githubusercontent.com/1829604/29808021-2745ba5a-8c9f-11e7-9e17-a96033329730.PNG

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/kaktus40/Cesium-GeoserverTerrainProvider/issues/22#issuecomment-325571123, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AF0OfPeI77pCMVRjZ8GDk2y1tUaJSu4Jks5sc7Q7gaJpZM4OYKHJ.

ihor-hrechka commented 7 years ago

Hi! Please look at GeoServer's about page: capture

kaktus40 commented 7 years ago

Is it possible for you to update the version of geoserver?From what I saw on internet, may be one piece of your dataset is bad... Le 30 août 2017, à 14:07, IgorGrechka notifications@github.com<mailto:notifications@github.com> a écrit:

Hi! Please look at GeoServer's about page: [capture]https://user-images.githubusercontent.com/1829604/29871551-d46115ae-8d94-11e7-9665-ae0ae45048c4.PNG

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/kaktus40/Cesium-GeoserverTerrainProvider/issues/22#issuecomment-325970473, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AF0OfAhiSVlq_isK5zCWLBUJ6tsDw5Frks5sdVBwgaJpZM4OYKHJ.

ihor-hrechka commented 7 years ago

Ok. I will check the possibility of updating the GeoServer to the latest stable version and let you know.

P.s. Maybe you know, where I can get correct dataset for testing?

kaktus40 commented 7 years ago

Well in the end of readme.mdhttp://readme.md I give some links...

Envoyé par BlueMailhttp://www.bluemail.me/r?b=10455 Le 30 août 2017, à 15:36, IgorGrechka notifications@github.com<mailto:notifications@github.com> a écrit:

Ok. I will check the possibility of updating the GeoServer to the latest stable version and let you know.

P.s. Maybe you know, where I can get correct dataset for testing?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/kaktus40/Cesium-GeoserverTerrainProvider/issues/22#issuecomment-325992192, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AF0OfAJeWfiGiHWmvsoNgrhOvkfGwuDuks5sdWVKgaJpZM4OYKHJ.

ihor-hrechka commented 7 years ago

Hi!

I updated GeoServer to version 2.11.2

gsv

Now the globe is loading (the half of the globe)

1

BBOX in first request is outside limits: r1 but after starting rotating\zooming the globe it becomes correct: r3

But previously it was only one request after "GetCapabilities" and globe wasn't load. So I can say that update of GeoServer have resolved the issue.

Bit terrain looks like bellow:

2

Layer preview in GeoServer looks like this:

gs

Can you tell me what is the reason of wrong terrain visualization and why Cesium loads exactly half of the globe?

Thank you!

kaktus40 commented 7 years ago

hello, for the wrong terrain visualization, you should check https://github.com/kaktus40/Cesium-GeoserverTerrainProvider/issues/9#issuecomment-119314192 for example. By default the plugin works with data in Integer 16 bit format. Your data is on a float format (32 or 64 bit?). In this comment, you should find a solution.

For the half earth not rendered, it's also normal because cesium use function to determine if a tile is available. If a tile is not available, Cesium doesn't download the image corresponding. A workaround (for WMS) is to change this function so it always returns true!

ihor-hrechka commented 7 years ago

Hi! I checked the original image format and you are wright, it is in Float32 format. GDALinfo of image: gi_orig

After I tryed to convert it using gdalwarp -ot Int16 -co "TILED=YES" -co "COMPRESS=DEFLATE" -r cubicspline "C:\sfdem_orig.tif" "C:\sfdem_conv.tif"

GDALinfo of converted image: gi_conv

But the result is same: result

If it required, I can upload original and converted images somewhere!

kaktus40 commented 7 years ago

It seems you have a problem with the endiannes of your data (easily corrected in bil/DDS parameters in geoserver). You didn't have to convert your data in int 16 bit data. If you follow my comment, you just need to check the parameter in geoserver and implement postProcessArray when you use the plugin!

ihor-hrechka commented 7 years ago

Thanks a lot for your help!

I copied your formatArray implementation and changed Default Encoding and Byte Order in GeoServer layer settings. Now the picture looks fine: capture

As I understand - this "stair" is the end of elevation map in GeoServer. Am I wright?

kaktus40 commented 7 years ago

Yes that right!