Skip to content

Commit 9ce118d

Browse files
authored
Hide GeoJson* interfaces and replace with Azure.Core.GeoJson for Azure.Maps.Search (Azure#46066)
* Hide GeoJson* interfaces and replace with Azure.Core.GeoJson * Update changelog and code snippets * fix typos * Remove unused class member variables in Test
1 parent c8ebad5 commit 9ce118d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+412
-316
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.5.002.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Maps.Search", "src\Azure.Maps.Search.csproj", "{03B3AF31-48B9-46A6-A58D-62025C2F017F}"
7+
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Maps.Search.Tests", "tests\Azure.Maps.Search.Tests.csproj", "{ADCB2CA7-74C6-4BF1-A50F-DA87F9B7170C}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Release|Any CPU = Release|Any CPU
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{03B3AF31-48B9-46A6-A58D-62025C2F017F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17+
{03B3AF31-48B9-46A6-A58D-62025C2F017F}.Debug|Any CPU.Build.0 = Debug|Any CPU
18+
{03B3AF31-48B9-46A6-A58D-62025C2F017F}.Release|Any CPU.ActiveCfg = Release|Any CPU
19+
{03B3AF31-48B9-46A6-A58D-62025C2F017F}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{ADCB2CA7-74C6-4BF1-A50F-DA87F9B7170C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{ADCB2CA7-74C6-4BF1-A50F-DA87F9B7170C}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{ADCB2CA7-74C6-4BF1-A50F-DA87F9B7170C}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{ADCB2CA7-74C6-4BF1-A50F-DA87F9B7170C}.Release|Any CPU.Build.0 = Release|Any CPU
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {241883FC-C7D6-43A7-920D-10675851C3C7}
30+
EndGlobalSection
31+
EndGlobal

sdk/maps/Azure.Maps.Search/CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
## 2.0.0-beta.3 (Unreleased)
44

5-
### Features Added
6-
75
### Breaking Changes
86

9-
### Bugs Fixed
7+
- Hide unnecessary GeoJson interfaces and replace with `Azure.Core.GeoJson` types
108

119
### Other Changes
1210

11+
- Refine test samples
12+
1313
## 2.0.0-beta.2 (2024-08-13)
1414

1515
### Bugs Fixed

sdk/maps/Azure.Maps.Search/README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ List<GeocodingQuery> queries = new List<GeocodingQuery>
167167
};
168168
Response<GeocodingBatchResponse> results = client.GetGeocodingBatch(queries);
169169

170-
//Print coordinates
170+
// Print coordinates
171171
for (var i = 0; i < results.Value.BatchItems.Count; i++)
172172
{
173173
for (var j = 0; j < results.Value.BatchItems[i].Features.Count; j++)
@@ -187,14 +187,18 @@ GetPolygonOptions options = new GetPolygonOptions()
187187
Resolution = ResolutionEnum.Small,
188188
};
189189
Response<Boundary> result = client.GetPolygon(options);
190-
var count = ((GeoJsonPolygon)((GeoJsonGeometryCollection)result.Value.Geometry).Geometries[0]).Coordinates.Count;
191-
for (var i = 0; i < count; i++)
190+
191+
// Print polygon information
192+
Console.WriteLine($"Boundary copyright URL: {result.Value.Properties?.CopyrightUrl}");
193+
Console.WriteLine($"Boundary copyright: {result.Value.Properties?.Copyright}");
194+
195+
Console.WriteLine($"{result.Value.Geometry.Count} polygons in the result.");
196+
Console.WriteLine($"First polygon coordinates (latitude, longitude):");
197+
198+
// Print polygon coordinates
199+
foreach (var coordinate in ((GeoPolygon)result.Value.Geometry[0]).Coordinates[0])
192200
{
193-
var coorCount = ((GeoJsonPolygon)((GeoJsonGeometryCollection)result.Value.Geometry).Geometries[0]).Coordinates[i].Count;
194-
for (var j = 0; j < coorCount; j++)
195-
{
196-
Console.WriteLine(string.Join(",", ((GeoJsonPolygon)((GeoJsonGeometryCollection)result.Value.Geometry).Geometries[0]).Coordinates[i][j]));
197-
}
201+
Console.WriteLine($"{coordinate.Latitude:N5}, {coordinate.Longitude:N5}");
198202
}
199203
```
200204

@@ -204,7 +208,7 @@ for (var i = 0; i < count; i++)
204208
GeoPosition coordinates = new GeoPosition(-122.138685, 47.6305637);
205209
Response<GeocodingResponse> result = client.GetReverseGeocoding(coordinates);
206210

207-
//Print addresses
211+
// Print addresses
208212
for (int i = 0; i < result.Value.Features.Count; i++)
209213
{
210214
Console.WriteLine(result.Value.Features[i].Properties.Address.FormattedAddress);
@@ -228,7 +232,7 @@ List<ReverseGeocodingQuery> items = new List<ReverseGeocodingQuery>
228232
};
229233
Response<GeocodingBatchResponse> result = client.GetReverseGeocodingBatch(items);
230234

231-
//Print addresses
235+
// Print addresses
232236
for (var i = 0; i < result.Value.BatchItems.Count; i++)
233237
{
234238
Console.WriteLine(result.Value.BatchItems[i].Features[0].Properties.Address.AddressLine);

sdk/maps/Azure.Maps.Search/api/Azure.Maps.Search.netstandard2.0.cs

Lines changed: 8 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ internal AddressCountryRegion() { }
114114
public string Iso { get { throw null; } }
115115
public string Name { get { throw null; } }
116116
}
117-
public partial class Boundary : Azure.Maps.Search.Models.GeoJsonFeature
117+
public partial class Boundary
118118
{
119119
internal Boundary() { }
120-
public string Copyright { get { throw null; } }
121-
public string CopyrightUrl { get { throw null; } }
122-
public System.Collections.Generic.IReadOnlyList<Azure.Maps.Search.Models.GeometryCopyright> GeometriesCopyright { get { throw null; } }
123-
public string Name { get { throw null; } }
120+
public string FeatureType { get { throw null; } }
121+
public Azure.Core.GeoJson.GeoCollection Geometry { get { throw null; } }
122+
public string Id { get { throw null; } }
123+
public Azure.Maps.Search.Models.BoundaryProperties Properties { get { throw null; } }
124124
}
125125
public partial class BoundaryProperties
126126
{
@@ -229,8 +229,8 @@ internal ErrorDetail() { }
229229
public partial class FeaturesItem
230230
{
231231
internal FeaturesItem() { }
232-
public System.Collections.Generic.IReadOnlyList<double> BoundingBox { get { throw null; } }
233-
public Azure.Maps.Search.Models.GeoJsonPoint Geometry { get { throw null; } }
232+
public Azure.Core.GeoJson.GeoBoundingBox BoundingBox { get { throw null; } }
233+
public Azure.Core.GeoJson.GeoPoint Geometry { get { throw null; } }
234234
public string Id { get { throw null; } }
235235
public Azure.Maps.Search.Models.FeaturesItemProperties Properties { get { throw null; } }
236236
public Azure.Maps.Search.Models.FeatureTypeEnum? Type { get { throw null; } }
@@ -265,7 +265,7 @@ public partial class GeocodePointsItem
265265
{
266266
internal GeocodePointsItem() { }
267267
public Azure.Maps.Search.Models.CalculationMethodEnum? CalculationMethod { get { throw null; } }
268-
public Azure.Maps.Search.Models.GeoJsonPoint Geometry { get { throw null; } }
268+
public Azure.Core.GeoJson.GeoPoint Geometry { get { throw null; } }
269269
public System.Collections.Generic.IReadOnlyList<Azure.Maps.Search.Models.UsageTypeEnum> UsageTypes { get { throw null; } }
270270
}
271271
public partial class GeocodingBatchRequestItem
@@ -331,38 +331,6 @@ internal GeocodingResponse() { }
331331
public string NextLink { get { throw null; } }
332332
public Azure.Maps.Search.Models.FeatureCollectionEnum? Type { get { throw null; } }
333333
}
334-
public partial class GeoJsonFeature : Azure.Maps.Search.Models.GeoJsonObject
335-
{
336-
internal GeoJsonFeature() { }
337-
public string FeatureType { get { throw null; } }
338-
public Azure.Maps.Search.Models.GeoJsonGeometry Geometry { get { throw null; } }
339-
public string Id { get { throw null; } }
340-
public object Properties { get { throw null; } }
341-
}
342-
public partial class GeoJsonGeometry : Azure.Maps.Search.Models.GeoJsonObject
343-
{
344-
internal GeoJsonGeometry() { }
345-
}
346-
public partial class GeoJsonGeometryCollection : Azure.Maps.Search.Models.GeoJsonGeometry
347-
{
348-
internal GeoJsonGeometryCollection() { }
349-
public System.Collections.Generic.IReadOnlyList<Azure.Maps.Search.Models.GeoJsonGeometry> Geometries { get { throw null; } }
350-
}
351-
public abstract partial class GeoJsonObject
352-
{
353-
protected GeoJsonObject() { }
354-
public System.Collections.Generic.IReadOnlyList<double> BoundingBox { get { throw null; } }
355-
}
356-
public partial class GeoJsonPoint : Azure.Maps.Search.Models.GeoJsonGeometry
357-
{
358-
internal GeoJsonPoint() { }
359-
public System.Collections.Generic.IReadOnlyList<double> Coordinates { get { throw null; } }
360-
}
361-
public partial class GeoJsonPolygon : Azure.Maps.Search.Models.GeoJsonGeometry
362-
{
363-
internal GeoJsonPolygon() { }
364-
public System.Collections.Generic.IReadOnlyList<System.Collections.Generic.IList<System.Collections.Generic.IList<double>>> Coordinates { get { throw null; } }
365-
}
366334
public partial class GeometryCopyright
367335
{
368336
internal GeometryCopyright() { }
@@ -394,9 +362,7 @@ public static partial class MapsSearchModelFactory
394362
public static Azure.Maps.Search.Models.BoundaryProperties BoundaryProperties(string name = null, string copyright = null, string copyrightUrl = null, System.Collections.Generic.IEnumerable<Azure.Maps.Search.Models.GeometryCopyright> geometriesCopyright = null) { throw null; }
395363
public static Azure.Maps.Search.Models.ErrorAdditionalInfo ErrorAdditionalInfo(string type = null, object info = null) { throw null; }
396364
public static Azure.Maps.Search.Models.ErrorDetail ErrorDetail(string code = null, string message = null, string target = null, System.Collections.Generic.IEnumerable<Azure.Maps.Search.Models.ErrorDetail> details = null, System.Collections.Generic.IEnumerable<Azure.Maps.Search.Models.ErrorAdditionalInfo> additionalInfo = null) { throw null; }
397-
public static Azure.Maps.Search.Models.FeaturesItem FeaturesItem(Azure.Maps.Search.Models.FeatureTypeEnum? type = default(Azure.Maps.Search.Models.FeatureTypeEnum?), string id = null, Azure.Maps.Search.Models.FeaturesItemProperties properties = null, Azure.Maps.Search.Models.GeoJsonPoint geometry = null, System.Collections.Generic.IEnumerable<double> boundingBox = null) { throw null; }
398365
public static Azure.Maps.Search.Models.FeaturesItemProperties FeaturesItemProperties(string type = null, Azure.Maps.Search.Models.ConfidenceEnum? confidence = default(Azure.Maps.Search.Models.ConfidenceEnum?), System.Collections.Generic.IEnumerable<Azure.Maps.Search.Models.MatchCodesEnum> matchCodes = null, Azure.Maps.Search.Models.Address address = null, System.Collections.Generic.IEnumerable<Azure.Maps.Search.Models.GeocodePointsItem> geocodePoints = null) { throw null; }
399-
public static Azure.Maps.Search.Models.GeocodePointsItem GeocodePointsItem(Azure.Maps.Search.Models.GeoJsonPoint geometry = null, Azure.Maps.Search.Models.CalculationMethodEnum? calculationMethod = default(Azure.Maps.Search.Models.CalculationMethodEnum?), System.Collections.Generic.IEnumerable<Azure.Maps.Search.Models.UsageTypeEnum> usageTypes = null) { throw null; }
400366
public static Azure.Maps.Search.Models.GeocodingBatchResponse GeocodingBatchResponse(Azure.Maps.Search.Models.GeocodingBatchResponseSummary summary = null, System.Collections.Generic.IEnumerable<Azure.Maps.Search.Models.GeocodingBatchResponseItem> batchItems = null, string nextLink = null) { throw null; }
401367
public static Azure.Maps.Search.Models.GeocodingBatchResponseItem GeocodingBatchResponseItem(string optionalId = null, Azure.Maps.Search.Models.FeatureCollectionEnum? type = default(Azure.Maps.Search.Models.FeatureCollectionEnum?), System.Collections.Generic.IEnumerable<Azure.Maps.Search.Models.FeaturesItem> features = null, string nextLink = null, Azure.Maps.Search.Models.ErrorDetail error = null) { throw null; }
402368
public static Azure.Maps.Search.Models.GeocodingBatchResponseSummary GeocodingBatchResponseSummary(int? successfulRequests = default(int?), int? totalRequests = default(int?)) { throw null; }
@@ -505,10 +471,6 @@ public ReverseGeocodingQuery() { }
505471
public static bool operator !=(Azure.Maps.Search.Models.ReverseGeocodingResultTypeEnum left, Azure.Maps.Search.Models.ReverseGeocodingResultTypeEnum right) { throw null; }
506472
public override string ToString() { throw null; }
507473
}
508-
public partial class UnknownGeoJsonObject : Azure.Maps.Search.Models.GeoJsonObject
509-
{
510-
internal UnknownGeoJsonObject() { }
511-
}
512474
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
513475
public readonly partial struct UsageTypeEnum : System.IEquatable<Azure.Maps.Search.Models.UsageTypeEnum>
514476
{

sdk/maps/Azure.Maps.Search/samples/MapsSearchSamples.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ List<GeocodingQuery> queries = new List<GeocodingQuery>
5757
};
5858
Response<GeocodingBatchResponse> results = client.GetGeocodingBatch(queries);
5959

60-
//Print coordinates
60+
// Print coordinates
6161
for (var i = 0; i < results.Value.BatchItems.Count; i++)
6262
{
6363
for (var j = 0; j < results.Value.BatchItems[i].Features.Count; j++)
@@ -77,14 +77,18 @@ GetPolygonOptions options = new GetPolygonOptions()
7777
Resolution = ResolutionEnum.Small,
7878
};
7979
Response<Boundary> result = client.GetPolygon(options);
80-
var count = ((GeoJsonPolygon)((GeoJsonGeometryCollection)result.Value.Geometry).Geometries[0]).Coordinates.Count;
81-
for (var i = 0; i < count; i++)
80+
81+
// Print polygon information
82+
Console.WriteLine($"Boundary copyright URL: {result.Value.Properties?.CopyrightUrl}");
83+
Console.WriteLine($"Boundary copyright: {result.Value.Properties?.Copyright}");
84+
85+
Console.WriteLine($"{result.Value.Geometry.Count} polygons in the result.");
86+
Console.WriteLine($"First polygon coordinates (latitude, longitude):");
87+
88+
// Print polygon coordinates
89+
foreach (var coordinate in ((GeoPolygon)result.Value.Geometry[0]).Coordinates[0])
8290
{
83-
var coorCount = ((GeoJsonPolygon)((GeoJsonGeometryCollection)result.Value.Geometry).Geometries[0]).Coordinates[i].Count;
84-
for (var j = 0; j < coorCount; j++)
85-
{
86-
Console.WriteLine(string.Join(",", ((GeoJsonPolygon)((GeoJsonGeometryCollection)result.Value.Geometry).Geometries[0]).Coordinates[i][j]));
87-
}
91+
Console.WriteLine($"{coordinate.Latitude:N5}, {coordinate.Longitude:N5}");
8892
}
8993
```
9094

@@ -97,7 +101,7 @@ Translate a coordinate (example: 37.786505, -122.3862) into a human understandab
97101
GeoPosition coordinates = new GeoPosition(-122.138685, 47.6305637);
98102
Response<GeocodingResponse> result = client.GetReverseGeocoding(coordinates);
99103

100-
//Print addresses
104+
// Print addresses
101105
for (int i = 0; i < result.Value.Features.Count; i++)
102106
{
103107
Console.WriteLine(result.Value.Features[i].Properties.Address.FormattedAddress);
@@ -121,7 +125,7 @@ List<ReverseGeocodingQuery> items = new List<ReverseGeocodingQuery>
121125
};
122126
Response<GeocodingBatchResponse> result = client.GetReverseGeocodingBatch(items);
123127

124-
//Print addresses
128+
// Print addresses
125129
for (var i = 0; i < result.Value.BatchItems.Count; i++)
126130
{
127131
Console.WriteLine(result.Value.BatchItems[i].Features[0].Properties.Address.AddressLine);

sdk/maps/Azure.Maps.Search/src/Generated/MapsSearchModelFactory.cs

Lines changed: 0 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/maps/Azure.Maps.Search/src/Generated/Models/Boundary.Serialization.cs renamed to sdk/maps/Azure.Maps.Search/src/Generated/Models/BoundaryInternal.Serialization.cs

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)