[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[udig-users] response: add GeoTifff Image
|
I tried with the two solutions but nothing works:
1 Solution:
I'm only new to this so forgive me if I'm barking up the wrong tree, I
was digging around in the CatalogPlugin plugin and think that's what
you're looking for.
You can manually create your service and add it to the catalog like so.
IServiceFactory serviceFactory =
CatalogPlugin.getDefault().getServiceFactory();
IService service = serviceFactory.createService(new URL("file://"+path
<file://%22+path/> ));
try {
IServiceInfo info = service.getInfo( null ); // try connecting to
make sure the service works
if (info != null) {
CatalogPlugin.getDefault().getLocalCatalog().add( service ); //
add service
}
}catch (IOException couldNotConnect ){
service.dispose(new NullProgressMonitor());
}
serviceFactory.createService returns List<IService> and not IService.
And if I write :
List<IService> services = serviceFactory.createService(url);
IService service=services.iterator().next();
I have an exception.
2 solution.
However the catalog provides the acquire method that will do all the
work for you.
IService service =
CatalogPlugin.getDefault().getLocalCatalog().acquire(new
URL("file://"+path <file://"+path> ), new NullProgressMonitor());
Simply call this from your menu contribution and provide the path to
your GeoTiff.
One thing to note is that the acquire method douse not guarantee that a
geotiff
service will be used to render your layer. If it I important
that your layer use a geotiff render you will have to use the manual
service creation method.the class ICatalog doesnt' have the method acquire.
I tried with:
ICatalog icatalog =CatalogPlugin.getDefault().getLocalCatalog();
icatalog.find(url, new NullProgressMonitor());
icatalog.findService(new URL("file://"+selPath));
but nothing append....I don't see the geotiff image inside the 2d map....
________________________________
From:
udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx
[mailto:
udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx] On Behalf Of Alberto
Debiasi
Sent: Wednesday, 22 June 2011 5:52 PM
To: ML udig-users; User-friendly Desktop Internet GIS
Subject: [udig-devel] add GeoTifff Image
Hi,
I wuold like to add a
geoTiff image on a 2D map simply pressing
a button.
The functionality is the same as "right click on a map" -> "add
files" -> "and select a
GeoTiff image"
but I don't know which classes I should use and in which way.
Thanks.
Alberto