How to call the table in the database in the front-end code after using and connecting to postgresql #1439
Unanswered
thunder-gzy
asked this question in
Q&A
Replies: 2 comments
-
A demo import "./style.css";
import { Map, View } from "ol";
import MVT from "ol/format/MVT.js";
import TileLayer from "ol/layer/Tile";
import OSM from "ol/source/OSM";
import VectorTileLayer from "ol/layer/VectorTile.js";
import VectorTileSource from "ol/source/VectorTile.js";
let my_layer = new VectorTileLayer({
source: new VectorTileSource({
format: new MVT(),
url: "http://localhost:3000/world_cities/{z}/{x}/{y}", // you could replace the world_cities with the tile source name in your /catalog, and you could also get the URL by visiting http://127.0.0.1:8243/the_tilesource_name_in_your_catalog
}),
});
const map = new Map({
target: "map",
layers: [
new TileLayer({
source: new OSM(),
}),
my_layer,
],
view: new View({
center: [0, 0],
zoom: 2,
}),
}); |
Beta Was this translation helpful? Give feedback.
0 replies
-
If there are two spatial table {
"tiles": {
"points1": { //there is a tile source named points1, you could get its url in http://your_ip:your_port/points1
"content_type": "application/x-protobuf",
"description": "public.points1.geom"
},
"points2": { ////there is a tile source named points2, you could get its url in http://your_ip:your_port/points2
"content_type": "application/x-protobuf",
"description": "public.points2.geom"
}
},
"sprites": {},
"fonts": {}
}
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
By accessing http://127.0.0.1:8243/catalog, you can get the table information in the postgresql database, but how to call these vector data in the front end? Is there a demo?
Beta Was this translation helpful? Give feedback.
All reactions