@@ -152,7 +152,10 @@ var client = new MapsSearchClient(credential);
152
152
Response < GeocodingResponse > searchResult = client .GetGeocoding (
153
153
" 1 Microsoft Way, Redmond, WA 98052" );
154
154
155
- Console .WriteLine ($" The Coordinate: ({searchResult .Value .Features [0 ].Geometry .Coordinates })" );
155
+ for (int i = 0 ; i < searchResult .Value .Features .Count ; i ++ )
156
+ {
157
+ Console .WriteLine (" Coordinate:" + string .Join (" ," , searchResult .Value .Features [i ].Geometry .Coordinates ));
158
+ }
156
159
```
157
160
158
161
## Batch geocode addresses
@@ -186,9 +189,12 @@ List<GeocodingQuery> queries = new List<GeocodingQuery>
186
189
Response < GeocodingBatchResponse > results = client .GetGeocodingBatch (queries );
187
190
188
191
// Print coordinates
189
- for (var i = 0 ; i < results .Value .BatchItems [ 0 ]. Features .Count ; i ++ )
192
+ for (var i = 0 ; i < results .Value .BatchItems .Count ; i ++ )
190
193
{
191
- Console .WriteLine (" Coordinates" , results .Value .BatchItems [0 ].Features [i ].Geometry .Coordinates );
194
+ for (var j = 0 ; j < results .Value .BatchItems [i ].Features .Count ; j ++ )
195
+ {
196
+ Console .WriteLine (" Coordinates: " + string .Join (" ," , results .Value .BatchItems [i ].Features [j ].Geometry .Coordinates ));
197
+ }
192
198
}
193
199
```
194
200
@@ -214,7 +220,7 @@ Response<GeocodingResponse> result = client.GetReverseGeocoding(coordinates);
214
220
// Print addresses
215
221
for (int i = 0 ; i < result .Value .Features .Count ; i ++ )
216
222
{
217
- Console .WriteLine (result .Value .Features [i ].Properties .Address .AddressLine );
223
+ Console .WriteLine (result .Value .Features [i ].Properties .Address .FormattedAddress );
218
224
}
219
225
```
220
226
@@ -244,8 +250,8 @@ List<ReverseGeocodingQuery> items = new List<ReverseGeocodingQuery>
244
250
},
245
251
new ReverseGeocodingQuery ()
246
252
{
247
- Coordinates = new GeoPosition (- 122 . 138679 , 47 . 630356 )
248
- ResultTypes = new List <ReverseGeocodingResultTypeEnum >(){ ReverseGeocodingResultTypeEnum .Address , ReverseGeocodingResultTypeEnum .Neighborhood }
253
+ Coordinates = new GeoPosition (- 122 . 138679 , 47 . 630356 ),
254
+ ResultTypes = new List <ReverseGeocodingResultTypeEnum >(){ ReverseGeocodingResultTypeEnum .Address , ReverseGeocodingResultTypeEnum .Neighborhood }
249
255
},
250
256
};
251
257
Response < GeocodingBatchResponse > result = client .GetReverseGeocodingBatch (items );
@@ -276,14 +282,21 @@ var client = new MapsSearchClient(credential);
276
282
277
283
GetPolygonOptions options = new GetPolygonOptions ()
278
284
{
279
- Coordinates = new GeoPosition (121 . 5 , 25 . 0 )
285
+ Coordinates = new GeoPosition (- 122 . 204141 , 47 . 61256 ),
286
+ ResultType = BoundaryResultTypeEnum .Locality ,
287
+ Resolution = ResolutionEnum .Small ,
280
288
};
281
289
Response < Boundary > result = client .GetPolygon (options );
282
290
283
- Console .WriteLine (result .Value .Name );
284
- Console .WriteLine (result .Value .Copyright );
285
- Console .WriteLine (result .Value .CopyrightUrl );
286
- Console .WriteLine (result .Value .BoundingBox );
291
+ var count = ((GeoJsonPolygon )((GeoJsonGeometryCollection )result .Value .Geometry ).Geometries [0 ]).Coordinates .Count ;
292
+ for (var i = 0 ; i < count ; i ++ )
293
+ {
294
+ var coorCount = ((GeoJsonPolygon )((GeoJsonGeometryCollection )result .Value .Geometry ).Geometries [0 ]).Coordinates [i ].Count ;
295
+ for (var j = 0 ; j < coorCount ; j ++ )
296
+ {
297
+ Console .WriteLine (string .Join (" ," ,((GeoJsonPolygon )((GeoJsonGeometryCollection )result .Value .Geometry ).Geometries [0 ]).Coordinates [i ][j ]));
298
+ }
299
+ }
287
300
```
288
301
289
302
## Using V1 SDKs for Search and Render
0 commit comments