stackTom / FSEarthTiles

14 stars 2 forks source link

How to create custom url for WMS source? #12

Closed Sgambe33 closed 2 years ago

Sgambe33 commented 2 years ago

Hi again stackTom, I managed to use FSEarthTiles in the right way and now I don't have those 50k images in the cache folder. However now I am wondering how can I add a custom WMS source. I saw that in the providers folder there are a few that actually use WMS but my source has some different parameters: This is the url: http://servizigis.regione.emilia-romagna.it/wms/CGR2018_rgb? And these are the parameters: SERVICE:WMS VERSION:1.3.0 BBOX:1224514.3987260093, 5465442.183322752, 1335833.8895192828, 5621521.486192066 REQUEST:GetMap CRS:EPSG:3857 WIDTH:2048 HEIGHT:2048 LAYERS:Cgr2018_RGB STYLES: FORMAT:image/jpeg DPI:200 MAP_RESOLUTION:200 FORMAT_OPTIONS: TRANSPARENT:TRUE What can I do? Thanks again

stackTom commented 2 years ago

I never added wms support. But that's something I can do relatively easily. Can you give me an example of a full URL with parameters in place to request a tile? I can add this once I have an example. Should not be difficult.

Sgambe33 commented 2 years ago

Here's one for instance: http://servizigis.regione.emilia-romagna.it/wms/CGR2018_rgb?SERVICE=WMS&VERSION=1.3.0&CRS=EPSG:3857&BBOX=1224514.3987260093,5465442.183322752,1335833.8895192828,5621521.486192066&REQUEST=GetMap&WIDTH=2048&HEIGHT=2048&LAYERS=Cgr2018_RGB&STYLES=&FORMAT=image/jpeg&DPI=200&MAP_RESOLUTION=200&FORMAT_OPTIONS=&TRANSPARENT=TRUE The problem is that these requests might accept different arguments. Not every WMS source has the same scheme, hence there's the need to create a configurable request by, for example, specifying the parameters in the .lay file.

stackTom commented 2 years ago

Cool, I began to add support for it. Will let you know when it's ready.

stackTom commented 2 years ago

Almost done adding support for this. Do you have a simple way to convert from lat/long coordinates to the bbox coordinates above?

Sgambe33 commented 2 years ago

Almost done adding support for this. Do you have a simple way to convert from lat/long coordinates to the bbox coordinates above?

What do you mean exactly?

stackTom commented 2 years ago

It's okay, I did some reading and figured it out. Try this test version: if it works well for you, I will release it for everyone: https://app.box.com/s/6zdacerf99w0y1nbnbginqz4zmo9cjv1

You will need to create a new .lay file inside the /Providers folder. Create a new text file with the below:

request_type=wms
tile_size=2048
epsg_code=3857
wms_version=1.3.0
url_prefix=http://servizigis.regione.emilia-romagna.it/wms/CGR2018_rgb?
layers=Cgr2018_RGB
imagery_dir=code
in_GUI=True

Save it to whatever name you want. Extension must be .lay. Then, place it inside one of the folders inside the /Providers folder.

Sgambe33 commented 2 years ago

It works flawlessly! The preview is even faster than some GIS softwares I have tried. I tried other sources and they work too!

stackTom commented 2 years ago

Great! I have released a new version with the above feature: https://github.com/stackTom/FSEarthTiles/releases/tag/v1.4.2