[gdal-dev] from projection coordinates to pixel coords

2019-07-31 Thread Ahmet Temiz
Hi,

How can we transform from projection coordinates to pixel coords with gdal
c++ ?

regards

-- 
Ahmet Temiz
Jeoloji Müh.
Afet ve Acil Durum Yönetimi Başkanlığı
Bilgi İşlem  Dairesi Başkanlığı-CBS Grubu




Ahmet Temiz
Geological Eng.
Information Systems - GIS Group
Disaster and Emergency Management
of Presidency
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] from projection coordinates to pixel coords

2019-07-31 Thread Ivan Lucena
Hi Ahmet,

I would suggest for your to look into the raster tutorial page and search for 
all the occurrences of "adfGeoTransform" and read the comments and code related 
to that.

https://gdal.org/tutorials/raster_api_tut.html

Another good source code to take a look is the gdal_translate_lib.cpp code 
where you can search for the same variable name and see how the parameters 
"-srcwin" and "-srcproj" are handled on that. That is what you need, right?

https://github.com/OSGeo/gdal/blob/master/gdal/apps/gdal_translate_lib.cpp

Of course you can also check the GDAL API documentation:

https://gdal.org/api/gdaldataset_cpp.html

Best regards,

Ivan



From: gdal-dev  on behalf of Ahmet Temiz 

Sent: Wednesday, July 31, 2019 6:56 AM
To: gdal-dev 
Subject: [gdal-dev] from projection coordinates to pixel coords

Hi,

How can we transform from projection coordinates to pixel coords with gdal c++ ?

regards

--
Ahmet Temiz
Jeoloji Müh.
Afet ve Acil Durum Yönetimi Başkanlığı
Bilgi İşlem  Dairesi Başkanlığı-CBS Grubu




Ahmet Temiz
Geological Eng.
Information Systems - GIS Group
Disaster and Emergency Management
of Presidency
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] OSRSetPROJSearchPaths in multithreaded application

2019-07-31 Thread Matthew Amato
I apologize for resurrecting this thread, but we are running into the same
problem, even after updating the the head of the "release/3.0" branch which
contains Even's fix.

Previously, we would set PROJ_LIB as an environment variable but after
upgrading to 3.x/6.x we now receive thousands of "proj.db not found"
errors. After checking out the above branch, I removed the environment
variable and call OSRSetPROJSearchPaths before calling GDALAllRegister at
the start of my main thread but the problem remains.

What's odd is that it only happens if we use a lot of threads, which makes
me think there may still be a race condition somewhere in GDAL?

If I change my code to be single-threaded, the problem goes away completely.

And advice you could offer would be much appreciated.

Thanks!

On Wed, Jul 17, 2019 at 1:27 PM Dirk Vanden Boer  wrote:

>
>
> Op wo 17 jul. 2019 om 17:57 schreef Even Rouault <
> even.roua...@spatialys.com>
>
>> > I did some more investigation, and it seems like the threading is
>> > indeed not the issue.
>> > The issue seems to be that the geotiff library also creates proj
>> > contexts and these contexts do not have
>> > the search paths that are passed to the OSRGetProjTLSContext call.
>>
>> Should be fixed per
>>
>> https://github.com/OSGeo/gdal/commit/48793b5613cf1bf789125516ba845947dc63098f
>> in master
>> and
>>
>> https://github.com/OSGeo/gdal/commit/ffb0ad0c862cf4ef5d6907d1d83cc76fcf8c305b
>> in 3.0 branch
>>
>
> Great, thanks for the quick response and fixes!
>
>>
>> ___
> gdal-dev mailing list
> gdal-dev@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] NetCDF driver getting wrong values if compared to HDF5

2019-07-31 Thread Even Rouault
On mardi 30 juillet 2019 21:48:45 CEST Ivan Lucena wrote:
> Unsupported netCDF datatype (7), treat as Float32.​

Given that

#define NC_UBYTE7   /**< unsigned 1 byte int */

and 

https://github.com/OSGeo/gdal/blob/master/gdal/frmts/netcdf/netcdfdataset.cpp#L357

it seems you would have a GDAL build against a netCDF build without NC4 support.

That said, even with that, I would have expected the ubyte to float32 
conversion to be lossless.

but according to 
https://www.unidata.ucar.edu/software/netcdf/docs/group__variables.html#ga0ab808702d73b7f52be14b1e54473902
"""
The nc_get_vara() function will read a variable of any type, including user 
defined type.
For this function, the type of the data in memory must match the type of the 
variable - no data conversion is done.
"""

So you could get pretty much garbage.

Solution: build GDAL against a netCDF build that has NC4 support

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

[gdal-dev] (no subject)

2019-07-31 Thread Ahmet Temiz
Hi,

I need example c++ code for raster masking and clipping.
Do you have any?

Regards
-- 
Ahmet Temiz
Jeoloji Müh.
Afet ve Acil Durum Yönetimi Başkanlığı
Bilgi İşlem  Dairesi Başkanlığı-CBS Grubu




Ahmet Temiz
Geological Eng.
Information Systems - GIS Group
Disaster and Emergency Management
of Presidency
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev