geotrellis / vectorpipe

Convert Vector data to VectorTiles with GeoTrellis.
https://geotrellis.github.io/vectorpipe/
Other
74 stars 20 forks source link

Creating VectorTiles from OSMFeatures #15

Closed fosskers closed 7 years ago

fosskers commented 7 years ago

TODO

Motivation

See #5 .

fosskers commented 7 years ago

I've reduced the Scaladocs to be clearer than they were:

scaladocs-toc

fosskers commented 7 years ago

Clip and Collate might be relegated to the top-level vectorpipe package. That would make for cleaner imports for the user.

fosskers commented 7 years ago

Output of a contrived Analytic VT:

 VectorTile(Map(
   polygons -> StrictLayer(
     polygons,
     4096,
     2,
     Extent(0.0, 0.0, 1000.0, 1000.0),
     Vector(),
     Vector(),
     Vector(),
     Vector(),
     Vector(Feature(
       POLYGON ((1 1, 8 1, 8 4, 1 4, 1 1), (2 2, 2 3, 3 3, 3 2, 2 2), (4 2, 4 3, 5 3, 5 2, 4 2), (6 2, 6 3, 7 3, 7 2, 6 2)),
       Map(
         1037軈route -> VString(footpath),
         timestamp -> VString(2017-03-17T13:29:44.106-07:00[America/Vancouver]),
         1037軈user -> VString(colin),
         visible -> VBool(true),
         10000軈1037軈visible -> VBool(true),
         10000軈1037軈place -> VString(park),
         1037軈userId -> VString(8765),
         10000軈1037軈changeSet -> VInt64(5),
         1037軈version -> VInt64(1),
         envelope_xmax -> VDouble(8.0),
         object -> VString(flagpole),
         1037軈visible -> VBool(true),
         10000軈1037軈user -> VString(colin),
         version -> VInt64(1),
         id -> VInt64(1037),
         1037軈id -> VInt64(10000),
         changeSet -> VInt64(5),
         envelope_ymax -> VDouble(4.0),
         10000軈1037軈timestamp -> VString(2017-03-17T13:29:44.106-07:00[America/Vancouver]),
         10000軈1037軈id -> VInt64(100123),
         envelope_xmin -> VDouble(1.0),
         10000軈1037軈userId -> VString(8765),
         1037軈timestamp -> VString(2017-03-17T13:29:44.106-07:00[America/Vancouver]),
         userId -> VString(8765),
         envelope_ymin -> VDouble(1.0),
         1037軈changeSet -> VInt64(5),
         user -> VString(colin),
         10000軈1037軈version -> VInt64(1)))),
     Vector())),
   Extent(0.0, 0.0, 1000.0, 1000.0)

Note the denormalized metadata fields.

fosskers commented 7 years ago

Did I make a mistake with the API? Something tells me we're being redundant storing the tileExtent in two places.

fosskers commented 7 years ago

Siblings were clobbering each other's metadata. Here's some updated output:

// metadata tree:
 └── 1037
     ├── 10000
     │   └── ∅
     └── 100123
         └── ∅

// Collated metadata:
 Map(10000軈id -> VInt64(10000),
   100123軈user -> VString(colin),
   100123軈userId -> VString(8765),
   timestamp -> VString(2017-03-17T13:52:32.184-07:00[America/Vancouver]),
   100123軈version -> VInt64(1),
   10000軈route -> VString(footpath),
   visible -> VBool(true),
   100123軈id -> VInt64(100123),
   10000軈user -> VString(colin),
   10000軈version -> VInt64(1),
   100123軈visible -> VBool(true),
   100123軈timestamp -> VString(2017-03-17T13:52:32.184-07:00[America/Vancouver]),
   10000軈timestamp -> VString(2017-03-17T13:52:32.184-07:00[America/Vancouver]),
   envelope_xmax -> VDouble(8.0),
   object -> VString(flagpole),
   10000軈visible -> VBool(true),
   10000軈userId -> VString(8765),
   version -> VInt64(1),
   id -> VInt64(1037),
   changeSet -> VInt64(5),
   envelope_ymax -> VDouble(4.0),
   envelope_xmin -> VDouble(1.0),
   100123軈changeSet -> VInt64(5),
   userId -> VString(8765),
   envelope_ymin -> VDouble(1.0),
   100123軈place -> VString(park),
   user -> VString(colin),
   10000軈changeSet -> VInt64(5))

For any given metadata field (except naked ones), the left-most prepended id is the Element id of that Element.

fosskers commented 7 years ago

With new VectorTile pretty-printing, we get:

 tile {

   layer polygons {
     version       = 2
     vt_resolution = 4096
     tile_extent   = Extent(0.0, 0.0, 1000.0, 1000.0)

     features {
       points (0) {}

       multiPoints (0) {}

       lines (0) {}

       multiLines (0) {}

       polygons (1) {
         feature {
           geometry = POLYGON ((1 1, 8 1, 8 4, 1 4, 1 1), (2 2, 2 3, 3 3, 3 2, 2 2), (4 2, 4 3, 5 3, 5 2, 4 2), (6 2, 6 3, 7 3, 7 2, 6 2))

           metadata {
             10000軈id: VInt64(10000)
             100123軈user: VString(colin)
             100123軈userId: VString(8765)
             timestamp: VString(2017-03-17T15:26:48.967-07:00[America/Vancouver])
             100123軈version: VInt64(1)
             10000軈route: VString(footpath)
             visible: VBool(true)
             100123軈id: VInt64(100123)
             10000軈user: VString(colin)
             10000軈version: VInt64(1)
             100123軈visible: VBool(true)
             100123軈timestamp: VString(2017-03-17T15:26:48.967-07:00[America/Vancouver])
             10000軈timestamp: VString(2017-03-17T15:26:48.967-07:00[America/Vancouver])
             envelope_xmax: VDouble(8.0)
             object: VString(flagpole)
             10000軈visible: VBool(true)
             10000軈userId: VString(8765)
             version: VInt64(1)
             id: VInt64(1037)
             changeSet: VInt64(5)
             envelope_ymax: VDouble(4.0)
             envelope_xmin: VDouble(1.0)
             100123軈changeSet: VInt64(5)
             userId: VString(8765)
             envelope_ymin: VDouble(1.0)
             100123軈place: VString(park)
             user: VString(colin)
             10000軈changeSet: VInt64(5)
           }
         }
       }

       multiPolygons (0) {}
     }
   }

 }