Skip to content

Commit 7fd2b22

Browse files
docs(geojson-layer) fix example and wrong information (#9684)
1 parent 9676347 commit 7fd2b22

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

docs/api-reference/layers/geojson-layer.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ import type {BinaryPointFeature} from '@loaders.gl/schema';
501501

502502
data.points = {
503503
type: 'Point',
504-
positions: {value: Float32Array([x0, y0, x1, y1, x2, y2, ...]), size: 2}, // Use size=2 for xy and size=3 for xyz
504+
positions: {value: new Float32Array([x0, y0, x1, y1, x2, y2, ...]), size: 2}, // Use size=2 for xy and size=3 for xyz
505505
// featureIds
506506
// globalFeatureIds
507507
// numericProps
@@ -518,8 +518,8 @@ import type {BinaryLineFeature} from '@loaders.gl/schema';
518518

519519
data.lines = {
520520
type: 'LineString',
521-
positions: {value: Float32Array([x0, y0, x1, y1, x2, y2, ...]), size: 2}, // Use size=2 for xy and size=3 for xyz
522-
pathIndices: {value: Uint16Array([0, 5, 7, ...]), size: 1}, // First line contains vertex 0-4, second line contains vertex 5-6, ...
521+
positions: {value: new Float32Array([x0, y0, x1, y1, x2, y2, ...]), size: 2}, // Use size=2 for xy and size=3 for xyz
522+
pathIndices: {value: new Uint16Array([0, 5, 7, ...]), size: 1}, // First line contains vertex 0-4, second line contains vertex 5-6, ...
523523
// featureIds
524524
// globalFeatureIds
525525
// numericProps
@@ -535,9 +535,9 @@ Polygons are an extension of the idea introduced with lines, but instead of `pat
535535
import type {BinaryPolygonFeature} from '@loaders.gl/schema';
536536

537537
data.polygons = {
538-
positions: {value: Float32Array([x0, y0, x1, y1, x2, y2, ...]), size: 2}, // Use size=2 for xy and size=3 for xyz
539-
polygonIndices: {value: Uint16Array([0, 100, ...]), size: 1}, // First polygon contains vertex 0-99
540-
primitivePolygonIndices: {value: Uint16Array([0, 60, 80, 100, ...]), size: 1}, // First polygon has 2 holes, made of vertex 60-79 and vertex 80-99
538+
positions: {value: new Float32Array([x0, y0, x1, y1, x2, y2, ...]), size: 2}, // Use size=2 for xy and size=3 for xyz
539+
polygonIndices: {value: new Uint16Array([0, 100, ...]), size: 1}, // First polygon contains vertex 0-99
540+
primitivePolygonIndices: {value: new Uint16Array([0, 60, 80, 100, ...]), size: 1}, // First polygon has 2 holes, made of vertex 60-79 and vertex 80-99
541541
// featureIds
542542
// globalFeatureIds
543543
// numericProps
@@ -569,13 +569,13 @@ data.points = {
569569
// featureIds
570570
// globalFeatureIds
571571
numericProps: {
572-
population: {value: Float32Array([value0, value1, ...], size: 1}
572+
population: {value: new Float32Array([value0, value1, ...]), size: 1}
573573
},
574574
// properties
575575
} as BinaryPointFeature
576576
```
577577

578-
Both `properties` and `numericProps` are specified per-feature.
578+
Both `properties` and `numericProps` are specified per-vertex.
579579

580580
#### Feature IDs and global feature IDs
581581

@@ -629,13 +629,13 @@ const geojson: FeatureCollection = {
629629
const binary: BinaryPointFeature = {
630630
shape: 'binary-feature-collection',
631631
points: {
632-
positions: {value: Float32Array([1,23, 4.56]), size: 2},
632+
positions: {value: new Float32Array([1,23, 4.56]), size: 2},
633633
properties: [{name: 'London'}],
634634
numericProps: {
635-
population: {value: Float32Array([10000000], size: 1}
635+
population: {value: new Float32Array([10000000]), size: 1}
636636
},
637-
featureIds: {value: Uint16Array([0]), size: 1},
638-
globalFeatureIds: {value: Uint16Array([0]), size: 1},
637+
featureIds: {value: new Uint16Array([0]), size: 1},
638+
globalFeatureIds: {value: new Uint16Array([0]), size: 1},
639639
fields: [{id: 123}]
640640
}
641641
};

0 commit comments

Comments
 (0)