Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tile info #57

Merged
merged 4 commits into from
Sep 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 62 additions & 2 deletions src/Anywhere.ArcGIS/Operation/ServiceDescriptionDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public ServiceDescriptionDetails(ServiceDescription serviceDescription, Action b
throw new ArgumentNullException(nameof(serviceDescription));
}
}

/// <summary>
/// Request for the details of an ArcGIS Server service
/// </summary>
Expand Down Expand Up @@ -79,7 +79,13 @@ public class ServiceDescriptionDetailsResponse : PortalResponse
[DataMember(Name = "spatialReference")]
public SpatialReference SpatialReference { get; set; }

[DataMember(Name = "initialExtent")]
[DataMember(Name = "singleFusedMapCache")]
public bool? SingleFusedMapCache { get; set; }

[DataMember(Name = "tileInfo")]
public TileInfo TileInfo { get; set; }

[DataMember(Name = "initialExtent")]
public Extent InitialExtent { get; set; }

[DataMember(Name = "fullExtent")]
Expand All @@ -93,9 +99,53 @@ public class ServiceDescriptionDetailsResponse : PortalResponse

[DataMember(Name = "layers")]
public List<LayerDetails> Layers { get; set; }

[DataMember(Name = "tables")]
public List<TableDetails> Tables { get; set; }
}

[DataContract]
public class TileInfo
{
[DataMember(Name = "rows")]
public int Rows { get; set; }

[DataMember(Name = "cols")]
public int Cols { get; set; }

[DataMember(Name = "dpi")]
public int Dpi { get; set; }

[DataMember(Name = "format")]
public string Format { get; set; }

[DataMember(Name = "compressionQuality")]
public int CompressionQuality { get; set; }

[DataMember(Name = "origin")]
public Point Origin { get; set; }

[DataMember(Name = "spatialReference")]
public SpatialReference SpatialReference { get; set; }

[DataMember(Name = "lods")]
public List<Lod> Lods { get; set; }
}
[DataContract]
public class Lod
{
[DataMember(Name = "level")]
public int Level { get; set; }

[DataMember(Name = "resolution")]
public double Resolution { get; set; }

[DataMember(Name = "scale")]
public double Scale { get; set; }
}


[DataContract]
public class TimeInfo
{
[DataMember(Name = "timeExtent")]
Expand Down Expand Up @@ -175,4 +225,14 @@ public class LayerDetails
[IgnoreDataMember]
public bool IsGroupLayer { get { return SubLayerIds != null && SubLayerIds.Any() && SubLayerIds.FirstOrDefault() > -1; } }
}

[DataContract]
public class TableDetails
{
[DataMember(Name = "id")]
public int Id { get; set; }

[DataMember(Name = "name")]
public string Name { get; set; }
}
}
24 changes: 23 additions & 1 deletion tests/Anywhere.ArcGIS.Test.Integration/ArcGISGatewayTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,30 @@ public async Task CanDescribeSiteServices(string rootUrl)
Assert.NotNull(serviceDescription.ServiceDescription);
}
}

[Theory]
[InlineData("http://services.arcgisonline.co.nz/arcgis", "Generic/newzealand/MapServer")]
public async Task CanGetServiceTileInfo(string rootUrl, string serviceId)
{
var gateway = new PortalGateway(rootUrl);

var response = await IntegrationTestFixture.TestPolicy.ExecuteAsync(() =>
{
return gateway.DescribeService(serviceId.AsEndpoint());
});

Assert.NotNull(response.SingleFusedMapCache);
Assert.NotNull(response.TileInfo);
Assert.NotNull(response.TileInfo.Lods);
Assert.NotNull(response.TileInfo.Origin);
Assert.NotNull(response.TileInfo.SpatialReference);
Assert.NotNull(response.TileInfo.SpatialReference.Wkid);
Assert.Equal(512, response.TileInfo.Rows);
Assert.Equal(512, response.TileInfo.Cols);
Assert.Equal(96, response.TileInfo.Dpi);

}

[Theory]
[InlineData("http://sampleserver3.arcgisonline.com/ArcGIS/", "Petroleum/KSWells/MapServer/0")]
[InlineData("http://sampleserver3.arcgisonline.com/ArcGIS/", "Petroleum/KSWells/MapServer/1")]
[InlineData("http://services.arcgisonline.co.nz/arcgis", "Canvas/Light/MapServer/0")]
Expand Down