Re: [gdal-dev] how to pick the correct projection

2015-12-09 Thread Even Rouault
Le mercredi 09 décembre 2015 19:23:16, Djordje Spasic a écrit :
> Hi,
> 
> I am downloading an open source .asc elevation files from
> opentopography.org.​ I attached one of them in this email. Once downloaded
> .asc elevation file need to be projected from WGS84 datum (EPSG 4326) to
> Universal Transverse Mercator. Here is an example of how this looks like
> in python GDAL for Barcelona Spain downloaded elevation model: gdalwarp
> -s_srs EPSG:4326 -t_srs EPSG:32631 -r cubic BarcelonaWGS84.asc
> projectedToUTM.tif ​So in this case the EPSG:32631 has been used as a
> projection (it hasn't been picked by me), it was googled.
> 
> But how do I know which projection to pick, depending on the location for
> which the elevation data is downloaded? I googled a bit, and there are few
> articles online, which suggest picking the right EPSG projection based on
> UTM zone to which the downloaded elevation model belong
> to:https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_
> system#/media/File:Utm-zones.jpg
> 
> But I am not sure I understand how to choose the EPSG projection based on
> UTM zone.
> 
> How can this be done?

Formula given in 
http://stackoverflow.com/questions/9186496/determining-utm-zone-to-convert-from-longitude-latitude

long2UTM <- function(long) {
(floor((long + 180)/6) %% 60) + 1
}

Take the longitude of the central point of the source raster as input

Just thinking it could be interesting to have gdalwarp accept -t_srs AUTO:42001 
to do that automatically:
http://cite.opengeospatial.org/OGCTestData/wms/1.1.1/spec/wms1.1.1.html#auto_projections.42001

> 
> Thank you for the reply.
> 
> Kind regards,
> Djordje Spasic

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

[gdal-dev] Issue with c# bindings

2015-12-09 Thread kelly elton
I'm getting this error after compiling from source

Exception thrown: 'System.MethodAccessException' in gdal_csharp.dll

Additional information: Attempt by security transparent method
'OSGeo.GDAL.Gdal.UseExceptions()' to call native code through method
'OSGeo.GDAL.GdalPINVOKE.UseExceptions()' failed.  Methods must be security
critical or security safe-critical to call native code.

I did
nmake -f makefile.vc clean && nmake -f makefile.vc MSVC_VER=1600 DEBUG=1 &&
nmake -f makefile.vc install
cd swig
nmake -f makefile.vc csharp

I get the gdal dll + the csharp dlls...and I use them

But as soon as I call OSGeo.GDAL.Gdal.UseExceptions(); I get the exception

This doesn't happen with the dll's I've downloaded from
http://www.gisinternals.com/

I got the source from https://trac.osgeo.org/gdal/wiki/DownloadSource and I
got 2.0.1
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] how to pick the correct projection

2015-12-09 Thread Even Rouault
Le mercredi 09 décembre 2015 20:55:53, Djordje Spasic a écrit :
> Thank you for the reply Even.
> 
> Based on your equation one can identify the UTM zone. Which in this case
> for Barcelona is: 31.
> 
> How can I identify the EPSG projection based on UTM zone 31?Is it possible
> to identify it with some formula too?

Add 32600 to the UTM zone for the northern hemisphere, or 32700 for the 
southern hemisphere.

