Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image source fails to render when coordinate area is too large #4550

Closed
anandthakker opened this issue Apr 6, 2017 · 0 comments
Closed

Image source fails to render when coordinate area is too large #4550

anandthakker opened this issue Apr 6, 2017 · 0 comments
Labels

Comments

@anandthakker
Copy link
Contributor

mapbox-gl-js version: master

Steps to Trigger Behavior

In the example below, change longitude to 91 or latitude to 67.

https://jsbin.com/daladaqaze/edit?html,output

  var longitude = 90;
  var latitude = 60;
  var imageStyle = {
    "version": 8,
    "sources": {
        "image": {
            "type": "image",
            "url": "https://i.imgur.com/G06coPX.png",
            "coordinates": [
                [-longitude, latitude],
                [longitude, latitude],
                [longitude, -latitude],
                [-longitude, -latitude]
            ]
        },
        "geojson": {
          "type": "geojson",
          "data": {
            "type": "LineString",
            "coordinates": [
              [-180, -85],
              [-180, 85]
            ]
          }
        }
    },
    "layers": [{
        "id": "background",
        "type": "background",
        "paint": {
            "background-color": "rgb(4,7,14)"
        }
    },
    {
        "id": "dateline",
        "type": "line",
        "source": "geojson",
        "paint": { "line-color": "red" }
    },
    {
        "id": "image",
        "type": "raster",
        "source": "image"
    }]
  };

  var map = new mapboxgl.Map({
      container: 'map',
      style: imageStyle,
      hash: false
  });

Expected Behavior

Image should appear

Actual Behavior

Image does not appear

anandthakker pushed a commit that referenced this issue Apr 6, 2017
Closes #4550

Using `Math.round` on the `centerCoord` value here causes a coordinate
like `{zoom: 2, column: 1.5, row: 1.5}` to become
`{zoom: 2, column: 2, row: 2}`, which is out of bounds for a z2 tile;
the correct tile for containing those coordinates is `{zoom: 2, column: 1, row: 1}`
anandthakker added a commit that referenced this issue Apr 6, 2017
Closes #4550

Using `Math.round` on the `centerCoord` value here causes a coordinate
like `{zoom: 2, column: 1.5, row: 1.5}` to become
`{zoom: 2, column: 2, row: 2}`, which is out of bounds for a z2 tile;
the correct tile for containing those coordinates is `{zoom: 2, column: 1, row: 1}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant