Qgis Web Client - события на стороне клиента.

Вопросы по свободной ГИС QGIS. Сообщения об ошибках, предложения по улучшению, локализация.
Ответить
c4_d
Новоприбывший
Сообщения: 7
Зарегистрирован: 08 июл 2014, 09:18
Репутация: 0

Qgis Web Client - события на стороне клиента.

Сообщение c4_d » 08 июл 2014, 09:29

Доброго времени суток.
После установки Qgis-Web-Client у меня возник вопрос: Как повесить на объект слоя (по id) javaScript (меня интересует click и onmousemove)?

c4_d
Новоприбывший
Сообщения: 7
Зарегистрирован: 08 июл 2014, 09:18
Репутация: 0

Re: Qgis Web Client - события на стороне клиента.

Сообщение c4_d » 08 июл 2014, 12:41

разобрался.
В новой версии клиента имеется файл. Customizations.js. В нем есть заготовки необходимых на первых парах шаблонов. Для большей информации - изучаю openLayers документацию.

c4_d
Новоприбывший
Сообщения: 7
Зарегистрирован: 08 июл 2014, 09:18
Репутация: 0

Re: Qgis Web Client - события на стороне клиента.

Сообщение c4_d » 09 июл 2014, 10:32

Windows 7 OSGeo4W установщик (там есть уже настроенный апач).
Чтобы избежать проблем сразу напишу что я сделал:
1 - Я ставил веб клиент на виртуалку Wmware ESXI 5.5
2 - после установки qgis сервера, возникли трудности с QT DLL-лами - решение поставить заодно десктоп версию QGIS
3 - 64х установщик, не имеет преднастроенного апач, так что выбор пал на 32х версию (я пока что разбераюсь с webклиентом и это решение скорее исследовательское)
4- Customizations.js находится в папке с апач сервером.
5 - Qgis карту надо записать в apps/qgis/bin каталог.
и запустить такую строку в браузере http://localhost/apps/qgis/qgis_mapserv ... pabilities (путь может быть не точным, проверьте его на своей машине - я точно не уверен, но я переименовал свою карту в osm_shp.qgs, тогда все заработало как надо) и перезапустить апач сервер.
после всех манипуляций с установкой клинта можно смело запускать localhost:
http://fotohost.kz/image/2SKE (должно получиться что-то вроде этого)
далее находим Customizations.js и снимаем комментарии с примерами (на картинке видны "гаечные ключи") - 1 из них тестовый, второй уже мой. ссылка на localhost тоже обведена красным цветом, так же вы можете воспользоваться ?map="ваша карта" дополнением строки, но мне на самом деле сейчас это не важно
http://fotohost.kz/image/2SKW

c4_d
Новоприбывший
Сообщения: 7
Зарегистрирован: 08 июл 2014, 09:18
Репутация: 0

Re: Qgis Web Client - события на стороне клиента.

Сообщение c4_d » 09 июл 2014, 10:59

> Qgis Web Client очень слабая
Я бы сказал что её практически нет, специфическая штука уж очень, да и тем более существуют решения более красивые, но, к сожалению, не подходящие под мой проект (я говорю о всяческих янедкс и гуг картах). Поскольку как я понимаю QGIS это скажем так компоновка и сборка нескольких технологий скажем то и документация по этим системам расползается по всему интернету, + QGIS использует свои внутренние механизмы, так что изучение у меня делится на 3 типа 20% гугл, 50% изучение кода, 30% программирование.
> Кстати что вы скажете про Lizmap web client?
Ну что я могу сказать? Это рабочий проект, и поскольку я программист на платформе windows то привык ввиду своей лени пользоваться софтом "из коробки". Для меня Lizmap web client показался слишком долгим в настройке, тем более начальство требует результатов, а "ну я пока ставлю клиент" их не устраивает.

trir
Гуру
Сообщения: 5355
Зарегистрирован: 09 апр 2010, 19:30
Репутация: 1021
Ваше звание: просто мимо прохожу
Откуда: Ё-бург

Re: Qgis Web Client - события на стороне клиента.

Сообщение trir » 09 июл 2014, 11:08

Есть ещё MapGuide

trir
Гуру
Сообщения: 5355
Зарегистрирован: 09 апр 2010, 19:30
Репутация: 1021
Ваше звание: просто мимо прохожу
Откуда: Ё-бург

