use of ol.layer.Image in project gwt-ol3 by TDesjardins.
the class MapGuideExample method show.
/* (non-Javadoc)
* @see de.desjardins.ol3.demo.client.example.Example#show()
*/
@Override
public void show(String exampleId) {
// create a projection
Projection projection = Projection.get("EPSG:4326");
// create a MapGuide params
ImageMapGuideParams imageMapGuideParams = new ImageMapGuideParams();
imageMapGuideParams.setFormat("PNG");
imageMapGuideParams.setMapDefinition("Library://Public/Samples/Sheboygan/Maps/Sheboygan.MapDefinition");
imageMapGuideParams.setUserName("OpenLayers");
imageMapGuideParams.setPassword("OpenLayers");
// create a MapGuide image
ImageMapGuideOptions imageMapGuideOptions = new ImageMapGuideOptions();
imageMapGuideOptions.setParams(imageMapGuideParams);
imageMapGuideOptions.setUrl("http://www.buoyshark.com/mapguide/mapagent/mapagent.fcgi?");
imageMapGuideOptions.setUseOverlay(false);
imageMapGuideOptions.setMetersPerUnit(111319.4908d);
imageMapGuideOptions.setRatio(2.0f);
ImageMapGuide imageMapGuideSource = new ImageMapGuide(imageMapGuideOptions);
LayerOptions layerOptions = new LayerOptions();
Extent bounds = new Extent(-87.865114442365922d, 43.665065564837931d, -87.595394059497067d, 43.823852564430069d);
layerOptions.setExtent(bounds);
layerOptions.setSource(imageMapGuideSource);
Image mapGuideLayer = new Image(layerOptions);
// create a view
ViewOptions viewOptions = new ViewOptions();
viewOptions.setProjection(projection);
viewOptions.setZoom(12.0d);
Coordinate centerCoordinate = new Coordinate(-87.7302542509315d, 43.744459064634d);
viewOptions.setCenter(centerCoordinate);
View view = new View(viewOptions);
// create the map
MapOptions mapOptions = new MapOptions();
mapOptions.setTarget(exampleId);
mapOptions.setView(view);
Collection<Base> lstLayer = new Collection<Base>();
lstLayer.push(mapGuideLayer);
mapOptions.setLayers(lstLayer);
Map map = new Map(mapOptions);
// add some controls
map.addControl(new ScaleLine());
DemoUtils.addDefaultControls(map.getControls());
// add some interactions
map.addInteraction(new KeyboardPan());
map.addInteraction(new KeyboardZoom());
map.addControl(new Rotate());
}
use of ol.layer.Image in project gwt-ol3 by TDesjardins.
the class RasterExample method show.
/*
* (non-Javadoc)
* @see de.desjardins.ol3.demo.client.example.Example#show()
*/
@Override
public void show(String exampleId) {
XyzOptions osmSourceOptions = OLFactory.createOptions();
osmSourceOptions.setCrossOrigin("Anonymous");
Osm osmSource = new Osm(osmSourceOptions);
LayerOptions osmLayerOptions = OLFactory.createOptions();
osmLayerOptions.setSource(osmSource);
// create OSM layer only for background and attribution
Tile osmLayer = new Tile(osmLayerOptions);
// create raster source
Raster raster = getRasterSource(osmSource, RasterOperationType.PIXEL);
LayerOptions layerOptions = OLFactory.createOptions();
layerOptions.setSource(raster);
Image image = new Image(layerOptions);
Collection<Base> layers = new Collection<>();
layers.push(osmLayer);
layers.push(image);
View view = new View();
Coordinate centerCoordinate = new Coordinate(-0.1275, 51.507222);
Coordinate transformedCenterCoordinate = Projection.transform(centerCoordinate, DemoConstants.EPSG_4326, DemoConstants.EPSG_3857);
view.setCenter(transformedCenterCoordinate);
view.setZoom(10);
MapOptions mapOptions = OLFactory.createOptions();
mapOptions.setTarget(exampleId);
mapOptions.setView(view);
mapOptions.setLayers(layers);
Map map = new Map(mapOptions);
// add some controls
DemoUtils.addDefaultControls(map.getControls());
}
use of ol.layer.Image in project gwt-ol3 by TDesjardins.
the class WmsExample method show.
/* (non-Javadoc)
* @see de.desjardins.ol3.demo.client.example.Example#show()
*/
@Override
public void show(String exampleId) {
ImageWmsParams imageWMSParams = OLFactory.createOptions();
imageWMSParams.setLayers("ch.swisstopo.geologie-geotechnik-gk500-gesteinsklassierung,ch.bafu.schutzgebiete-paerke_nationaler_bedeutung");
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
imageWMSOptions.setUrl("http://wms.geo.admin.ch/");
imageWMSOptions.setParams(imageWMSParams);
imageWMSOptions.setRatio(1.5f);
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
LayerOptions layerOptions = OLFactory.createOptions();
layerOptions.setSource(imageWMSSource);
Image wmsLayer = new Image(layerOptions);
// create a projection
ProjectionOptions projectionOptions = OLFactory.createOptions();
projectionOptions.setCode("EPSG:21781");
projectionOptions.setUnits("m");
Projection projection = new Projection(projectionOptions);
// create a view
ViewOptions viewOptions = OLFactory.createOptions();
viewOptions.setProjection(projection);
View view = new View(viewOptions);
Coordinate centerCoordinate = new Coordinate(660000, 190000);
view.setCenter(centerCoordinate);
view.setZoom(9);
// create the map
MapOptions mapOptions = OLFactory.createOptions();
mapOptions.setTarget(exampleId);
mapOptions.setView(view);
Map map = new Map(mapOptions);
map.addLayer(wmsLayer);
// add some controls
map.addControl(new ScaleLine());
DemoUtils.addDefaultControls(map.getControls());
// add some interactions
map.addInteraction(new KeyboardPan());
map.addInteraction(new KeyboardZoom());
map.addControl(new Rotate());
}
use of ol.layer.Image in project gwt-ol3 by TDesjardins.
the class ArcGISExample method show.
/* (non-Javadoc)
* @see de.desjardins.ol3.demo.client.example.Example#show() */
@Override
public void show(String exampleId) {
ImageArcGisRestParams params = new ImageArcGisRestParams();
params.showLayers("2");
ImageArcGisRestOptions options = new ImageArcGisRestOptions();
options.setUrl("https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer");
options.setParams(params);
options.setRatio(1f);
ImageArcGisRest source = new ImageArcGisRest(options);
LayerOptions layerOptions = OLFactory.createOptions();
layerOptions.setSource(source);
Image layer = new Image(layerOptions);
// create a view
View view = new View();
Coordinate center = OLFactory.createCoordinate(-10997148, 4569099);
view.setCenter(center);
view.setZoom(4);
// create the map
MapOptions mapOptions = OLFactory.createOptions();
mapOptions.setTarget(exampleId);
mapOptions.setView(view);
Map map = new Map(mapOptions);
map.addLayer(layer);
// add some controls
map.addControl(new ScaleLine());
DemoUtils.addDefaultControls(map.getControls());
// add some interactions
map.addInteraction(new KeyboardPan());
map.addInteraction(new KeyboardZoom());
map.addControl(new Rotate());
}
use of ol.layer.Image in project gwt-ol3 by TDesjardins.
the class StaticImageExample method show.
/* (non-Javadoc)
* @see de.desjardins.ol3.demo.client.example.Example#show()
*/
@Override
public void show(String exampleId) {
ProjectionOptions projectionOptions = OLFactory.createOptions();
Extent imageExtent = new Extent(0, 0, 1024, 968);
projectionOptions.setCode("pixel");
projectionOptions.setExtent(imageExtent);
projectionOptions.setUnits("pixels");
Projection projection = new Projection(projectionOptions);
ImageStaticOptions imageStaticOptions = OLFactory.createOptions();
imageStaticOptions.setUrl("http://imgs.xkcd.com/comics/online_communities.png");
imageStaticOptions.setImageSize(new Size(1024, 968));
imageStaticOptions.setImageExtent(imageExtent);
imageStaticOptions.setProjection(projection);
// create attribution
imageStaticOptions.setAttributions("© <a href=\"http://xkcd.com/license.html\">xkcd</a>");
ImageStatic imageStatic = new ImageStatic(imageStaticOptions);
LayerOptions layerOptions = OLFactory.createOptions();
layerOptions.setSource(imageStatic);
Image image = new Image(layerOptions);
Collection<Base> layers = new Collection<Base>();
layers.push(image);
ViewOptions viewOptions = OLFactory.createOptions();
viewOptions.setCenter(new Coordinate(500, 500));
viewOptions.setProjection(projection);
viewOptions.setZoom(2);
View view = new View(viewOptions);
MapOptions mapOptions = OLFactory.createOptions();
mapOptions.setTarget(exampleId);
mapOptions.setView(view);
mapOptions.setLayers(layers);
Map map = new Map(mapOptions);
// add some controls
DemoUtils.addDefaultControls(map.getControls());
ol.control.Attribution attributionControl = new ol.control.Attribution();
attributionControl.setCollapsed(false);
map.addControl(attributionControl);
}
Aggregations