> 
> Kind regards,
> Djordje Spasic
> 
> 
>   From: Even Rouault 
>  To: gdal-dev@lists.osgeo.org; Djordje Spasic 
>  Sent: Wednesday, December 9, 2015 7:43 PM
>  Subject: Re: [gdal-dev] how to pick the correct projection
> 
> Le mercredi 09 décembre 2015 19:23:16, Djordje Spasic a écrit :
> > Hi,
> > 
> > I am downloading an open source .asc elevation files from
> > opentopography.org.​ I attached one of them in this email. Once
> > downloaded .asc elevation file need to be projected from WGS84 datum
> > (EPSG 4326) to Universal Transverse Mercator. Here is an example of how
> > this looks like in python GDAL for Barcelona Spain downloaded elevation
> > model: gdalwarp -s_srs EPSG:4326 -t_srs EPSG:32631 -r cubic
> > BarcelonaWGS84.asc
> > projectedToUTM.tif ​So in this case the EPSG:32631 has been used as a
> > projection (it hasn't been picked by me), it was googled.
> > 
> > But how do I know which projection to pick, depending on the location for
> > which the elevation data is downloaded? I googled a bit, and there are
> > few articles online, which suggest picking the right EPSG projection
> > based on UTM zone to which the downloaded elevation model belong
> > to:https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate
> > _ system#/media/File:Utm-zones.jpg
> > 
> > But I am not sure I understand how to choose the EPSG projection based on
> > UTM zone.
> > 
> > How can this be done?
> 
> Formula given in
> http://stackoverflow.com/questions/9186496/determining-utm-zone-to-convert-
> from-longitude-latitude
> 
> long2UTM <- function(long) {
> (floor((long + 180)/6) %% 60) + 1
> }
> 
> Take the longitude of the central point of the source raster as input
> 
> Just thinking it could be interesting to have gdalwarp accept -t_srs
> AUTO:42001 to do that automatically:
> http://cite.opengeospatial.org/OGCTestData/wms/1.1.1/spec/wms1.1.1.html#au
> to_projections.42001
> 
> > Thank you for the reply.
> > 
> > Kind regards,
> > Djordje Spasic

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

Re: [gdal-dev] Issue with c# bindings

2015-12-09 Thread Tamas Szekeres
Hi Kelly,

It looks like you are compiling against .Net 4 and the /define:CLR4 is
missing from the csc command line. Also make sure the following line is
added to AssemblyInfo.cs when compiling the assemblies:

[assembly: SecurityRules(SecurityRuleSet.Level1)]


Best regards,

Tamas



2015-12-09 23:02 GMT+01:00 kelly elton :

> I'm getting this error after compiling from source
>
> Exception thrown: 'System.MethodAccessException' in gdal_csharp.dll
>
> Additional information: Attempt by security transparent method
> 'OSGeo.GDAL.Gdal.UseExceptions()' to call native code through method
> 'OSGeo.GDAL.GdalPINVOKE.UseExceptions()' failed.  Methods must be security
> critical or security safe-critical to call native code.
>
> I did
> nmake -f makefile.vc clean && nmake -f makefile.vc MSVC_VER=1600 DEBUG=1
> && nmake -f makefile.vc install
> cd swig
> nmake -f makefile.vc csharp
>
> I get the gdal dll + the csharp dlls...and I use them
>
> But as soon as I call OSGeo.GDAL.Gdal.UseExceptions(); I get the exception
>
> This doesn't happen with the dll's I've downloaded from
> http://www.gisinternals.com/
>
> I got the source from https://trac.osgeo.org/gdal/wiki/DownloadSource and
> I got 2.0.1
>
> ___
> gdal-dev mailing list
> gdal-dev@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] Issue with c# bindings

2015-12-09 Thread kelly elton
Alright well I figure that out...Targeted a specific MSVC_VER in csharp.opt

On Wed, Dec 9, 2015 at 5:02 PM kelly elton  wrote:

> I'm getting this error after compiling from source
>
> Exception thrown: 'System.MethodAccessException' in gdal_csharp.dll
>
> Additional information: Attempt by security transparent method
> 'OSGeo.GDAL.Gdal.UseExceptions()' to call native code through method
> 'OSGeo.GDAL.GdalPINVOKE.UseExceptions()' failed.  Methods must be security
> critical or security safe-critical to call native code.
>
> I did
> nmake -f makefile.vc clean && nmake -f makefile.vc MSVC_VER=1600 DEBUG=1
> && nmake -f makefile.vc install
> cd swig
> nmake -f makefile.vc csharp
>
> I get the gdal dll + the csharp dlls...and I use them
>
> But as soon as I call OSGeo.GDAL.Gdal.UseExceptions(); I get the exception
>
> This doesn't happen with the dll's I've downloaded from
> http://www.gisinternals.com/
>
> I got the source from https://trac.osgeo.org/gdal/wiki/DownloadSource and
> I got 2.0.1
>
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev