Re: [gdal-dev] gtiff with internal mask

2013-07-22 Thread Duarte Carreira
To solve the overviews I created an external mask file instead, in step 3, by 
removing the option --config GDAL_TIFF_INTERNAL_MASK YES  from the command.

As I am using GDAL 1.9.2 I don't know if this issue is caused by the solved 
issue in 1.10 (https://trac.osgeo.org/gdal/wiki/Release/1.10.0-News):
When building overviews, if the image has already an internal mask, then build 
internal overviews for the mask implicitely 

I ended up with this set of files:

Mosaic.tif
Mosaic.tif.msk
Mosaic.tif.msk.ovr
Mosaic.tif.ovr

And to use in qgis, corresponding to step 4:
Mosaic_rgba_qgis.vrt

Duarte

-Mensagem original-
De: Duarte Carreira 
Enviada: quinta-feira, 18 de Julho de 2013 13:01
Para: 'Even Rouault'
Cc: 'gdal-dev@lists.osgeo.org'
Assunto: RE: [gdal-dev] gtiff with internal mask

So... now I 've got issues building the overviews. Gdaladdo loses the 
transparency so I get to see black areas where I was supposed to see nothing. 
When I zoom in black disappears.

Any known way to overcome this?

Thanks,
Duarte



-Mensagem original-
De: Duarte Carreira
Enviada: quarta-feira, 17 de Julho de 2013 19:41
Para: 'Even Rouault'
Cc: gdal-dev@lists.osgeo.org
Assunto: RE: [gdal-dev] gtiff with internal mask

Well, you're right... I messed up recreating the footsteps...

So, cleaning up:

1) create a rgba vrt using gdalwarp to cut the original mosaic with a shapefile 
gdalwarp -multi -wm 480 --config GDAL_CACHEMAX 312 -co alpha=yes -dstalpha 
-cutline shapes\index_diss.shp -of vrt originalmosaic.vrt test_rgba_uncomp.vrt

2) create a masked uncompressed vrt using gdal_translate (because I couldn't 
compress right away, with errors of missing StripOffsets field) gdal_translate 
-b 1 -b 2 -b 3 -mask 4 -co alpha=no -co photometric=rgb -co interleave=pixel 
-co tiled=yes --config GDAL_TIFF_INTERNAL_MASK YES -of vrt  
test_rgba_uncomp.vrt testmask_uncomp.vrt

3) create final masked compressed tiff using gdal_translate gdal_translate -co 
alpha=no -co photometric=ycbcr -co interleave=pixel -co tiled=yes -co 
compress=jpeg --config GDAL_TIFF_INTERNAL_MASK YES testmask_uncomp.vrt 
test_finalmask.tif

The power of VRT amazes me!

Also regarding sizes: I still got the same ratio of 8x smaller.

To use this in QGIS you still have to create a rgba vrt:
4) gdal_translate -of VRT -b 1 -b 2 -b 3 -b mask test_finalmask.tif 
test_finalmask_qgis.vrt (couldn't get the 4ª band to be recognized as an alpha 
band though)

So I think now it's correct... I am going to apply this to a real-case mosaic 
and report back...

Duarte

-Mensagem original-
De: Even Rouault [mailto:even.roua...@mines-paris.org]
Enviada: quarta-feira, 17 de Julho de 2013 13:45
Para: Duarte Carreira
Cc: gdal-dev@lists.osgeo.org
Assunto: Re: [gdal-dev] gtiff with internal mask

Le mercredi 17 juillet 2013 14:23:29, Duarte Carreira a écrit :
 Hi Even.
 
 Thanks so much for your tip! It works. I did have to specify I did not 
 want an alpha band when cutting with the shapefile:
 
 gdalwarp -multi -wm 480 --config GDAL_CACHEMAX 256 -co 
 photometric=ycbcr -co compress=jpeg -co alpha=no --config 
 GDAL_TIFF_INTERNAL_MASK YES -cutline shapes\index_diss.shp vrtini.vrt 
 testmask.tif

