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

Custom CRS EPSG2154 (lambert93) with Flutter Map #16

Open
BartholomeNiji opened this issue Dec 18, 2024 · 0 comments
Open

Custom CRS EPSG2154 (lambert93) with Flutter Map #16

BartholomeNiji opened this issue Dec 18, 2024 · 0 comments

Comments

@BartholomeNiji
Copy link

BartholomeNiji commented Dec 18, 2024

In our project, we need with a Flutter project, Flutter Map to display an Orthophoto tiles as Orthophoto map (with FlutterMap)
for it as our GetTile request is supported on Lambert 93 (EPSG:2154), we need to configure our Flutter Map with a Custom CRS as EPGS:2154, as I did below.

static FM.Proj4Crs epsg2154() {
    P4.Projection.add('EPSG:2154',
        '+proj=lcc +lat_0=46.5 +lon_0=3 +lat_1=49 +lat_2=44 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs');
    return FM.Proj4Crs.fromFactory(
        code: 'EPSG:2154',
        proj4Projection: P4.Projection.get('EPSG:2154')!,
        resolutions: getResolutions(6005281.2, -378305.81, 22),
        bounds: FM.Bounds<double>(
          Point<double>(-378305.81, 6005281.2),
          Point<double>(1320649.57, 7235612.72),
        ));
  }

for getResolutions function is used example I found :

static List<double> getResolutions(double maxX, double minX, int zoom,
      [double tileSize = 512.0]) {
    double size = (maxX - minX) / tileSize;

    return List<double>.generate(zoom, (int z) => size / pow(2, z));
  }

And in my example, I need to watch only Zoom 13,14,15 from orthophoto, but I did put 22 in my example, because resolutions need an 22 list length resolution.
From my GetCapabilites, I have theses informations :

<ows:Identifier>default028mm</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::2154</ows:SupportedCRS>
            ....
<TileMatrix>
    <ows:Identifier>13</ows:Identifier>
    <ScaleDenominator>625.5518463417094</ScaleDenominator>
    <TopLeftCorner>-3.55975E7 4.89531E7</TopLeftCorner>
    <TileWidth>512</TileWidth>
    <TileHeight>512</TileHeight>
    <MatrixWidth>410798</MatrixWidth>
    <MatrixHeight>478446</MatrixHeight>
</TileMatrix>
<TileMatrix>
    <ows:Identifier>14</ows:Identifier>
    <ScaleDenominator>357.1882143763838</ScaleDenominator>
    <TopLeftCorner>-3.55975E7 4.89531E7</TopLeftCorner>
    <TileWidth>512</TileWidth>
    <TileHeight>512</TileHeight>
    <MatrixWidth>719439</MatrixWidth>
    <MatrixHeight>837913</MatrixHeight>
</TileMatrix>
<TileMatrix>
    <ows:Identifier>15</ows:Identifier>
    <ScaleDenominator>178.5941071881919</ScaleDenominator>
    <TopLeftCorner>-3.55975E7 4.89531E7</TopLeftCorner>
    <TileWidth>512</TileWidth>
    <TileHeight>512</TileHeight>
    <MatrixWidth>1438878</MatrixWidth>
    <MatrixHeight>1675825</MatrixHeight>
</TileMatrix>

My TileLayer is build as below :

TileLayer(
urlTemplate: 'pathToOrtho',
tileProvider: OrthophotoTileProviderWithAuth(
                        token: token
                        context: context,
                      ),
 ),

From TileLayer, TileProver TileCoordinates object, we're getting weird result as : TileCoordinate(58262, -1098754, 19)
Are we missing something ? We need a TileCol and a TileRow for our orthophoto endpoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant