public void Can_transform_point() { var projection = new UTM( 18 ); var projectedPoint = projection.ToProjection( new PointD( -73.5,40.5 ) ); Assert.That( Math.Round(projectedPoint.X,1), Is.EqualTo( 127106.5 + 500000 ) ); Assert.That( Math.Round(projectedPoint.Y,1), Is.EqualTo( 4484124.4 ) ); }
public void Can_inverse_transform() { var projection = new UTM( 18 ); var latLongPoint = projection.FromProjection( new PointD( 127106.5 + 500000,4484124.4 ) ); Assert.That( Math.Round(latLongPoint.X,6), Is.EqualTo( -73.5 ) ); Assert.That( Math.Round(latLongPoint.Y,6), Is.EqualTo( 40.5 ) ); }
public CatalogDirectory( DataDefinitionFile ddf ) { if( ddf.DescriptiveRecord.Directories.Last().Tag == DirectoryDataType.CATD ) { Entries = ddf.DataRecords[ 0 ].Rows.Select( row => new CatalogDirectoryEntry( row ) ).ToList(); var xref = Entries.First( entry => entry.Type == "XREF" ); var directory = xref.File.DescriptiveRecord.Directories.OfType<DDRDirectoryEntry>().First( dir => dir.Type == DDRDirectoryEntryType.FieldList ); var projCol = directory.SubFields.IndexOf( directory.SubFields.First( field => field.Name == "RSNM" ) ); var projection = xref.File.DataRecords[ 0 ].Rows[ 0 ].Fields[projCol].AsString; if( projection.ToUpper() == "UTM" ) { var zoneCol = directory.SubFields.IndexOf( directory.SubFields.First( field => field.Name == "ZONE" ) ); Projection = new UTM( int.Parse(xref.File.DataRecords[ 0 ].Rows[ 0 ].Fields[ zoneCol ].AsString) ); } } }