Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GeoInt_SIDT
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
GeoInt_SIDT
Commits
7698b12d
Commit
7698b12d
authored
Mar 28, 2019
by
Emmanuel René Huchim Puc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fit on geometry
parent
bb35fe54
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
minimap.js
reports/static/reports/js/minimap.js
+12
-10
No files found.
reports/static/reports/js/minimap.js
View file @
7698b12d
MAPBOX_ACCESS_TOKEN
=
'pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw'
;
// create wkt polygon
const
format
=
new
ol
.
format
.
WKT
();
const
feature
=
format
.
readFeature
(
polygon
,
{
dataProjection
:
'EPSG:4326'
,
featureProjection
:
'EPSG:3857'
});
// Create layers
const
mapbox
=
new
ol
.
layer
.
Tile
({
name
:
'mapbox'
,
...
...
@@ -8,13 +16,7 @@ const mapbox = new ol.layer.Tile({
})
});
// add wkt polygon
const
format
=
new
ol
.
format
.
WKT
();
const
feature
=
format
.
readFeature
(
polygon
,
{
dataProjection
:
'EPSG:4326'
,
featureProjection
:
'EPSG:3857'
});
var
vector
=
new
ol
.
layer
.
Vector
({
const
vector
=
new
ol
.
layer
.
Vector
({
name
:
'polygon'
,
source
:
new
ol
.
source
.
Vector
({
features
:
[
feature
]
...
...
@@ -32,6 +34,9 @@ const map = new ol.Map({
})
});
// fit to polygon
map
.
getView
().
fit
(
feature
.
getGeometry
());
// show first date and current date
let
currentDate
;
...
...
@@ -76,10 +81,7 @@ function addImageLayer(labelDate) {
map
.
addLayer
(
xyz
);
})
let
currentZoom
=
map
.
getView
().
getZoom
();
// fit and zoom
// map.getView().fit(ol.proj.transformExtent(data.boundingBox, 'EPSG:4326', 'EPSG:3857'))
map
.
getView
().
setZoom
(
currentZoom
);
map
.
getView
().
setMinZoom
(
data
.
zoom
.
min
);
map
.
getView
().
setMaxZoom
(
data
.
zoom
.
max
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment