The createLayer method of the LayerFactory class is deprecated. How do I create a raster layer?
The createLayer method of the LayerFactory class is deprecated. How do I create a raster layer?
The code in 1.x was something like this:
.. code-block:: java
String filename;
BaseView view;
FLayer newLayer = LayerFactory.createLayer(filename, "gvSIG Image Driver",new File(filename), view.getProjection());
In 2.0 the code is:
.. code-block:: java
String filename;
IView view;
DataStoreParameters parameters = DALLocator.getDataManager().createStoreParameters(RasterStoreProvider.NAME);
parameters.setDynValue("filename", filename);
parameters.setDynValue("srs", view.getViewDocument().getMapContext().getProjection());
FLayer newLayer = MapContextLocator.getMapContextManager().createLayer(filename, parameters);