-1

I have around 1 million(might increase in future) objects in an array(GeoJSON) which looks like this:

[{
          "id": 4472,
          "type": "Feature",
          "properties": {
            "id": 1,
            "key1": 123,
            "key2": 123.8484211,
            "key3": 123.1713833,
            // around 15 more keys
          },
          "geometry": {
            "type": "Polygon",
            "coordinates": [
              [
                [-104.33, 34],
                [-104.33, 33.67],
                [-104.67, 33.67],
                [-104.67, 34],
                [-104.33, 34]
              ]
            ]
          }
}]

I'm using Mapbox in an Angular project, I want to plot polygon on a map, there are repeated polygons in the array.

Since I can't use GeoJSON directly since it crashes the browser, I have been uploading(0.5 million data for now) it to MTS and then using it as vector. From zoom level 0-6 it drops some tile and I also get a warning

 Features were dropped from bakeries layer in 29 tile(s) to enforce tile size limits. Affected zoom levels are: 0,1,2,3,4,5,6. Affected tiles and their required layer_sizes include: ...

How can I fix this? Is there any other solutions, libraries or SaaS product I should look at?

I have been through several documentation, GeoJSON for large dataset, tileset, filter, zoom level affected how to fix it FAQ in Mapbox If there is a completely new solution that I should go forward with please do let me know.

Khaled Ayed
  • 1,121
  • 3
  • 12
  • 29

1 Answers1

0
  1. You might try a GeoJSON layer with clustering (on lower zoom levels; 0-12) to reduce the number of features being rendered (does this only work with Point layers ?).
  2. Use a geo-fence (bounding box) of a part of the complete dataset at higher zoom levels (12-22) so to reduce again the number of geometries being rendered.

Furthermore you might try discriminating the data with filters based on some strong discriminating property of which only one propety value can be visualised at a time.

For example: let's state there is a property "category" with values: "cat" | "dog" | "fish" | "elephant". If each category roughly represents 25% of the data this will positively impact the performance with approximately 75%.

Youp Bernoulli
  • 5,303
  • 5
  • 39
  • 59