Commit 169114c1 authored by 吕超's avatar 吕超

fix: 修改省名字图层

parent 0d342b95
NODE_ENV=development NODE_ENV=development
VUE_APP_MAP_INIT_STYLE=http://39.104.87.15/api/tileset VUE_APP_MAP_INIT_STYLE=http://39.104.87.15/api/tileset
VUE_APP_YGYX_URL=http://39.104.87.15/api/rasterviz
VUE_APP_BASE_MAP_URL=http://39.104.87.15/api/basemap/style/
VUE_APP_BASE_URL=http://39.104.87.15 VUE_APP_BASE_URL=http://39.104.87.15
DECIMAL_NUMBER=4 DECIMAL_NUMBER=4
\ No newline at end of file
NODE_ENV=development NODE_ENV=development
VUE_APP_MAP_INIT_STYLE=http://localhost/api/tileset VUE_APP_MAP_INIT_STYLE=http://39.104.87.15/api/tileset
VUE_APP_YGYX_URL=http://localhost/api/rasterviz
VUE_APP_BASE_MAP_URL=http://localhost/api/basemap/style/
VUE_APP_BASE_URL=http://39.104.87.15 VUE_APP_BASE_URL=http://39.104.87.15
DECIMAL_NUMBER=4 DECIMAL_NUMBER=4
\ No newline at end of file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
import mapboxgl from "mapbox-gl"; import mapboxgl from "mapbox-gl";
import { register } from "./config/map.js"; import { register } from "./config/map.js";
import style from "./config/index.js"; import style from "./config/index.js";
import provincePoint from "./config/province_point.json";
export default { export default {
props: { props: {
center: { center: {
...@@ -76,6 +77,7 @@ export default { ...@@ -76,6 +77,7 @@ export default {
map.addLayer(item); map.addLayer(item);
}); });
await this.addProvinceLayer(); await this.addProvinceLayer();
await this.addProvincePoint();
this.$emit("onload", map); this.$emit("onload", map);
}); });
}, },
...@@ -98,24 +100,25 @@ export default { ...@@ -98,24 +100,25 @@ export default {
"fill-color": "rgba(0, 0, 0, 0)", "fill-color": "rgba(0, 0, 0, 0)",
}, },
}); });
},
addProvincePoint() {
this.map.addSource("__province_point", {
type: "geojson",
data: provincePoint,
});
this.map.addLayer({ this.map.addLayer({
id: "__province_title", id: "__province_point",
source: "__province_point",
type: "symbol", type: "symbol",
source: "area_title",
"source-layer": "province",
layout: {
"text-font": ["open-sans"],
"text-field": "{PXZQMC}",
"text-size": 16,
"text-max-width": 5,
},
// maxzoom: 7,
// minzoom: 1,
paint: { paint: {
"text-color": "#fff", "text-color": "#fff",
"text-halo-color": "#000", "text-halo-color": "#000",
"text-halo-width": 1, "text-halo-width": 1,
}, },
layout: {
"text-field": ["get", "P_XZQMC"],
"text-size": 15,
},
}); });
}, },
}, },
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment