Topic: Custom URL To GeoServer

Hi,

I'm trying to use Online Maps with one of our GeoServer instances and though it has a TMS service it seems that the Bing/Google standard isn't actually OGC standard.  It seems that the Bing/Google method assumes top left is 0,0 whereas the OGC standard is that 0,0 is bottom left.

To work around this I've applied this fix to OnlineMapsTiles.cs:
https://alastaira.wordpress.com/2011/07 … ordinates/

    private string CustomProviderReplaceToken(Match match)
    {
        string v = match.Value.ToLower().Trim('{', '}');
        if (v == "zoom") return zoom.ToString();
        if (v == "x") return x.ToString();

        if (v == "y")
        {
            var ymax = 1 << zoom;
            var tempy = ymax - y - 1;
            return tempy.ToString();
        }

        if (v == "quad") return OnlineMapsUtils.TileToQuadKey(x, y, zoom);
        return v;
    }

The problem is that it seems that Lat/Lng are now 180deg out so when I specify 0,0 (lat, lng) it moves the map off the coast of South America rather than Africa.

Do you have any examples of connecting to GeoServer please or suggestions where to look next?

Thanks,
Keegan

Re: Custom URL To GeoServer

Ok, I've carried on playing with this and now have 0,0 mapping correctly by making this change:

private string CustomProviderReplaceToken(Match match)
    {
        string v = match.Value.ToLower().Trim('{', '}');
        if (v == "zoom") return zoom.ToString();
       
        if (v == "x")
        {
            var xmax = 1 << zoom;
            var tempx = xmax / 2;
            return (x + tempx).ToString();
        }

        if (v == "y")
        {
            var ymax = 1 << zoom;
            var tempy = ymax - y - 1;
            return tempy.ToString();
        }

        if (v == "quad") return OnlineMapsUtils.TileToQuadKey(x, y, zoom);
        return v;
    }

Not sure if this is the correct way so I may just be doing it wrong still.

Re: Custom URL To GeoServer

Hello.

Very strange.
Are you sure that your server is TMS server and it works correctly.
If possible, please send your URL pattern. We will check it.

Kind Regards,
Infinity Code Team.

uContext is Editor PowerPack (more than 50 tools) that take your workflow in Unity Editor to a next level, simplifies working with content, adds new features, corrects and improves the editor’s built-in behaviors. Click here to download uContext Basic for free.

Re: Custom URL To GeoServer

Definite user error on my part!  I didn't realise I needed to use EPSG:900913 so my references were way out of range!  I've removed the X hack and gone back to the code in my first post and it's working fine now. smile

Re: Custom URL To GeoServer

Hello.

We have made the necessary changes, so you can do it without code modification.
Example:

using UnityEngine;

public class UsingTMSExample : MonoBehaviour
{
    private void Start()
    {
        OnlineMapsTile.OnReplaceURLToken += OnReplaceURLToken;
    }

    private string OnReplaceURLToken(OnlineMapsTile tile, string token)
    {
        if (token == "y")
        {
            int maxY = 1 << tile.zoom;
            return (maxY - tile.y - 1).ToString();
        }
        return null;
    }
}

Please update Online Maps through the built-in update to the latest beta version.

Kind Regards,
Infinity Code Team.

uContext is Editor PowerPack (more than 50 tools) that take your workflow in Unity Editor to a next level, simplifies working with content, adds new features, corrects and improves the editor’s built-in behaviors. Click here to download uContext Basic for free.

Re: Custom URL To GeoServer

Fantastic, thank you!  I'll update it now. smile

7 (edited by kneave 2016-06-27 13:01:03)

Re: Custom URL To GeoServer

Just tried to update and I can't find an option to do it.  I've looked under:
Components -> Infinity Code -> Online Maps

EDITED:

Found it under help in the inspector. smile

Thanks,
Keegan

Re: Custom URL To GeoServer

Hi,

I am facing the same issues, on trying to use Online Maps with Geoserver WMS and WMTS services.
Is there any guide/help online to point me to the right direction?

Thanks!

Re: Custom URL To GeoServer

Hello.

Please describe your problem in more detail.

Kind Regards,
Infinity Code Team.

uContext is Editor PowerPack (more than 50 tools) that take your workflow in Unity Editor to a next level, simplifies working with content, adds new features, corrects and improves the editor’s built-in behaviors. Click here to download uContext Basic for free.

10 (edited by philzmz 2020-10-04 08:28:50)

Re: Custom URL To GeoServer

