GeoKeys Property (original) (raw)
Summary
Gets or sets a value that indicates whether any TIFF Geo key tags found in the file should be automatically loaded.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public bool GeoKeys { get; set; }
@property (nonatomic, assign) BOOL geoKeys;
public boolean getGeoKeys()
public void setGeoKeys(boolean value)
public:
property bool GeoKeys {
bool get();
void set ( bool );
}
Property Value
Value | Description |
---|---|
true | To enable automatic load of any TIFF Geo key tags found in the file. |
false | To disable automatic load of any TIFF Geo key tags in the file. The default value is false. |
Example
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;
using Leadtools.Svg;
public void MetadataAutoLoadExample()
{
// Prompt the user for an image file
string imageFileName = PromptForFileName();
// Initialize LEADTOOLS
using (RasterCodecs codecs = new RasterCodecs())
{
CodecsLoadOptions loadOptions = codecs.Options.Load;
// Make sure auto-loading of markers is turned off, otherwise,
// markers take precedence over loading the other metadata
loadOptions.Markers = false;
// Automatically load any tags, comments and geokeys found in this file
loadOptions.Tags = true;
loadOptions.Comments = true;
loadOptions.GeoKeys = true;
// Now load the image
using (RasterImage image = codecs.Load(imageFileName, 0, CodecsLoadByteOrder.BgrOrGray, 1, 1))
{
string txtFileName = Path.Combine(
Path.GetDirectoryName(imageFileName),
Path.GetFileNameWithoutExtension(imageFileName) + "_metadata.txt");
using (StreamWriter writer = File.CreateText(txtFileName))
{
// Show its tags
ShowTags(writer, "Tags", image.Tags);
// Show its comments
ShowComments(writer, image.Comments);
// Show its geo keys (tags and geokeys use the same data type)
ShowTags(writer, "GeoKeys", image.GeoKeys);
}
// Show the text file we created
System.Diagnostics.Process.Start(txtFileName);
}
}
}
private static void ShowTags(StreamWriter writer, string name, IList<RasterTagMetadata> tags)
{
writer.WriteLine("{0}:", name);
foreach (RasterTagMetadata tag in tags)
{
writer.WriteLine("Id: 0x{0}, data length: {1}", tag.Id.ToString("X"), tag.GetData().Length);
}
writer.WriteLine();
}
private static void ShowComments(StreamWriter writer, IList<RasterCommentMetadata> comments)
{
writer.WriteLine("Comments:");
foreach (RasterCommentMetadata comment in comments)
{
writer.WriteLine("Type: 0x{0}, data length: {1}", comment.Type, comment.GetData().Length);
}
writer.WriteLine();
}
Leadtools.Codecs Assembly
CompactFile(Stream,Stream,int,int,bool,int,int,bool,int,CodecsSavePageMode,bool,bool) Method
CompactFile(Stream,Stream,int,int,bool,long,int,bool,long,CodecsSavePageMode,bool,bool,bool) Method
CompactFile(string,string,int,int,bool,int,int,bool,int,CodecsSavePageMode,bool,bool) Method
CompactFile(string,string,int,int,bool,long,int,bool,long,CodecsSavePageMode,bool,bool,bool) Method