Skip to content

Commit 82bdbfa

Browse files
committed
Simplify examples in README files
1 parent 993bd2e commit 82bdbfa

2 files changed

Lines changed: 66 additions & 0 deletions

File tree

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,39 @@ pnpm start
111111

112112
<br>
113113

114+
## 💡 Usage Examples
115+
116+
### Basic Map with Data Source
117+
118+
```typescript
119+
import {
120+
MapView,
121+
GeoCoordinates,
122+
MapControls,
123+
sphereProjection,
124+
ArcGISWebTileDataSource
125+
} from "@flywave/flywave.gl";
126+
127+
// Initialize map view
128+
const mapView = new MapView({
129+
projection: sphereProjection,
130+
target: new GeoCoordinates(39.9042, 116.4074), // Beijing coordinates
131+
zoomLevel: 10,
132+
canvas: document.getElementById("mapCanvas")
133+
});
134+
135+
// Create data source
136+
const webTileDataSource = new ArcGISWebTileDataSource();
137+
138+
// Add data source to map
139+
mapView.addDataSource(webTileDataSource);
140+
141+
// Add controls for user interaction
142+
const mapControls = new MapControls(mapView);
143+
```
144+
145+
<br>
146+
114147
## 📚 Resources
115148

116149
| Resource | Description | Link |

README.zh.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,39 @@ pnpm start
111111

112112
<br>
113113

114+
## 💡 使用示例
115+
116+
### 带数据源的基础地图
117+
118+
```typescript
119+
import {
120+
MapView,
121+
GeoCoordinates,
122+
MapControls,
123+
sphereProjection,
124+
ArcGISWebTileDataSource
125+
} from "@flywave/flywave.gl";
126+
127+
// 初始化地图视图
128+
const mapView = new MapView({
129+
projection: sphereProjection,
130+
target: new GeoCoordinates(39.9042, 116.4074), // 北京坐标
131+
zoomLevel: 10,
132+
canvas: document.getElementById("mapCanvas")
133+
});
134+
135+
// 创建数据源
136+
const webTileDataSource = new ArcGISWebTileDataSource();
137+
138+
// 添加数据源到地图
139+
mapView.addDataSource(webTileDataSource);
140+
141+
// 添加控制以支持用户交互
142+
const mapControls = new MapControls(mapView);
143+
```
144+
145+
<br>
146+
114147
## 📚 资源链接
115148

116149
| 资源 | 描述 | 链接 |

0 commit comments

Comments
 (0)