Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use OL10 map instead of OL2 for actions #4743

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions assets/src/modules/Action.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import { mainLizmap } from '../modules/Globals.js';
import { Vector as VectorSource } from 'ol/source.js';
import { Vector as VectorLayer } from 'ol/layer.js';
import GeoJSON from 'ol/format/GeoJSON.js';
import Point from 'ol/geom/Point.js';
import { fromExtent } from 'ol/geom/Polygon.js';
import WKT from 'ol/format/WKT.js';

/**
* @class
Expand Down Expand Up @@ -388,12 +391,13 @@ export default class Action {

// We add the map extent and center
// as WKT geometries
let extent = mainLizmap.lizmap3.map.getExtent().clone();
extent = extent.transform(mainLizmap.lizmap3.map.getProjection(), 'EPSG:4326');
options['mapExtent'] = extent.toGeometry().toString();
let center = mainLizmap.lizmap3.map.getCenter().clone();
center = center.transform(mainLizmap.lizmap3.map.getProjection(), 'EPSG:4326');
options['mapCenter'] = `POINT(${center['lon']} ${center['lat']})`;
const WKTformat = new WKT();
const projOptions = {
featureProjection: mainLizmap.projection,
dataProjection: 'EPSG:4326'
};
options['mapExtent'] = WKTformat.writeGeometry(fromExtent(mainLizmap.extent), projOptions);
options['mapCenter'] = WKTformat.writeGeometry(new Point(mainLizmap.center), projOptions);

// Request action and get data
let url = actionConfigData.url;
Expand Down
Loading