Ext.require([
'GeoExt.component.Map',
'GeoExt.data.MapfishPrintProvider',
'GeoExt.data.serializer.TileWMS',
'GeoExt.data.serializer.Vector'
]);
var olMap;
var mapComponent;
var mapPanel;
Ext.application({
name: 'MapPanel',
launch: function() {
var description;
var extentLayer = new ol.layer.Vector({
source: new ol.source.Vector()
});
var vectorLayer = new ol.layer.Vector({
source: new ol.source.Vector({
url: '../data/SanFranciscoPublicSchools-Points.kml',
format: new ol.format.KML(),
attributions: [
'' +
'© 2015 City and County of San Francisco' +
'' +
', (via data.sfgov.org)']
})
});
var bgLayer = new ol.layer.Tile({
source: new ol.source.TileWMS({
url: 'https://ows.terrestris.de/osm-gray/service',
params: {
LAYERS: 'OSM-WMS'
}
})
});
olMap = new ol.Map({
layers: [
bgLayer,
vectorLayer,
extentLayer
],
view: new ol.View({
center: ol.proj.fromLonLat([-122.416667, 37.783333]),
zoom: 12
})
});
mapComponent = Ext.create('GeoExt.component.Map', {
map: olMap
});
mapPanel = Ext.create('Ext.panel.Panel', {
title: 'GeoExt.data.model.print.Capability Example',
region: 'center',
layout: 'fit',
items: [mapComponent]
});
description = Ext.create('Ext.panel.Panel', {
contentEl: 'description',
title: 'Description',
region: 'east',
width: 300,
border: false,
bodyPadding: 5
});
/**
* A small utility method that will change the `baseURL` from https to
* http (if needed and possible), because the MapFish instance we are
* talking to currently cannot handle all 'https' requests.
*
* Please note that this is a restriction posed by the remote server, a
* correctly configured MapFish instance can very well handle https.
*
* @param {Array