Hello
I am trying to get tiles from IGN Geoservice, a french sat images provider, with a very good resolution (max 5cm/pixel).
So I reply to this thread to get infos, as I need some help too.

Here is the link to WMS : https://geoservices.ign.fr/documentatio … s/wms.html
And WMTS : https://geoservices.ign.fr/documentatio … /wmts.html (I don't know if this is supported in RWT / OLMap).

Sorry, these pages are in french, but even though it might help to understand... and Google Translate is our friend !
I will ask for a key if you think this could work with RWT / OLMaps.
Best regards.

Re: Custom URL To GeoServer

IGN has a public WMTS service, and this can be used in Online Maps through Provider - Custom.
URL pattern:

https://wxs.ign.fr/0gd4sx9gxx6ves3hf3hfeyhw/geoportail/wmts?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&STYLE=normal&LAYER=ORTHOIMAGERY.ORTHOPHOTOS&EXCEPTIONS=text/xml&FORMAT=image/jpeg&TILEMATRIXSET=PM&TILEMATRIX={zoom}&TILEROW={y}&TILECOL={x}

But, there is a problem here:
This service checks the request headers and rejects requests with an invalid referrer.
I dont know, why need to make a public REST service, specify it in the documentation, and limit the request this way.
Example of how to work around this limitation is attached.

Unfortunately, RWT does not have the ability to intercept download requests for tiles, so IGN cannot be used for it.

Post's attachments

Attachment icon IGNHook.cs 1.18 kb, 29 downloads since 2020-10-04 

Kind Regards,
Infinity Code Team.

uContext is Editor PowerPack (more than 50 tools) that take your workflow in Unity Editor to a next level, simplifies working with content, adds new features, corrects and improves the editor’s built-in behaviors. Click here to download uContext Basic for free.

Re: Custom URL To GeoServer

Sorry for this very late answer, it works with your pattern, thanks a lot !
But geoportail is very very slow compared to other providers, quite unusable.

Maybe you know this tool : https://remonterletemps.ign.fr/comparer … =doubleMap
You can try the tools on the right, it could be interesting to have a such feature in your assets.

Do you know how I could get the tiles of the cassini map in RWT or OLMaps ?

Re: Custom URL To GeoServer

This is also IGN and it will have the same tile loading speed.

Kind Regards,
Infinity Code Team.

uContext is Editor PowerPack (more than 50 tools) that take your workflow in Unity Editor to a next level, simplifies working with content, adds new features, corrects and improves the editor’s built-in behaviors. Click here to download uContext Basic for free.

14 (edited by philzmz 2021-04-21 15:08:35)

Re: Custom URL To GeoServer

Hello, as I asked on 2020-10-31, is there a way to embed the tiles used in this old map with RWT or OLMaps ?
https://www.geoportail.gouv.fr/donnees/carte-de-cassini
or even better this one : https://rumsey.geogarage.com/maps/cassinige.html

Best regards

Re: Custom URL To GeoServer

If by "embed" you mean you want to download tiles, then yes for Online Maps and no for RWT.
You can download tiles for Online Maps in this way:
https://forum.infinity-code.com/viewtop … 4612#p4612

Geogarage cannot be used because this service has a strange url format for tiles.

Kind Regards,
Infinity Code Team.

uContext is Editor PowerPack (more than 50 tools) that take your workflow in Unity Editor to a next level, simplifies working with content, adds new features, corrects and improves the editor’s built-in behaviors. Click here to download uContext Basic for free.

Re: Custom URL To GeoServer

Alex Vertax wrote:

If by "embed" you mean you want to download tiles, then yes for Online Maps and no for RWT.
You can download tiles for Online Maps in this way:
https://forum.infinity-code.com/viewtop … 4612#p4612

Thanks a lot for this script !!!

Alex Vertax wrote:

Geogarage cannot be used because this service has a strange url format for tiles.

OK for Geogarage, and for Geoportail
https://www.geoportail.gouv.fr/donnees/carte-de-cassini
is it possible ?

Phil

Re: Custom URL To GeoServer

Geoportail is also uses IGN with all the pros and cons.

Kind Regards,
Infinity Code Team.

uContext is Editor PowerPack (more than 50 tools) that take your workflow in Unity Editor to a next level, simplifies working with content, adds new features, corrects and improves the editor’s built-in behaviors. Click here to download uContext Basic for free.

Re: Custom URL To GeoServer

Just if anybody would be interested in displaying Cassini map wit OLMaps :
Use this custom Provider URL : https://wxs.ign.fr/0gd4sx9gxx6ves3hf3hf … ILECOL={x}
+ IGN Hook script.
Best regards !