Tell me more ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I would like to add this layer to a site I'm working on that uses leaflet:

http://116.240.195.134/vicmapapi/UserGuide.jsp

The API itself is a javascript file based on OpenLayers: http://api.maps.vic.gov.au/vicmapapi/js/vicmapapi.js (I don't know OpenLayers at all, so I'm not really sure what I'm looking at).

Am I able to access the tiles using leaflet? This didn't work:

var map = L.map('map').setView([-37.3, 145.3], 5);

        var wms = L.tileLayer.wms("http://api.maps.vic.gov.au/vicmapapi/map/wms", {
        LAYERS: 'CARTOGRAPHICAL',
        FORMAT: 'image/png',
        FIRSTTITLE: false,
        transparent: true,
        WIDTH:512,
        HEIGHT:512,
        EXCEPTIONS:"application/vnd.ogc.se_inimage",
        SRS:"EPSG:3111"
        });
        wms.addTo(map);

In particular, it didn't work because the tiles it tried to fetch had URLs like this:

http://api.maps.vic.gov.au/vicmapapi/map/wms?service=WMS&request=GetMap&version=1.1.1&layers=&styles=&format=image/jpeg&transparent=true&height=256&width=256&LAYERS=CARTOGRAPHICAL&FORMAT=image/png&FIRSTTITLE=false&WIDTH=512&HEIGHT=512&EXCEPTIONS=application/vnd.ogc.se_inimage&SRS=EPSG:3111&srs=EPSG:3857&bbox=18785164.071364917,-3757032.814272983,20037508.342789244,-2504688.542848655

instead of:

http://api.maps.vic.gov.au/vicmapapi/map/wms?LAYERS=CARTOGRAPHICAL&FORMAT=image%2Fpng&FIRSTTILE=false&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A3111&BBOX=2327867.7504022,2539132.2495979,2869735.5008043,3081000&WIDTH=512&HEIGHT=512&cache_bbox=2296369.732799%2C2279293.001349%2C2931371.002802%2C2702627.181351

The server then returns error messages like "400: (x + width) is outside of Raster". If I increase WIDTH to 10000, then Apache returns 500 Internal Server error with a complaint about Java heap space. Oops.

So - am I barking up the wrong tree here, or is there a way to do this?

share|improve this question
Try zooming in further. Your bounding box contains huge negative numbers. Set the zoomlevel to eg 10. – johanvdw Sep 3 at 7:36
1  
I think the problem might also be due to the SRS being EPSG:3111. Leaflet generally works with EPSG:3857; I'm not aware of the correct way of setting a LeafLet map in another Spatial reference. – Devdatta Tengshe Sep 3 at 8:10
see api.maps.vic.gov.au/vicmapapi/map/wms?request=getcapabilities - as @DevdattaTengshe says the layers are only available as 3111 – iant Sep 3 at 8:19
Thanks. Looks like changing the project in leaflet is possible (blog.kartena.se/…) but won't really help me, as I'd really need to reproject the tiles to match my existing project. – Steve Bennett Sep 4 at 1:17

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.