1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| import { Map, View } from "ol"
import TileLayer from "ol/layer/Tile"
import OSM from "ol/source/OSM"
import { register } from "ol/proj/proj4"
import proj4 from "proj4"
import GeoJSON from "ol/format/GeoJSON"
import VectorSource from "ol/source/Vector"
import VectorLayer from "ol/layer/Vector"
import * as olExtent from "ol/extent"
import { bbox as bboxStrategy } from "ol/loadingstrategy.js"
...
proj4.defs(
"EPSG:2154",
"+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs")
register(proj4)
...
const prescriptionSource = new VectorSource({
format: new GeoJSON(),
url: function (extent) {
return (
"http://xxxx/cgi-bin/mapserv.exe?MAP=C:/ms4w/Apache/site/mapfile/vue_ol_prescription.map&" +
"service=WFS&version=1.1.0&request=GetFeature&typename=prescription&" +
"outputformat=application/json&SRSNAME=EPSG:2154&bbox=" +
extent.join(",") +
",EPSG:3857"
)
},
strategy: bboxStrategy,
})
const prescriptionCouche = new VectorLayer({
source: prescriptionSource,
})
map.addLayer(prescriptionCouche) |
Partager