Giter Site home page Giter Site logo

Comments (2)

ghettovoice avatar ghettovoice commented on July 25, 2024

Hi!
As I know, to use custom resolutions you need define custom tileGrid with your custom resolutions and extent.
Without that ol3 will create and use a default TileGrid whose resolutions and origin will be determined based on the projection's validity extent. Some information about that link
You need something like that:

<!DOCTYPE html>
<html>
    <head>
        <title>test</title>
        <link rel="stylesheet" href="http://openlayers.org/en/latest/css/ol.css" />
        <style>
            html, body, #map {
                width: 100%;
                height: 100%;
                margin: 0;
            }
        </style>
    </head>
    <body>
        <div id="map"></div>

        <script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.6/proj4.js"></script>
        <script src="http://epsg.io/3943-1753.js"></script>
        <script src="http://openlayers.org/en/latest/build/ol.js"></script>
        <script src="C:/Users/ghetto/Documents/GitHub/ol3-tilecache/dist/ol3-tilecache.js"></script>

        <script>
            var projection = new ol.proj.Projection({
                code: 'EPSG:3943',
                extent: [624227.05, 2076993.88, 2217136.99, 3178000.51]
            });

            var resolutions = [35.2777777778, 17.6388888889, 8.81944444444, 3.52777777778, 1.76388888889, 0.881944444444, 0.705555555556, 0.352777777778, 0.176388888889, 0.0881944444444];
            var layer=new ol.layer.Tile({
                  source: new ol.source.XYZ({
                      tileUrlFunction: 
                      ol.TileCacheUrlFunction.createTileUrlFunction('http://myTilecacheServer/myTileset/{0z}/{x1}/{x2}/{x3}/{-y1}/{-y2}/{-y3}.png'),
                      projection: 'EPSG:3943',
                      tileGrid: new ol.tilegrid.TileGrid({
                          origin: [624227.05, 2076993.88],
                          extent: [624227.05, 2076993.88, 2217136.99, 3178000.51],
                          resolutions: resolutions
                      })
                  })
              });
            var maptest = new ol.Map({
                target: 'map',
                view: new ol.View({
                    projection: 'EPSG:3943',
                    center: [1339328.5216125,2263462.0748125],
                    zoom: 0,
                    resolutions: resolutions
                }),
                layers: [layer]
            });
        </script>
    </body>
</html>

from ol-tilecache.

ghettovoice avatar ghettovoice commented on July 25, 2024

So I close this issue. If you have questions, please, reopen it.

from ol-tilecache.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.