Re: Qgis Web Client - события на стороне клиента.

Сообщение trir » 09 июл 2014, 11:32

"Проект" - это ведь стили, их можно перегнать через SLD

c4_d
Новоприбывший
Сообщения: 7
Зарегистрирован: 08 июл 2014, 09:18
Репутация: 0

Re: Qgis Web Client - события на стороне клиента.

Сообщение c4_d » 09 июл 2014, 17:16

Код: Выделить всё

//default language code, can be overwritten with lang parameter in URL
var lang = "en"; //for available codes see array availableLanguages in file GlobalOptions.js

//Help file (must be a local file)
var helpfile = "help_en.html";

//Servername (optional) and path and name name of QGIS mapserver FCGI-file
//either with or without server-name - without servername recommended for easier porting to other servers
//do not add a ? or & after the .fcgi extension
//var serverAndCGI = "/cgi-bin/qgis_mapserv.fcgi";
var serverAndCGI = "/qgis/qgis_mapserv.fcgi.exe";

//Define whether you want to use the GetProjectSettings extension of QGIS Server
//for more configuration options in the project.
//Set this to false to use GetCapabilities for older QGIS Server versions (<= 1.8).
var useGetProjectSettings = true;

// show the layerOrderTab in the GUI
var showLayerOrderTab = true;

// show layername in layerTree in gray when layer is outside visible scale
var grayLayerNameWhenOutsideScale = true;

// show the tab metadata in legend
var showMetaDataInLegend = true;

// show maptips when mouse is over object, set to false if you just want to click and show results
// if set to true every mouse position over feature of queriable layers is GetFeatureInfo request on server
var enableHoverPopup = true;

// use geodesic measures, i.e. not planar measures
// this is useful if a projection with high distortion of length/area is used, eg.g. GoogleMercator
var useGeodesicMeasurement = false;

//search box for queries while typing
//enable to use GeoNames search
var useGeoNamesSearchBox = false;
var geoNamesUserName = 'insert your geonames user name';
//URL for custom search scripts
var searchBoxQueryURL = null; // "/wsgi/search.wsgi?query=";
var searchBoxGetGeomURL = null; // "/wsgi/getSearchGeom.wsgi";

// use QGIS WMS highlight for selected search result in search box
var enableSearchBoxWmsHighlight = false;

// If set, will make sure that the layer for the search results is
// visible. This feature will work out of the box if PHP scripts are
// used.
var autoActivateSearchGeometryLayer = true;

// Used to dynamically determine the project.
var project_map = Ext.urlDecode(window.location.search.substring(1)).map;

// PHP based search scripts (postgis layers only)
//var searchBoxQueryURL = '../php/search.php?map=' + project_map;
//var searchBoxGetGeomURL = '../php/search_geom.php?map=' + project_map;

// show the permalink button
var enablePermalink = true;
//use a URL shortener for your permalink function
var permaLinkURLShortener = null; // "/wsgi/createShortPermalink.wsgi";

// enable to use commercial Google and Bing layers (also add BingApiKey)
var enableBingCommercialMaps = false;

if (enableBingCommercialMaps) {
    var bingApiKey = "add Bing api key here"; // http://msdn.microsoft.com/en-us/library/ff428642.aspx
}
var enableGoogleCommercialMaps = false;
var enableBGMaps = false;
if (enableBingCommercialMaps || enableGoogleCommercialMaps) {
	enableBGMaps = false;
}
if (enableBGMaps) {
	// enter the index of the backgroundLayer to be visible after loading, 
	// set to a value < 0 to not show any backgroundLayer
	// this setting is overridden if a value for url-parameter visibleBackgroundLayer is passed
	var initialBGMap = -1;
}

// media base URL to match media links in layer attributes
var mediaurl = '';
// do not show fields in ObjectIdentification results that have null values
var suppressEmptyValues = true;
// hide geometry in ObjectIdentification results (should be only false if there is a good reason to do so)
var suppressInfoGeometry = true;
// do show field names in click-popup during object identification
var showFieldNamesInClickPopup = true;
// show or hide the layer title in the feature info popup
// can be overwritten on a per-project basis in GISProjectListing.js
var showFeatureInfoLayerTitle = true;
// max-width and max-height of the feature-info popup can be controlled in site/css/popup.css


//config for QGIS.SearchPanel
//Number of results: FEATURE_COUNT in WMS request
var simpleWmsSearchMaxResults = 10;

var simpleWmsSearch = {
  title: "Search continent",
  query: 'simpleWmsSearch',
  useWmsRequest: true,
  queryLayer: "Country",
  formItems: [
    {
      xtype: 'textfield',
      name: 'name',
      fieldLabel: "Name",
      allowBlank: false,
      blankText: "Please enter a name (e.g. 'africa')",
      filterOp: "="
    }
  ],
  gridColumns: [
    {header: 'Name', dataIndex: 'name', menuDisabled: 'true'}
  ],
//  highlightFeature: true,
//  highlightLabel: 'name',
  selectionLayer: 'Country',
  selectionZoom: 0,
  doZoomToExtent: true
};

var urlRewriteSearch = {
  title: "Search letter",
  query: 'samplesearch',
  formItems: [
    {
      xtype: 'hidden',
      name: 'query',
      value: 'samplesearch'
    },
    {
      xtype: 'textfield',
      name: 'colour',
      fieldLabel: "Colour",
      allowBlank: false,
      blankText: "Please enter a colour (e.g. 'orange')"
    }
  ],
  gridColumns: [
    {header: 'PKUID', dataIndex: 'pkuid', menuDisabled: 'true'},
    {header: 'Colour', dataIndex: 'colour', menuDisabled: 'true'}
  ],
//  highlightFeature: true,
//  highlightLabel: 'colour',
  selectionLayer: 'Hello',
  selectionZoom: 1
};

//list of configs for QGIS.SearchPanel per map name
var mapSearchPanelConfigs = {
  "helloworld": [simpleWmsSearch, urlRewriteSearch]
};

// ABP: needed for helloworld if no rewrite
mapSearchPanelConfigs[project_map] = [simpleWmsSearch, urlRewriteSearch];

//templates to define tooltips for a layer, to be shown on hover identify. The layer fields must be wrapped inside <%%> special tags.
//if a layers field is found with the name "tooltip" its content will have precedence over this configuration
var tooltipTemplates = {
	'Country':{
		template: "Look for the country on Google Search: <a href='http://www.google.it/#output=search&q=<%name%>' target='_blank'><%name%></a>"
	}
};


// SearchPanel search results output configuration
// by default, search results will be shown in left panel, under the
// search form. Sometimes this is not desired, here you can choose to
// show the results in one of the other panels, like BottomPanel and
// RightPanel. These additional panels are hidden by default because
// their expansion and collapse trigger a map resize->reload cycle that
// can slow down the application.
var mapSearchPanelOutputRegion = 'popup' ; // Possible values: default,right,bottom,popup

// Interactive legend. This is based on PHP get_legend.php script.
// You can define here an alternate URL for this service
//var interactiveLegendGetLegendURL = '../php/get_legend.php?map=' + project_map + '&';


//define whether you want to display a map theme switcher
//note that you have to also link a GISProjectListing.js file containing a valid
//project listing structure - the root object is called 'gis_projects'
//have a look at the template file and documentation for the correct json structure
var mapThemeSwitcherActive = true;
//you can provide an alternative template for the theme-switcher - see also file ThemeSwitcher.js (ThemeSwitcher.prototype.initialize)
var themeSwitcherTemplate = null;

//first part of titlebar text
var titleBarText = "GIS-Browser - "; // will be appended with project title

// header logo image and link
var headerLogoImg = null; // path to image, set null for no logo
var headerLogoHeight = 60; // logo image height in pixels
var headerLogoLink = ""; // logo links to this URL
var headerTermsOfUseText = null; // set null for no link
var headerTermsOfUseLink = ""; // URL to terms of use

// optional project title per map name
var projectTitles = {
  "helloworld": "Hello World"
};

// Optional list of layers that should be displayed in a different image format,
// if the default image format is 8bit.
// The formats are applied in the order of the list, from highest to lowest priority.
/*
var layerImageFormats = [
  {
    format: "image/png",
    layers: ["Country"]
  },
  {
    format: "image/jpeg",
    layers: ["Shaded Relief"]
  }
];
*/

//EPSG projection code of your QGIS project
var authid = "EPSG:"+3857;

