Skip to content

Commit d08636f

Browse files
committed
geojson support
1 parent 9d8f9ee commit d08636f

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

examples/basics/geojson.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<div id="map" style="height: 100%; width: 100%"></div>
2+
3+
<script src="../../dist/gridviz.js"></script>
4+
<script src="https://cdn.jsdelivr.net/npm/gridviz-eurostat@2.0.2"></script>
5+
<script>
6+
//define map with initial view
7+
const map = new gridviz.Map(document.getElementById('map'), {
8+
x: 4500000,
9+
y: 2900000,
10+
z: 1000,
11+
}).addZoomButtons()
12+
13+
//define background layer
14+
const backgroundLayer = new gridviz.BackgroundLayer(
15+
gridviz_eurostat.giscoBackgroundLayer('OSMPositronBackground', 18, 'EPSG3035')
16+
)
17+
18+
//add layer to map
19+
map.layers = [backgroundLayer]
20+
map.redraw()
21+
</script>

examples/basics/geojson_test.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"type": "FeatureCollection",
3+
"name": "geojson_test",
4+
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::3035" } },
5+
"features": [
6+
{ "type": "Feature", "properties": { "name": "Amber Fox", "value": 17 }, "geometry": { "type": "Point", "coordinates": [ 4046000.0, 2654000.0 ] } },
7+
{ "type": "Feature", "properties": { "name": "Blue Cedar", "value": 42 }, "geometry": { "type": "MultiPoint", "coordinates": [ [ 4046200.0, 2654000.0 ], [ 4046250.0, 2654050.0 ], [ 4046300.0, 2653980.0 ] ] } },
8+
{ "type": "Feature", "properties": { "name": "Crimson Lake", "value": 85 }, "geometry": { "type": "LineString", "coordinates": [ [ 4046500.0, 2653900.0 ], [ 4046600.0, 2653950.0 ], [ 4046700.0, 2653920.0 ], [ 4046800.0, 2653980.0 ] ] } },
9+
{ "type": "Feature", "properties": { "name": "Delta Pine", "value": 23 }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 4047000.0, 2654100.0 ], [ 4047100.0, 2654200.0 ], [ 4047200.0, 2654150.0 ] ], [ [ 4047000.0, 2654300.0 ], [ 4047100.0, 2654350.0 ], [ 4047200.0, 2654320.0 ] ] ] } },
10+
{ "type": "Feature", "properties": { "name": "Emerald Sky", "value": 64 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 4047500.0, 2653900.0 ], [ 4047700.0, 2653900.0 ], [ 4047700.0, 2654100.0 ], [ 4047500.0, 2654100.0 ], [ 4047500.0, 2653900.0 ] ] ] } },
11+
{ "type": "Feature", "properties": { "name": "Ivory Forest", "value": 58 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 4047304.776716627180576, 2653313.536672802641988 ], [ 4047704.776716627180576, 2653313.536672802641988 ], [ 4047704.776716627180576, 2653713.536672802641988 ], [ 4047304.776716627180576, 2653713.536672802641988 ], [ 4047304.776716627180576, 2653313.536672802641988 ] ], [ [ 4047404.776716627180576, 2653413.536672802641988 ], [ 4047504.776716627180576, 2653413.536672802641988 ], [ 4047504.776716627180576, 2653513.536672802641988 ], [ 4047404.776716627180576, 2653513.536672802641988 ], [ 4047404.776716627180576, 2653413.536672802641988 ] ], [ [ 4047554.776716627180576, 2653538.536672802641988 ], [ 4047654.776716627180576, 2653538.536672802641988 ], [ 4047654.776716627180576, 2653638.536672802641988 ], [ 4047554.776716627180576, 2653638.536672802641988 ], [ 4047554.776716627180576, 2653538.536672802641988 ] ] ] } },
12+
{ "type": "Feature", "properties": { "name": "Golden River", "value": 91 }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 4048000.0, 2653900.0 ], [ 4048150.0, 2653900.0 ], [ 4048150.0, 2654050.0 ], [ 4048000.0, 2654050.0 ], [ 4048000.0, 2653900.0 ] ] ], [ [ [ 4048250.0, 2653900.0 ], [ 4048400.0, 2653900.0 ], [ 4048400.0, 2654050.0 ], [ 4048250.0, 2654050.0 ], [ 4048250.0, 2653900.0 ] ] ] ] } },
13+
{ "type": "Feature", "properties": { "name": "Hidden Stone", "value": 58 }, "geometry": { "type": "GeometryCollection", "geometries": [ { "type": "Point", "coordinates": [ 4048700.0, 2654000.0 ] }, { "type": "LineString", "coordinates": [ [ 4048750.0, 2653950.0 ], [ 4048850.0, 2654050.0 ] ] }, { "type": "Polygon", "coordinates": [ [ [ 4048900.0, 2653900.0 ], [ 4049000.0, 2653900.0 ], [ 4049000.0, 2654000.0 ], [ 4048900.0, 2654000.0 ], [ 4048900.0, 2653900.0 ] ] ] } ] } }
14+
]
15+
}

0 commit comments

Comments
 (0)