MVT Rendering Programmatically

classic Classic list List threaded Threaded
5 messages Options
AndreaB AndreaB
Reply | Threaded
Open this post in threaded view
|

MVT Rendering Programmatically

Hello Everyone,

I'm trying to properly render a styled MVT (*.mbtiles or similar) programmatically. I have successfully run the various examples of osgEarth using an *.earth file, however I'm interested in doing the same using a C++ code so that I can add/remove MVT layers at runtime, providing a runtime-defined style.

I have not found any sample code about it, neither in osgEarth nor Googling in the web.

Does anyone know if there is a way of doing that?

I'm using osgEarth 2.10.1 with GDAL 2.3.

Thanks in advance for your kind replies.

Andrea
remoe remoe
Reply | Threaded
Open this post in threaded view
|

Re: MVT Rendering Programmatically

Hi Andrea

Here are samples you can look into it:

https://github.com/gwaldron/osgearth/blob/master/src/applications/osgearth_toc/osgearth_toc.cpp
https://github.com/gwaldron/osgearth/blob/master/tests/mapbox.earth


You will not find a "working" solution. You need to study osgEarth code ;)

Cheers

Remo Eichenberger, Switzerland
AndreaB AndreaB
Reply | Threaded
Open this post in threaded view
|

Re: MVT Rendering Programmatically

Hi remoe,

Thanks for your reply. I am looking for a "direct" solution avoiding, if possible, an external style file.

Best regards

Andrea
From: remoe [via osgEarth] <ml+[hidden email]>
Sent: Friday, December 20, 2019 2:29:14 PM
To: Andrea Bracci <[hidden email]>
Subject: Re: MVT Rendering Programmatically
 
Hi Andrea

Here are samples you can look into it:

https://github.com/gwaldron/osgearth/blob/master/src/applications/osgearth_toc/osgearth_toc.cpp
https://github.com/gwaldron/osgearth/blob/master/tests/mapbox.earth


You will not find a "working" solution. You need to study osgEarth code ;)

Cheers

Remo Eichenberger, Switzerland



If you reply to this email, your message will be added to the discussion below:
http://forum.osgearth.org/MVT-Rendering-Programmatically-tp7592995p7593009.html
To unsubscribe from MVT Rendering Programmatically, click here.
NAML
Alexey Alexey
Reply | Threaded
Open this post in threaded view
|

Re: MVT Rendering Programmatically

In reply to this post by AndreaB
I make like this

    osgEarth::Drivers::MVTFeatureOptions featureData;
    featureData.url() = fileName;
    featureData.name() = "Vector UFO";


    osgEarth::Drivers::FeatureSourceLayerOptions MVTSourceOptins;
    MVTSourceOptins.featureSource() = featureData;
    MVTSourceOptins.name() = "Vector-data";

    _layerSource = new osgEarth::Features::FeatureSourceLayer(MVTSourceOptins);
    _map->addLayer(_layerSource);

    osgEarth::Drivers::FeatureModelLayerOptions MVTModelOptins;
    MVTModelOptins.name() = "1111";
    MVTModelOptins.featureSourceLayer() = "Vector-data";

    osgEarth::Features::FeatureModelLayer *MVTLayer = new osgEarth::Features::FeatureModelLayer(MVTModelOptins);
    MVTLayer->setName("vector-data 111");

    _map->addLayer(MVTLayer);

But it only load data. You need set style.
AndreaB AndreaB
Reply | Threaded
Open this post in threaded view
|

Re: MVT Rendering Programmatically

Thanks Alexey,

following your hints I have successfully managed to render an MVT file and I have successfully added a style like the ones contained in the example *.earth files.

However I'm not able to configure the zoom level at which the engine will start rendering the MVT tiles. I know that osgEarth renders only the highest available zoom level, however It seems that osgEarth loads a potentially huge number of tiles event at a low zoom level.

Is there a way to tell osgEarth to start rendering the MVT tiles at a specified zoom level? I need it without setting the min and max visible range since it only hides the farthest tiles.

Thanks very much.

Andrea