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

how add custom geojson file? #9

Open
tsker opened this issue May 17, 2024 · 6 comments
Open

how add custom geojson file? #9

tsker opened this issue May 17, 2024 · 6 comments

Comments

@tsker
Copy link

tsker commented May 17, 2024

I now have a geojson file with some points and areas, I want to add this geojson file to the layer now, how do I do that?

At the same time, I want to filter out certain layers in the data source(input xxx.osm.pbf), such as pois, how to modify the configuration?

Because I have just come into contact with the field of appropriate tiles, I don't know how to do it

very grateful

@MichaelKreil
Copy link
Member

MichaelKreil commented Jun 12, 2024

The simplest approach would be to do that in the frontend:
In Maplibre you have sources and layers. A source can be a tile source or a GeoJSON. Layers define which part of a given source should be visualised in which way.
So if you want to add a GeoJSON, you need to add this GeoJSON as a source (map.addSource) and a layer (map.addLayer) referencing that source.
MapLibre has many examples, like this one.

You can also rearrange the layers to put labels in front of the GeoJSON, or delete layers (like POIs) if you don't need them.

Currently you can do this by creating a style object or using the MapLibre API. Maybe in the future we'll write a library to make this easier.

Currently I'm working on generating and processing vector tiles in https://github.com/versatiles-org/versatiles-rs. Hopefully we will be able to generate vector tiles from GeoJSON in the next weeks. The related issues would be:

@MichaelKreil
Copy link
Member

Here I have an RFC on how to define "virtual tile sources". These are basically tile processing pipelines defined as YAML that can delete layers or add layers from other sources.
What do you think about that?
https://github.com/orgs/versatiles-org/discussions/26

@tsker
Copy link
Author

tsker commented Jun 18, 2024

Thanks for your reply

Using a new layer in maplibre solves this problem

However, this method creates a new data and functionality that is separate from the PBF map data of the basemap

I want to maintain a separate map basemap data, and the rest of the display data is implemented in the form of MAP API

The main source of ideas is in config.json file

"boundary_labels": {
	"minzoom": 2,
	"maxzoom": 14,
	"source": "data/admin-points-4326/admin_points.shp",
	"source_columns": true
}


"ocean-low": {
	"minzoom": 0,
	"maxzoom": 7,
	"source": "data/simplified-water-polygons-split-4326/simplified_water_polygons.shp",
	"source_columns": true,
	"simplify_below": 14,
	"simplify_level": 0.0001,
	"simplify_ratio": 2,
	"write_to": "ocean"
},

boundary_labels <- admin_points.shp and ocean-low.write_to -> ocean

What I want is to add a new copy of the data, or replace the old layer with the new data, just like the one above

Something like this

"new-layer":{
    "source": "data/shp/custom_points.shp",
    "source": "data/geo/custom_points.geojson",
}

"append-layer":{
    "source": "data/shp/custom_points.shp",
    "source": "data/geo/custom_points.geojson",
    "write_to":  "boundaries" or "new-layer-name"
}

Is this possible?

@tsker
Copy link
Author

tsker commented Jun 18, 2024

Here I have an RFC on how to define "virtual tile sources". These are basically tile processing pipelines defined as YAML that can delete layers or add layers from other sources. What do you think about that? https://github.com/orgs/versatiles-org/discussions/26

It looks very good, and it would be a great idea to allow different data sources to be added on top of the original

@MichaelKreil
Copy link
Member

Perhaps there are other ways of doing this. But after testing various approaches, I don't think that "hacking" Tilemaker would be a good long-term solution.

At the moment I'm concentrating on adding the tile processing pipeline to VersaTiles. The current results are very promising. The pipeline runs very efficiently on all CPU cores in parallel. And in general this could be a very powerful tool for processing and converting millions of tiles.

And the one big advantage would be that running VersaTiles as a server would allow each vector tile to be processed on the fly, e.g. adding, removing or changing layers within each tile.

My best guess is that we'll have an alpha version of this feature in the first weeks of July.

@MichaelKreil
Copy link
Member

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

No branches or pull requests

2 participants