//background transparency for the QGIS server generated layer (commercial background layers not effected)
//set to true if you want the background to be transparent, layer image will be bigger (32 vs 24bit)
var qgisLayerTransparency = true;

//number of zoomlevels, uses main map layer and all base layers
var ZOOM_LEVELS = 22;

// OpenLayers global options
// see http://dev.openlayers.org/releases/OpenLayers-2.10/doc/apidocs/files/OpenLayers/Map-js.html
var MapOptions = {
  projection: new OpenLayers.Projection(authid),
  units: "m",
//  maxScale:50,
//  minScale:40000000,
  numZoomLevels:ZOOM_LEVELS,
  fractionalZoom: enableBGMaps ? false : true,
  transitionEffect:"resize",
  controls: []
};

// Options for the main map layer (OpenLayers.layer)
//see http://dev.openlayers.org/releases/OpenLayers-2.12/doc/apidocs/files/OpenLayers/Layer-js.html
var LayerOptions = {
  buffer:0,
  singleTile:true,
  ratio:1,
  transitionEffect:"resize",
  isBaseLayer: false,
  projection:authid,
  yx: {"EPSG:900913": false},
  // If your projection is known to have an inverse axis order in WMS 1.3 compared to WMS 1.1 enter true for yx.
  // For EPSG:900913 OpenLayers should know it by default but because of a bug in OL 2.12 we enter it here.
  tileOptions: {
    // use POST for long URLs
    maxGetUrlLength: 2048
  }
};

//overview map settings - do not change variable names!
var OverviewMapOptions = {
  projection: new OpenLayers.Projection(authid),
  units: "m",
  maxScale:50,
  minScale:300000000,
  transitionEffect:"resize"
};
var OverviewMapSize = new OpenLayers.Size(200,200);
var OverviewMapMaximized = false; // is the overview map opend or closed by default
var overviewLayer = new OpenLayers.Layer.WMS("Overview-Map",
  serverAndCGI+"?map=/home/web/qgis-web-client/projects/naturalearth_110million.qgs",
  {layers:"Land",format:"image/png"},
  {buffer:0,singleTile:true,transitionEffect:"resize"});

// prevent the user from choosing a print resolution
// if fixedPrintResolution = null, the user is allowed to choose the print resolution.
var fixedPrintResolution = null; // for a fixed resolution of 200dpi fill 200

//print options - scales and dpi
var printCapabilities={
  "scales":[
    {"name":"1:100","value":"100"},
    {"name":"1:200","value":"200"},
    {"name":"1:250","value":"250"},
    {"name":"1:500","value":"500"},
    {"name":"1:1'000","value":"1000"},
    {"name":"1:2'000","value":"2000"},
    {"name":"1:3'000","value":"3000"},
    {"name":"1:5'000","value":"5000"},
    {"name":"1:7'500","value":"7500"},
    {"name":"1:10'000","value":"10000"},
    {"name":"1:12'000","value":"12000"},
    {"name":"1:15'000","value":"15000"},
    {"name":"1:20'000","value":"20000"},
    {"name":"1:25'000","value":"25000"},
    {"name":"1:30'000","value":"30000"},
    {"name":"1:50'000","value":"50000"},
    {"name":"1:75'000","value":"75000"},
    {"name":"1:100'000","value":"100000"},
    {"name":"1:250'000","value":"250000"},
    {"name":"1:500'000","value":"500000"},
    {"name":"1:750'000","value":"750000"},
    {"name":"1:1'000'000","value":"1000000"},
    {"name":"1:2'500'000","value":"2500000"},
    {"name":"1:5'000'000","value":"5000000"},
    {"name":"1:7'500'000","value":"7500000"},
    {"name":"1:10'000'000","value":"10000000"},
    {"name":"1:15'000'000","value":"15000000"},
    {"name":"1:20'000'000","value":"20000000"},
    {"name":"1:25'000'000","value":"25000000"},
    {"name":"1:30'000'000","value":"30000000"},
    {"name":"1:35'000'000","value":"35000000"},
    {"name":"1:50'000'000","value":"50000000"},
    {"name":"1:60'000'000","value":"60000000"},
    {"name":"1:75'000'000","value":"75000000"},
    {"name":"1:100'000'000","value":"100000000"},
    {"name":"1:125'000'000","value":"125000000"},
    {"name":"1:150'000'000","value":"150000000"}
 ],
  "dpis":[
    {"name":"150 dpi","value":"150"},
    {"name":"300 dpi","value":"300"},
    {"name":"600 dpi","value":"600"},
    {"name":"1200 dpi","value":"1200"}
  ],
  "layouts":[]
};

// <------------ No changes should be needed below here ------------------>

//new namespace for QGIS extensions
//do not modify those three lines
if (!window.QGIS) {
  window.QGIS = {};
}

//styling definitions for highlightLayer
//is used for hightlighting features (GetFeatureInfo and search result visualization)
//see http://dev.openlayers.org/releases/OpenLayers-2.10/doc/apidocs/files/OpenLayers/Style-js.html
var symbolizersHighLightLayer = {
  "Point": {
    pointRadius: 4,
    graphicName: "circle",
    fillColor: "#FF8C00",
    fillOpacity: 0.3,
    strokeWidth: 1,
    strokeColor: "#FF8C00"
  },
  "Line": {
    strokeWidth: 3,
    strokeOpacity: 1,
    strokeColor: "#FF8C00",
    strokeDashstyle: "dash"
  },
  "Polygon": {
    strokeWidth: 2,
    strokeColor: "#FF8C00",
    fillColor: "none",
    fillOpacity: 0
  }
};

// style for highlight labels of search results
// font weight from 0 to 99 (Light: 25, Normal: 50, DemiBold: 63, Bold: 75, Black: 87)
var highlightLabelStyle = {
//  font: "Serif",
  size: 12,
//  weight: 75,
  color: "#000000",
  buffercolor: "#FFFFFF",
  buffersize: 1
};

//styling for measure controls (distance and area)
var sketchSymbolizersMeasureControls = {
  "Point": {
    pointRadius: 4,
    graphicName: "square",
    fillColor: "#FFFFFF",
    fillOpacity: 1,
    strokeWidth: 1,
    strokeOpacity: 1,
    strokeColor: "#FF0000"
  },
  "Line": {
    strokeWidth: 3,
    strokeOpacity: 1,
    strokeColor: "#FF0000",
    strokeDashstyle: "dash"
  },
  "Polygon": {
    strokeWidth: 2,
    strokeOpacity: 1,
    strokeColor: "#FF0000",
    fillColor: "#FFFFFF",
    fillOpacity: 0.3
  }
};
c:\OSGeo4W\apache\htdocs\WebClient\site\js\GlobalOptions.js
для отключения google спутников и прочих bing поисковиков используйте эту конфигурацию иначе, Customizations.js будет подхватывать google слои.
Если что я делаю не так - пожалуйста поправьте или подскажите умным советом или ссылкой.

Аватара пользователя
chet2
Активный участник
Сообщения: 106
Зарегистрирован: 08 дек 2016, 09:46
Репутация: 6

Re: Qgis Web Client - события на стороне клиента.

Сообщение chet2 » 08 дек 2016, 09:52

Здравствуйте.
У меня создалось впечатление, что на публикуемых с помощью Web Client картах нельзя отобразить подписи, хотя в документации QGis сказано "Используйте возможности символики, подписей, наложения слоёв, чтобы произвести впечатление."

Скажите пожалуйста, так ли это?

Я тестировал так: взял тестовый проект Hello World, открыл в QGis и просто включил отображение подписей к слою Hello, сохранил проект. После этого он перестал открываться в Web Client.

Аватара пользователя
chet2
Активный участник
Сообщения: 106
Зарегистрирован: 08 дек 2016, 09:46
Репутация: 6

Re: Qgis Web Client - события на стороне клиента.

Сообщение chet2 » 08 дек 2016, 10:22

Хотя нет, в этом примере есть подписи:
http://map.jena.de/kartenportal/kartenp ... s=Adressen

Только непонятно как их вывести так, чтобы проект остался работоспособным.

Аватара пользователя
chet2
Активный участник
Сообщения: 106
Зарегистрирован: 08 дек 2016, 09:46
Репутация: 6

Re: Qgis Web Client - события на стороне клиента.

Сообщение chet2 » 08 дек 2016, 10:35

Что за мистика - с третьего раза все получилось. Подписи есть.

Ответить

Вернуться в «QGIS»

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и 1 гость