VOL3 / v-ol3

Vaadin OpenLayers 3 wrapper
Apache License 2.0
15 stars 18 forks source link

Is there a way to use this addon with offline maps provided let's say by an OepnStreetMap server ? #65

Open sempervivo opened 8 years ago

sempervivo commented 8 years ago

Is there a way to use this addon with offline maps provided let's say by an OepnStreetMap server ?

Styp commented 8 years ago

I need a little more insight...

In my opinion, no. Because you need some sort of WMS/WMTS compatbile source. If you are working offline, you need the tool chain local to provide the map...

sempervivo commented 8 years ago

AFAIK there is a way to install a tile server on the intranet. Here is the discussion: https://help.openstreetmap.org/questions/21059/using-map-of-my-city-on-offline-intranet

Is there a possibility to change the URL address of the WMS source with this addon ?

Styp commented 8 years ago

Ah, yes! I can provide a snippet tomorow, with a custom configuration for OSM. In the end it is a WMS or WMTS Source - you just need to configure the parameters accordingly ;).

sempervivo commented 8 years ago

Great ! Thank you !

Styp commented 8 years ago

What you need is a WMS or TileWMS source. After this it is just a question of the right settings. Until you don't have a WMS Server running, vol3 is probably not your problem - at least not for the moment...

    protected OLSource createSource() {
        OLTileWMSSourceOptions options =new OLTileWMSSourceOptions();
        // WebMapService of World http://www.osm-wms.de/
        options.setUrl("http://129.206.228.72/cached/osm");
        Map<String,String> params=new HashMap<String,String>();
        params.put("LAYERS","osm_auto:all");
        params.put("FORMAT","image/png");
        options.setParams(params);
        options.setGutter(2.0);
        return new OLTileWMSSource(options);
    }

This is an example setup, as we use it. It can be found in demo project. Its the one called 'TileWMSMap'.

Hope this solves your problem...

ImMak commented 8 years ago

Hi Styp, I'm trying to set the offline map but without any success. I have a folder with all the tiles in png divided for zoom levels and I set the above url as path of the folder but no map is shown.

At this point my question is: can it work using that folder or I need a server?

Styp commented 8 years ago

Not sure, I'll have a look at it...

ImMak commented 8 years ago

up

mhosio commented 8 years ago

Surely you need a WMS server. See http://docs.geoserver.org/stable/en/user/services/wms/reference.html for an overview for the requirements for the WMS and the url format. There is no way you could map such requests without additional logic to a set of files on a normal web server. Of course it may be that your browser caches the tiles after loading but that is a different story.

ImMak commented 8 years ago

mhosio thanks for the suggestion but I finally found the solution I was checking for.

Since the OLOSMSource is a OLXYZSource, it's enought to set the URL template:

OLOSMSource source = new OLOSMSource(options); source.setUrlTemplate("my_tiles_folder/{z}/{x}/{y}.png");

This worked fine for me.