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

Remove Dependency on OL for Extent #42

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
22 changes: 11 additions & 11 deletions WME-FC-Layer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name WME FC Layer
// @namespace https://greasyfork.org/users/45389
// @version 2024.10.05.000
// @version 2024.10.08.000
// @description Adds a Functional Class layer for states that publish ArcGIS FC data.
// @author MapOMatic
// @match *://*.waze.com/*editor*
Expand Down Expand Up @@ -2474,7 +2474,7 @@

const whereParts = [];
const geometry = {
xmin: extent.left, ymin: extent.bottom, xmax: extent.right, ymax: extent.top, spatialReference: { wkid: 102100, latestWkid: 3857 }
xmin: extent[0], ymin: extent[1], xmax: extent[2], ymax: extent[3], spatialReference: { wkid: 4326 }
};
const geometryStr = JSON.stringify(geometry);
const stateWhereClause = state.getWhereClause(context);
Expand Down Expand Up @@ -2589,7 +2589,7 @@
if (_lastPromise) { _lastPromise.cancel(); }
$('#fc-loading-indicator').text('Loading FC...');

const mapContext = { zoom: W.map.getZoom(), extent: getOLMapExtent() };
const mapContext = { zoom: W.map.getZoom(), extent: W.map.getExtent() };
if (mapContext.zoom > MIN_ZOOM_LEVEL) {
const parentContext = { callCount: 0, startTime: Date.now() };

Expand Down Expand Up @@ -2628,14 +2628,14 @@
}
}

function getOLMapExtent() {
let extent = W.map.getExtent();
if (Array.isArray(extent)) {
extent = new OpenLayers.Bounds(extent);
extent.transform('EPSG:4326', 'EPSG:3857');
}
return extent;
}
// function getOLMapExtent() {
// let extent = W.map.getExtent();
// if (Array.isArray(extent)) {
// extent = new OpenLayers.Bounds(extent);
// extent.transform('EPSG:4326', 'EPSG:3857');
// }
// return extent;
// }

function onLayerCheckboxChanged(checked) {
setEnabled(checked);
Expand Down