这是前些天的几封询问基于GDAL库自定义坐标系的邮件。整理一下备用,邮箱爆满都快找不见了。
开源社区的大侠着实让人崇拜,问的问题大部分都能够很及时、很严谨的给出解答。
------------------------------------------------------------
------------------------------------------------------------
From: "贠建明" <yunjm2005@gmail.com>
To: "gdal-dev" <gdal-dev@lists.maptools.org>
Subject: [Gdal-dev] How to custom my "Projected Coordinate Systems" in OGR
Date: Wed14 Mar 2007 09:28:03 +0800
I use the class in ogr_spatialref.h to build a system with graphic UI to fulfill corrdinate system transformtion,
But i find the *.csv files in $GDAL_DATA$ is hard to extend or to add a new customed coordinate system to it.
I know that i can call statements like following to complete this task,but how do i store this configuration to these csv files?then next time user can only call it by ImportFromXXX() function.
-------------
oTargetSRS.SetProjCS( "XIAN80 Albers" );
oTargetSRS.SetWellKnownGeogCS("EPSG:4610");
oTargetSRS.SetACEA(27,45,0,105,0,0);
-------------
How these *csv construct?And if there hava a tools make my custom work easily?
贠建明
2007-03-14
------------------------------------------------------------
------------------------------------------------------------
From: Frank Warmerdam <warmerdam@pobox.com>
To: 贠建明<yunjm2005@gmail.com>
Subject: Re: [Gdal-dev] How to custom my "Projected Coordinate Systems" in OGR
Date: Thu15 Mar 2007 11:46:53 -0400
贠建明 wrote:
>
> I use the class in ogr_spatialref.h to build a system with graphic UI to
> fulfill corrdinate system transformtion,
> But i find the *.csv files in $GDAL_DATA$ is hard to extend or to add a
> new customed coordinate system to it.
> I know that i can call statements like following to complete this
> task,but how do i store this configuration to these csv files?then next
> time user can only call it by ImportFromXXX() function.
>
> -------------
> oTargetSRS.SetProjCS( "XIAN80 Albers" );
> oTargetSRS.SetWellKnownGeogCS("EPSG:4610");
> oTargetSRS.SetACEA(27,45,0,105,0,0);
> -------------
Hi,
The .csv files are primarily intended for EPSG coordinate systems,
so it isn't really appropriate to extend them manually.
But you can add your own custom dictionaries in a manner similar
to gdal/data/cubewerx_extra.wkt. These dictionary files consist
of lines with a short name, a comma and then the WKT definition of
the coordinate system.
You can reference such a definition from SetFromUserInput() and
programs that use that function (such as s_srs, a_srs, t_srs
for gdal_translate, ogr2ogr and gdalwarp) using the form:
gdal_translate -a_srs DICT:cubewerx_extra.wkt,41001
Programmatically you can use the importFromDict() method on
the OGRSpatialReference.
To get the WKT from an OGRSpatialReference, for appending to the
dictionary file, you can use the exportToWkt() method.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | President OSGeo, http://osgeo.org
------------------------------------------------------------
From: "贠建明" <yunjm2005@gmail.com>
To: "Frank Warmerdam" <warmerdam@pobox.com>
Subject: Thanks for Answer: [Gdal-dev] How to custom my "Projected CoordinateSystems" inOGR
Date: Fri16 Mar 2007 08:38:13 +0800
Hi,Frank:
Thanks for your reply.I will modify my code follow your advice.
And i have another question:
Is under the $GDAL_DATA$ directory have a file to describe which projection hava how many parameter as well as their name,function. I want give a common custome projection UI,if have the file i mention above it can make me dynamicly control the Form style. If don't have this file,should i control the UI according the projection various by enumerate their parameter ?
hope your next reply.
Best regards,
yunjm
2007-03-16
发件人: Frank Warmerdam
发送时间: 2007-03-15 23:48:13
收件人: 贠建明
抄送: gdal-dev
主题: Re: [Gdal-dev] How to custom my "Projected Coordinate Systems" inOGR
贠建明 wrote:
>
> I use the class in ogr_spatialref.h to build a system with graphic UI to
> fulfill corrdinate system transformtion,
> But i find the *.csv files in $GDAL_DATA$ is hard to extend or to add a
> new customed coordinate system to it.
> I know that i can call statements like following to complete this
> task,but how do i store this configuration to these csv files?then next
> time user can only call it by ImportFromXXX() function.
>
> -------------
> oTargetSRS.SetProjCS( "XIAN80 Albers" );
> oTargetSRS.SetWellKnownGeogCS("EPSG:4610");
> oTargetSRS.SetACEA(27,45,0,105,0,0);
> -------------
Hi,
The .csv files are primarily intended for EPSG coordinate systems,
so it isn't really appropriate to extend them manually.
But you can add your own custom dictionaries in a manner similar
to gdal/data/cubewerx_extra.wkt. These dictionary files consist
of lines with a short name, a comma and then the WKT definition of
the coordinate system.
You can reference such a definition from SetFromUserInput() and
programs that use that function (such as s_srs, a_srs, t_srs
for gdal_translate, ogr2ogr and gdalwarp) using the form:
gdal_translate -a_srs DICT:cubewerx_extra.wkt,41001
Programmatically you can use the importFromDict() method on
the OGRSpatialReference.
To get the WKT from an OGRSpatialReference, for appending to the
dictionary file, you can use the exportToWkt() method.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | President OSGeo, http://osgeo.org
------------------------------------------------------------
------------------------------------------------------------
From: Frank Warmerdam <warmerdam@pobox.com>
To: 贠建明<yunjm2005@gmail.com>
Subject: Re: Thanks for Answer: [Gdal-dev] How to custom my "ProjectedCoordinate Systems" inOGR
Date: Thu15 Mar 2007 21:20:44 -0400
贠建明 wrote:
> Hi,Frank:
>
> Thanks for your reply.I will modify my code follow your advice.
> And i have another question:
> Is under the $GDAL_DATA$ directory have a file to describe which
> projection hava how many parameter as well as their name,function. I
> want give a common custome projection UI,if have the file i mention
> above it can make me dynamicly control the Form style. If don't have
> this file,should i control the UI according the projection various by
> enumerate their parameter ?
> hope your next reply.
贠建明,
There is no file in $GDAL_DATA$ for this, but at the API
level we do have the following functions to fetch a list of
projection methods, and the corresponding parameter list.
I don't think I have been maintaining it very well, so there
may be a few omissions, but it is intended to make it possible
to build a GUI that "automatically" supports all the projection
methods of the current GDAL/OGR.
/* -------------------------------------------------------------------- */
/* Projection transform dictionary query. */
/* -------------------------------------------------------------------- */
char CPL_DLL ** OPTGetProjectionMethods();
char CPL_DLL ** OPTGetParameterList( const char * pszProjectionMethod,
char ** ppszUserName );
int CPL_DLL OPTGetParameterInfo( const char * pszProjectionMethod,
const char * pszParameterName,
char ** ppszUserName,
char ** ppszType,
double *pdfDefaultValue );
There appears to be some documentation on this page:
http://www.gdal.org/ogr/ogr__srs__api_8h.html
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | President OSGeo, http://osgeo.org
