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

I cant display points. I can't change the style points/polygons. #255

Open
r4naf opened this issue Mar 9, 2021 · 1 comment
Open

I cant display points. I can't change the style points/polygons. #255

r4naf opened this issue Mar 9, 2021 · 1 comment

Comments

@r4naf
Copy link

r4naf commented Mar 9, 2021

I have only polygons and points in my database. It is in one table and one column. I do not store any more signs (river, house, etc. ... this is not).
Polygons are displayed normally. I just need to display the points, with my own style. It's strange why the points are not shown.
Also, I cannot change the style for all polygons.
I looked at the help. Perhaps I need something much simpler ...
Thank you in advance!

<script type="text/javascript"  src="https://unpkg.com/leaflet.vectorgrid@1.2.0"></script>

<script>
var vectorTileStyling = {}
var openmaptilesUrl = "http://192.168.0.57:8080/{z}/{x}/{y}.pbf";
var openMapTilesLayer = L.vectorGrid.protobuf(openmaptilesUrl, {
	vectorTileLayerStyles: vectorTileStyling,
	attribution: '© OpenStreetMap contributors, © MapTiler'
});
...
var overlays = {
	"Vector Tiles": openMapTilesLayer
};
...
L.control.layers(baseLayers, overlays).addTo(mymap);
</script>

SQL on server:

WITH webmercator(envelope) AS (
  SELECT ST_TileEnvelope(15, 20891, 9773)
)
SELECT ST_AsMVT(tile) FROM (
	SELECT osm_id , tile1 FROM (
	  SELECT osm_id, ST_AsMVTGeom(poly3857, (SELECT envelope FROM webmercator)) as tile1
	  FROM polygon43
	) a
	where tile1 is not null)
AS tile

DBeaver
DBeaver2

@r4naf
Copy link
Author

r4naf commented Mar 9, 2021

<script>
		var vectorTilePolyOption = {
			rendererFactory: L.canvas.tile,
				vectorTileLayerStyles: {
					default: function(e) {
						console.log(e)
						return{
							color: '#00F',
							weight: 1
						}
					},
				},
			};
		
		var openmaptilesUrl = "http://192.168.0.57:8080/{z}/{x}/{y}.pbf";
		var openMapTilesLayer = L.vectorGrid.protobuf(openmaptilesUrl, vectorTilePolyOption);
</script>

Happened! But the points are not shown in any way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant