Skip to content

Commit

Permalink
Fix Geocoder on defined active layer
Browse files Browse the repository at this point in the history
  • Loading branch information
Son-HNguyen committed Nov 26, 2019
1 parent 0d8929a commit 0e60059
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions 3dwebclient/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ function intiClient() {
if (callGeocodingService != true) {
var gmlId = cesiumViewer.geocoder.viewModel.searchText;
info.cancel = true;
cesiumViewer.geocoder.viewModel.searchText = "Searching now......."
cesiumViewer.geocoder.viewModel.searchText = "Searching now.......";
zoomToObjectById(gmlId, function () {
cesiumViewer.geocoder.viewModel.searchText = gmlId;
}, function () {
Expand Down Expand Up @@ -911,7 +911,13 @@ function zoomToObjectById(gmlId, callBackFunc, errorCallbackFunc) {
var activeLayer = webMap._activeLayer;
if (Cesium.defined(activeLayer)) {
var cityobjectsJsonData = activeLayer.cityobjectsJsonData;
var obj = cityobjectsJsonData[gmlId];
if (!cityobjectsJsonData) {
if (Cesium.defined(errorCallbackFunc)) {
errorCallbackFunc.call(this);
}
} else {
var obj = cityobjectsJsonData[gmlId];
}
if (obj) {
var lon = (obj.envelope[0] + obj.envelope[2]) / 2.0;
var lat = (obj.envelope[1] + obj.envelope[3]) / 2.0;
Expand Down

0 comments on commit 0e60059

Please sign in to comment.