Adding Custom WebMapServiceImageryProvider ,How to set the local coordinate and EPSG:3067

1,062 views
Skip to first unread message

ibnea...@gmail.com

unread,
Jun 1, 2015, 8:55:52 AM6/1/15
to cesiu...@googlegroups.com
Hi,

I am trying to add local tiles with EPSG:3067 here is the code. The problem is it is requesting with EPSG::4326 with lat lon bbox while i want it to be in local coordinates system which EPSG:3067

**Code***
var url='https://ws.nls.fi/rasteriaineistot/image?service=WMS&version=1.1.1&request=GetMap&userId=testuser&format='; //Geoserver URL
var layers = viewer.imageryLayers;
layers.removeAll();
layers.addImageryProvider(new Cesium.WebMapServiceImageryProvider({
url : url,
parameters: {

crs: 'EPSG:3067'
} ,
tileWidth:256,
tileHeight:256,
layers: 'ortokuvat'// Here just give layer name
}));

**error in the network tab for each tile***

Here is the error because it request for the tile as Request URL:https://ws.nls.fi/rasteriaineistot/image?crs=EPSG%3A3067&service=WMS&version=1.1.1&request=GetMap&styles=&format=image%2Fjpeg&userId=testuser&layers=ortokuvat&srs=EPSG%3A4326&bbox=24.867553710937504%2C60.30944824218751%2C24.87030029296875%2C60.31219482421875&width=256&height=256
Request Method:GET
Status Code:401 Authorization Required

************The correct format **********

https://ws.nls.fi/rasteriaineistot/image?service=WMS&version=1.1.1&request=GetMap&userId=testuser&width=256&height=256&format=image%2Fpng&layers=ortokuvat&styles=normal&srs=EPSG%3A3067&bbox=364000%2C6909000%2C366000%2C6911133

Mike LP

unread,
Jun 1, 2015, 5:21:38 PM6/1/15
to cesiu...@googlegroups.com, ibnea...@gmail.com, ibnea...@gmail.com
In your code sample you're setting the parameter 'crs' instead of 'srs'.  I believe this is your problem.  If that's still not working you may need to define your own TileScheme that you can pass to the new Cesium.WebMapServiceImageryProvider

ibnea...@gmail.com

unread,
Jun 2, 2015, 3:22:30 AM6/2/15
to cesiu...@googlegroups.com, ibnea...@gmail.com
Hi, yes srs error is solved but now the bbox is still in wgs84 i.e in lat lon i need to be in local coordinates. could you please tell me how to specify this in code? thanks :)

Mike LP

unread,
Jun 2, 2015, 2:21:22 PM6/2/15
to cesiu...@googlegroups.com, ibnea...@gmail.com, ibnea...@gmail.com
The Bounding Box is generated from the TilingScheme that is passed in during creation.  EPSG:3067 is not a predefined tiling scheme so you're going to need to create your own.

Kevin Ring

unread,
Jun 2, 2015, 7:19:50 PM6/2/15
to cesiu...@googlegroups.com
Requesting the tiles in the right projection is only half the battle.  You also need to make sure that Cesium knows how to map them onto the globe or else they will be georeferenced incorrectly.  This is going to be a lot of work.

If at all possible, I recommend using a WMS server that can serve map images in geographic (EPSG:436) or Web Mercator (EPSG:3857).  Pretty much all standard WMS servers can do this, and it will save you many many hours of headaches.

 Kevin

--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Denver Pierce

unread,
Jun 2, 2015, 8:11:36 PM6/2/15
to cesiu...@googlegroups.com, ibnea...@gmail.com
If its coming from geoserver, you should be able to have the server reproject to 4326 or 3857, instead of trying to load it in its native format.

Poul Sørensen

unread,
Aug 26, 2015, 5:20:06 PM8/26/15
to cesium-dev
Saving many hours of headaches, does this means its possible? and has anyone come up with an example.


Gonna use another day try to get a custom projection running myself but hoping someone has tried and succeded. 
Reply all
Reply to author
Forward
0 new messages