[mapguide-users] MapGuide OpenLayers 6 Example without NODE
Jackie Ng
jumpinjackie at gmail.com
Mon Jan 11 02:18:56 PST 2021
Another tip *if you have to use ol.js*
When looking at their API docs, to figure out what the equivalent browser
global API is for their documented ES6 modules, just mentally translate
every instance of "/" to "."
So if you want to create a GeoJSON driver. Their ES docs say to import as
so:
import GeoJSON from "ol/format/GeoJSON";
...
const driver = new GeoJSON();
The browser global equivalent (after including ol.js in the script tag) is:
var driver = new ol.format.GeoJSON();
Most classes in OpenLayers are structured in this manner.
But seriously, you should be using node, webpack, et al to do frontend web
dev. Not because it's cool or fashionable. But because it's the is de-facto
standard way to do frontend dev in our current year.
The only reason you'd go with ol.js is if you're trying to integrate
OpenLayers into a "legacy" web site or web application that is not
compatible with modern frontend webdev.
- Jackie
--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
More information about the mapguide-users
mailing list