Hum, what I don't understand is how the above will produce a mask band in the 
output file...

Does gdalinfo on testmask.tif show something like :

Band 1 Block= Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET
Band 2 Block= Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET
Band 3 Block=... Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET 

I think you would need to do the above in 2 steps:
1) gdalwarp to an uncompressed RGBA TIFF
2) gdal_translate to turn the RGBA into a YCbCr JPEG-compressed GTiff + mask 
band

 
 Seems arcgis recognizes the masked tiff, but is much much slower 
 displaying than using a normal alpha band.

Perhaps adding -co TILED=YES will help ? (random guess)

 QGIS does need the vrt trick but then is as fast as usual.
 
 Also, the size is must smaller when using an internal mask: from a 
 219MB rgba,band interleaved,jpegd image to a 27MB ycbcr,pixel 
 interleaved,jpegd masked tiff (8x smaller). Unless I missed something...

Not completely surprising although more important than I would have expected. 
YCbCr compression usually gives a 2x to 3x compression bonus, and due to the 
usual nature of mask bands, the 1bit deflate compression of the mask band will 
give better results (both visually and in size) that the 8bit JPEG compression 
of the alpha band.

 
 Thanks again!
 Duarte
 
 -Mensagem original-
 De: Even Rouault [mailto:even.roua...@mines-paris.org]
 Enviada: terça-feira, 16 de Julho de 2013 18:58
 Para: gdal-dev@lists.osgeo.org
 Cc: Duarte Carreira
 Assunto: Re: [gdal-dev] gtiff with internal mask
 
 Le mardi 16 juillet 2013 12:29:37, Duarte Carreira a écrit :
  I'm trying to create gtiffs with transparent areas where there are 
  voids between my original images.
  
  I have successfully done it by using an alpha 

[gdal-dev] OGRErr OGRLayer::CreateField // cant create fields

2013-07-22 Thread Mauro Pisano
Hi guys!

Im having a problem by using the OGRLayter::CreateField method, it isnt
creating the field as the description saids :).

Maybe you can see the error or have an idea to go out of this hole.

Here are the lines of code:

*...*
*...*
*   OGRLayer* player = pvector-GetLayer(0);*

*   if (player-GetLayerDefn()-GetFieldIndex(SUR_HOTLINK_FIELD)  0) {*
  // If the field doesnt exist, I create it.
*  OGRFieldDefn field(SUR_HOTLINK_FIELD, OFTString);*
  // Try to insert it to the table.
*  if ( player-CreateField(field, TRUE) == OGRERR_NONE )*
* SHOW_ERROR(D:Error trying to create field);*
*   }*
*...*
*...*

*NOTES:*
the first line returns me without problems the Working Layer ( I just
 using just 1 layer to avoid confusions )
the first IF returns that there arent any SUR_HOTLINK_FIELD in the table (
that its OK! )

and de last IF returns that the CreateField gives distinct as OGRERR_NONE.


Thanks in advance!

Mauro Pisano
SUR Emprendimientos Tecnológicos

Perú 345  Piso 5to Oficina B (C1067AAG)
Ciudad de Buenos Aires, Argentina
Tel. +54 (11) 4342-2976/84
mauropis...@suremptec.com.ar
www.suremptec.com
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] OGRErr OGRLayer::CreateField // cant create fields

2013-07-22 Thread Even Rouault
Le lundi 22 juillet 2013 22:58:39, Mauro Pisano a écrit :
 Hi guys!
 
 Im having a problem by using the OGRLayter::CreateField method, it isnt
 creating the field as the description saids :).
 
 Maybe you can see the error or have an idea to go out of this hole.
 
 Here are the lines of code:
 
 *...*
 *...*
 *   OGRLayer* player = pvector-GetLayer(0);*
 
 *   if (player-GetLayerDefn()-GetFieldIndex(SUR_HOTLINK_FIELD)  0) {*
   // If the field doesnt exist, I create it.
 *  OGRFieldDefn field(SUR_HOTLINK_FIELD, OFTString);*
   // Try to insert it to the table.
 *  if ( player-CreateField(field, TRUE) == OGRERR_NONE )*
 * SHOW_ERROR(D:Error trying to create field);*
 *   }*
 *...*
 *...*
 
 *NOTES:*
 the first line returns me without problems the Working Layer ( I just
  using just 1 layer to avoid confusions )
 the first IF returns that there arent any SUR_HOTLINK_FIELD in the table (
 that its OK! )
 
 and de last IF returns that the CreateField gives distinct as OGRERR_NONE.

Mauro,

You didn't really give a lot of context. But several possible causes :
- the datasource is not opened in update mode
- the driver does not support field creation at all

Even

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

[gdal-dev] How do I tell if an OGRSpatialReference has been initialized?

2013-07-22 Thread David Strip
Given an OGRSpatialReference class object, how do I tell if it's been 
initialized to anything? (ie,clear() was called or else was constructed 
with a null string an no further action was taken to set the SRS?)
I've looked over the interface and can't spot anything that tells me 
it's in a clear state, but of course I might have missed it.


Thanks
David


___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] A new ogr driver

2013-07-22 Thread Xian Chen
Well, here is my confirmation:

As an authorized representative of Walkinfo Technology Co., Ltd., I
understand that the submitted code  to the GDAL project will be contributed
under the MIT/X license.

Thanks,
Xian


Even Rouault wrote
 Le vendredi 19 juillet 2013 03:31:12, Xian Chen a écrit :
 Hi all,
 
 I'm planning to submit a new driver for accessing Walk files, a
 geospatial
 data format developed  by Walkinfo Tech. mainly for land surveying,
 evaluation, planning, checking and data analysis in China.
 
 Walkinfo Tech. is a China-based company founded since 1999, origignally
 focused on land surveying software research and development. Currently we
 have our own geographic information platform WalkGIS, as well as scores
 of
 GIS desktop, mobile products based on it, including WalkISurvey,
 WalkISurface, WalkCheck, WalkFu and so on. The company is also the
 largest
 strategic partner with Esri ArcGIS in China.
 
 The WalkGIS applications use GDAL/OGR as part of its base libaries. The
 purpose of developing the Walk driver on GDAL/OGR is to allow other GIS
 products such as ArcGIS to access our data more easily and conveniently.
 
 The driver I am working on is already able to get the information such as
 layers, features, geometries, and spatial references from Walk files. Can
 I
 get the permission to submit it to GDAL project and share it with other
 GDAL developers?
 
 Hi Xian,
 
 First, you should check with your employer that you can legally contribute 
 code to the GDAL/OGR project and submit it under the GDAL MIT/X licence.
 Check 
 the Legal section of http://trac.osgeo.org/gdal/wiki/rfc3_commiters  .
 If 
 this is the case, send an email to this mailing list where you will
 confirm it.
 
 I also suggest that you read the developer guidelines at 
 http://trac.osgeo.org/gdal/wiki/rfc8_devguide and check that your code 
 conforms to (most of) them.
 
 For OGR driver, I would also recommend that you test the driver with the 
 test_ogrsf utility (not compiled by default, but in a custom build, you
 can 
 cd apps, and then make test_ogrsf / nmake /f makefile.vc
 test_ogrsf.exe) 
 on sample files in your data format. This will run a few consistency test
 to 
 check assumptions that an OGR driver should met.
 
 Then, you can attach an archive with the code to a Trac ticket ( 
 http://trac.osgeo.org/gdal/newticket ), so that it can be reviewed.
 
 Best regards,
 
 Even
 
 -- 
 Geospatial professional services
 http://even.rouault.free.fr/services.html
 ___
 gdal-dev mailing list

 gdal-dev@.osgeo

 http://lists.osgeo.org/mailman/listinfo/gdal-dev





--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/gdal-dev-A-new-ogr-driver-tp5067479p5068082.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev