Browse our Products

If so you can download any of the below versions for testing. The product will function as normal except for an evaluation limitation. At the time of purchase we provide a license file via email that will allow the product to work in its full capacity. If you would also like an evaluation license to test without any restrictions for 30 days, please follow the directions provided here.

 

Aspose.GIS for .NET 24.6

Download  Support Forum 

File Details

  • Downloads:
  • 1
  • File Size:
  • 9.83MB
  • Date Added:
  • 27/6/2024

Description

Aspose.GIS for .NET 24.6 (MSI) release.

File Details

This update to Aspose.GIS for .NET API (MSI installer) brings significant enhancements for developers working with geospatial data. The library’s integration has been improved with persistent geospatial information storage systems, enabling more efficient data access and manipulation.

Enhanced Geospatial Database Integration

The C# geospatial library now offers more robust interaction with various geospatial databases. You can leverage the new DatabaseDataSource and related classes to work with spatial data stored in databases smoothly, as highlighted in the detailed C# code example given below:


    [TestFixture]
    public class PostGisTests : TestFixtureBase
    {
        private DbConnection _conn;

        [OneTimeSetUp]
        public void SetUp()
        {
            _conn = new NpgsqlConnection(TestConfiguration.PostGisConnectionString);
            var testDataFile = Path.Combine(TestConfiguration.TestDataPath, "postgis", "belarus.sql");

            using (var cmd = _conn.CreateCommand())
            {
                try
                {
                    cmd.CommandText = File.ReadAllText(testDataFile);
                    _conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    Console.WriteLine("Error during loading file " + testDataFile);
                    throw;
                }
            }

        }

        [OneTimeTearDown]
        public void TearDown()
        {
            _conn?.Dispose();
        }

        [Test]
        public async Task NeighboringRegionsBasicUsage()
        {
            var builder = new DatabaseDataSourceBuilder();

            builder
                .FromQuery(@"
                        SELECT 
	                        a.osm_id, a.name, a.admin_level, a.boundary, a.population, a.way_area, ST_AsEWKB(a.way) AS way
                        FROM 
	                        tmp_planet_osm_belarus AS a
                        JOIN
	                        tmp_planet_osm_belarus AS b ON b.name = 'Гомельская вобласць'
                        WHERE
	                        ST_Touches(a.way, b.way);
                ")
                .GeometryField("way")
                .AddAttribute("osm_id", AttributeDataType.Long)
                .AddAttribute("name", AttributeDataType.String);

            var layer = await builder.Build().ReadAsync(_conn);

            CollectionAssert.AreEquivalent(new[] { "Мінская вобласць", "Брэсцкая вобласць", "Магілёўская вобласць" }, layer.Select(x => (string)x.GetValue("name")));
        }

        [Test]
        public async Task NeighboringRegionsWithSeparateSridField()
        {
            var builder = new DatabaseDataSourceBuilder();

            builder
                .FromQuery(@"
                        SELECT 
	                        a.osm_id, a.name, a.admin_level, a.boundary, a.population, a.way_area, ST_AsBinary(a.way) AS way, ST_SRID(a.way) AS srid
                        FROM 
	                        tmp_planet_osm_belarus AS a
                        JOIN
	                        tmp_planet_osm_belarus AS b ON b.name = 'Гомельская вобласць'
                        WHERE
	                        ST_Touches(a.way, b.way);
                ")
                .GeometryField("way")
                .AddAttribute("osm_id", AttributeDataType.Long)
                .AddAttribute("name", AttributeDataType.String)
                .SridField("srid");

            var layer = await builder.Build().ReadAsync(_conn);

            // WebMercator because it is a predefined value in the test data, ST_AsBinary wouldn't return srid information.
            Assert.That(layer.Select(x => x.Geometry.SpatialReferenceSystem), Has.All.EqualTo(SpatialReferenceSystem.WebMercator));
        }

        [Test]
        public async Task NeighboringRegionsWithSeparateSridFieldAndEWKB()
        {
            var builder = new DatabaseDataSourceBuilder();

            builder
                .FromQuery(@"
                        SELECT 
	                        a.osm_id, a.name, a.admin_level, a.boundary, a.population, a.way_area, ST_AsEWKB(a.way) AS way, 4326 AS srid
                        FROM 
	                        tmp_planet_osm_belarus AS a
                        JOIN
	                        tmp_planet_osm_belarus AS b ON b.name = 'Гомельская вобласць'
                        WHERE
	                        ST_Touches(a.way, b.way);
                ")
                .GeometryField("way")
                .AddAttribute("osm_id", AttributeDataType.Long)
                .AddAttribute("name", AttributeDataType.String)
                .SridField("srid");

            var layer = await builder.Build().ReadAsync(_conn);

            // Wgs84 (4326) is wrong srs, the right one is this WebMercator but we're deliberately overriding to the wrong one to check that despite the use of ST_AsEWKB
            // overridden value is preferred.
            Assert.That(layer.Select(x => x.Geometry.SpatialReferenceSystem), Has.All.EqualTo(SpatialReferenceSystem.Wgs84));
        }

        [Test]
        public async Task NeighboringRegionsWithAdditionalSrsQuery()
        {
            var builder = new DatabaseDataSourceBuilder();
            var referenceSrs = SpatialReferenceSystem.CreateFromEpsg(4284);

            builder
                .FromQuery(@"
                        SELECT 
	                        a.osm_id, a.name, a.admin_level, a.boundary, a.population, a.way_area, ST_AsEWKB(ST_Transform(a.way, 4284)) AS way
                        FROM 
	                        tmp_planet_osm_belarus AS a
                        JOIN
	                        tmp_planet_osm_belarus AS b ON b.name = 'Гомельская вобласць'
                        WHERE
	                        ST_Touches(a.way, b.way);
                ")
                .GeometryField("way")
                .AddAttribute("osm_id", AttributeDataType.Long)
                .AddAttribute("name", AttributeDataType.String)
                .UseExternalSrsFromQuery(
                    @"SELECT auth_srid, srtext FROM spatial_ref_sys
                    WHERE srid = 4284"
                )
                .ExternalSrsFields("auth_srid", "srtext");

            var layer = await builder.Build().ReadAsync(_conn);

            CollectionAssert.AreEquivalent(new[] { "Мінская вобласць", "Брэсцкая вобласць", "Магілёўская вобласць" }, layer.Select(x => (string)x.GetValue("name")));

            // In case using UseExternalSrsFromQuery we extract information about SRS from db
            // avoiding the use of an embedded SRS information
            Assert.That(layer.Select(x => referenceSrs.Name == x.Geometry.SpatialReferenceSystem.Name).ToArray(), Is.All.EqualTo(true));            
        }
    }

Source*

Convert shapefile to KML Accurately

Developers can expand their document conversion apps’ capabilities with the shapefile to KML conversion option. The latest C# GIS library update improves upon this functionality and allows you to enhance the portfolio of your .NET solutions. The following code example illustrates this conversion:

  // out of range latitude test
   string sourcePath = @"issues\UkraineControlMapAO02JUN2024.shp";
   string destinationPath = "UkraineControlMapAO02JUN2024.kml";
   VectorLayer.Convert(sourcePath, Drivers.Shapefile, destinationPath, Drivers.Kml);
   using (var layer = VectorLayer.Open(destinationPath, Drivers.Kml))
    {
       Assert.AreEqual(11, layer.Count);
       Assert.AreEqual(8, layer.Attributes.Count);
    }   

Source*

New Public APIs

Some of the newly added public API members in this Aspose.GIS for .NET 24.6 release are:

  • Aspose.Gis.Formats.Database.DatabaseDataSource
  • Aspose.Gis.Formats.Database.DatabaseDataSourceBuilder
  • Aspose.Gis.Formats.Database.DatabaseQueryDataSourceBuilder
  • Aspose.Gis.Formats.Database.DatabaseExternalSrsSettingsBuilder
  • Aspose.Gis.FeatureAttributeCollection.System#Collections#IEnumerable#GetEnumerator
  • Aspose.Gis.FeaturesSequence.System#Collections#IEnumerable#GetEnumerator
  • Aspose.Gis.Rendering.Symbolizers.LayeredSymbolizer.System#Collections#IEnumerable#GetEnumerator
  • Aspose.Gis.ImageMetadata.GeoLocation
  • Aspose.Gis.ImageMetadata.GeoLocation.Latitude
  • Aspose.Gis.ImageMetadata.ImageFormat.Png
  • Aspose.Gis.ImageMetadata.ImageFormat.Tiff
  • Aspose.Gis.ImageMetadata.ImageFormat.Exif
  • Aspose.Gis.ImageMetadata.ImageFormat.Icon
  • Aspose.Gis.ImageMetadata.ImageMetadataReader
  • Aspose.Gis.ImageMetadata.ImageMetadataReader.TryGetArtist(System.String@)
  • Aspose.Gis.ImageMetadata.ImageMetadataReader.SetArtist(System.String)
  • Aspose.Gis.ImageMetadata.ImageMetadataReader.TryGetDescription(System.String@)
  • Aspose.Gis.ImageMetadata.ImageMetadataReader.SetDescription(System.String)
  • Aspose.Gis.ImageMetadata.ImageMetadataReader.TryGetModifyDate(System.DateTime@)
  • Aspose.Gis.GeoTools.GeometryOperations.BuildCenterline(Aspose.Gis.Geometries.Polygon)
  • Aspose.Gis.GeoTools.GeometryOperations.GetCenterlineLength(System.Collections.Generic.IEnumerable{Aspose.Gis.Geometries.Point})
  • Aspose.Gis.GeoTools.GeometryOperations.GetCenterlineLength(Aspose.Gis.Geometries.Polygon)
  • Aspose.Gis.Geometries.CircularString.System#Collections#IEnumerable#GetEnumerator
  • Aspose.Gis.Geometries.CompoundCurve.Aspose#Gis#Geometries#ICurve#ToEditable
  • Aspose.Gis.Geometries.CompoundCurve.System#Collections#IEnumerable#GetEnumerator
  • Aspose.Gis.Geometries.GeometryCollection.System#Collections#IEnumerable#GetEnumerator
  • Aspose.Gis.Geometries.LineString.System#Collections#IEnumerable#GetEnumerator
  • Aspose.Gis.Geometries.Polygon.Aspose#Gis#Geometries#ICurvePolygon#get_ExteriorRing
  • Aspose.Gis.Geometries.Polygon.Aspose#Gis#Geometries#ICurvePolygon#GetInteriorRing(System.Int32)
  • Aspose.Gis.Formats.Database.DatabaseDataSource
  • Aspose.Gis.Formats.Database.DatabaseDataSource.#ctor
  • Aspose.Gis.Formats.Database.DatabaseDataSource.ReadAsync(System.Data.Common.DbConnection)
  • Aspose.Gis.Formats.Database.DatabaseDataSourceBuilder
  • Aspose.Gis.Formats.Database.DatabaseDataSourceBuilder.#ctor
  • Aspose.Gis.Formats.Database.DatabaseDataSourceBuilder.FromQuery(System.String)
  • Aspose.Gis.Formats.Database.DatabaseDataSourceBuilder.Build
  • Aspose.Gis.Formats.Database.DatabaseExternalSrsSettingsBuilder
  • Aspose.Gis.Formats.Database.DatabaseExternalSrsSettingsBuilder.ExternalSrsFields(System.String,System.String)
  • Aspose.Gis.Formats.Database.DatabaseQueryDataSourceBuilder
  • Aspose.Gis.Formats.Database.DatabaseQueryDataSourceBuilder.GeometryField(System.String)

You can view the list of all new features, enhancements, and bug fixes introduced in this release by visiting Aspose.GIS for .NET 24.6 Release Notes.

 English