!!If your are not Taiwanese Just read on top of page
The solutions::
You can create db first ,and used Spatialite to created it
And use library use your created db
You can't use library to created db !
Do this command ::
std::string testSql ="ALTER TABLE cp9 add column wgs84;" \
"Update cp9 set wgs84 = transform(geometry,4326);";
I don't know ,If you have others solutions please share us ,thanks
********************************************************
The solutions::
You can create db first ,and used Spatialite to created it
And use library use your created db
You can't use library to created db !
Do this command ::
std::string testSql ="ALTER TABLE cp9 add column wgs84;" \
"Update cp9 set wgs84 = transform(geometry,4326);";
I don't know ,If you have others solutions please share us ,thanks
********************************************************
!First- About Coding
or Computing 常聽到的 Call Library
Library 到底是甚麼..I mean coding 常再說的
稍微查了一下 中文好像沒甚麼在講這塊然後
key word :: what does library mean in
computer terms
http://en.wikipedia.org/wiki/Library_(computing)
wiki的太長了
所已找了這篇,對我來說比較輕鬆一點XD
http://searchsqlserver.techtarget.com/definition/library
********************************************************
!Title-Called
Spatialite Library use C++
@而這上面可能會有些版本的問題
@此library
是無法創造一個跟Spatialite創造出的DB相符的
?以Spatialite_Gui
來看,我們匯入的含有Geometry的Table都是會跑出地球圖 案的,但是此library沒有,但也可能是我們技術上的問題。
●這個測試的目的::如何使用Spatialite Library 正常的轉換SRID
※你可以會用到的指令和技術::
§How
to transform SRID use spatialite
Create New column on your
table to transform.
1> Alter table
table_name add column new_column_name column_type
How to show the SRID ?
1> Select SRID(geometry_column_name)
from table_name
How to show the coordinate ?
1>Select astext(geometry_column_name)
from table_name
How to transform SRID on new
column ?
1> Update tableName
set columnName = transform(geometryColumnName,SRID);
2>Example::Update
tfTable set wgs84 = transform(geometry,4326)
------------------------------------------------------------------------------------
以上是正常的SRID轉換方式,接下來是失敗的測試
********************************************************
!Title-Bad test
@為解決顯示出無法找到spatial_ref_sys表格之SRID與轉換公式
@一樣使用Spatialite_Library
●目的::想辦法看能不能使用Spatialite_Library 創建的db,正常執行SRID之轉換
>1正常的Spatialite創立之db是有spatial_ref_sys,這個表格主要是包含了所有 的SRID公式和名稱,也可以說是運算使用
>2把正常的db內的spatial_ref_sys dump出來,然後再load進Spatialite_Library 的db,在來執行是否能成功轉換SRID
>3出現INFINFINF字樣,無法成功轉換
>4 檢查是否為欄位格式錯誤,將成功範例之表格也Dump出來, 建立 在spatialite_library,依然無法使用
※你可以會用到的指令和技術::
§How to dump sqlite,spatialite table?
1>Please use win
cmd
2> spatialite
dbName.sqlite ".dump tableName">abc.text;
?意思是 開啟spatialite 的dbName.sqlite 的file實作
"dump 出 db 內 的某資料表全部"
到此資料夾底下 新增abc.text 然後把dump的 內容都寫在裡面
------------------------------------------------------------------------------------
以上之重點,Spatialite_library 還是無法轉換SRID,請提供解決方案
********************************************************
Add the wgs84,TW97-2的指令,包含C++使用
**4326
insert into spatial_ref_sys values(4326,"epsg",4326,"WGS 84","+proj=longlat +datum=WGS84 +no_defs","GEOGCS['WGS 84',DATUM['WGS_1984',SPHEROID['WGS 84',6378137,298.257223563,AUTHORITY['EPSG','7030']],AUTHORITY['EPSG','6326']],PRIMEM['Greenwich',0,AUTHORITY['EPSG','8901']],UNIT['degree',0.0174532925199433,AUTHORITY['EPSG','9122']],AUTHORITY['EPSG','4326']]")
insert into spatial_ref_sys values(4326,\"epsg\",4326,\"WGS 84\",\"+proj=longlat +datum=WGS84 +no_defs\",\"GEOGCS['WGS 84',DATUM['WGS_1984',SPHEROID['WGS 84',6378137,298.257223563,AUTHORITY['EPSG','7030']],AUTHORITY['EPSG','6326']],PRIMEM['Greenwich',0,AUTHORITY['EPSG','8901']],UNIT['degree',0.0174532925199433,AUTHORITY['EPSG','9122']],AUTHORITY['EPSG','4326']]\")
**3826
insert into spatial_ref_sys values(3826,"epsg",3826,"TWD97 / TM2 zone 121","+proj=tmerc +lat_0=0 +lon_0=121 +k=0.9999 +x_0=250000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","PROJCS['TWD97 / TM2 zone 121',GEOGCS['TWD97',DATUM['Taiwan_Datum_1997',SPHEROID['GRS 1980',6378137,298.257222101,AUTHORITY['EPSG','7019']],TOWGS84[0,0,0,0,0,0,0],AUTHORITY['EPSG','1026']],PRIMEM['Greenwich',0,AUTHORITY['EPSG','8901']],UNIT['degree',0.0174532925199433,AUTHORITY['EPSG','9122']],AUTHORITY['EPSG','3824']],PROJECTION['Transverse_Mercator'],PARAMETER['latitude_of_origin',0],PARAMETER['central_meridian',121],PARAMETER['scale_factor',0.9999],PARAMETER['false_easting',250000],PARAMETER['false_northing',0],UNIT['metre',1,AUTHORITY['EPSG','9001']],AXIS['X',EAST],AXIS['Y',NORTH],AUTHORITY['EPSG','3826']]"
insert into spatial_ref_sys values(3826,\"epsg\",3826,\"TWD97 / TM2 zone 121\",\"+proj=tmerc +lat_0=0 +lon_0=121 +k=0.9999 +x_0=250000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs\",\"PROJCS['TWD97 / TM2 zone 121',GEOGCS['TWD97',DATUM['Taiwan_Datum_1997',SPHEROID['GRS 1980',6378137,298.257222101,AUTHORITY['EPSG','7019']],TOWGS84[0,0,0,0,0,0,0],AUTHORITY['EPSG','1026']],PRIMEM['Greenwich',0,AUTHORITY['EPSG','8901']],UNIT['degree',0.0174532925199433,AUTHORITY['EPSG','9122']],AUTHORITY['EPSG','3824']],PROJECTION['Transverse_Mercator'],PARAMETER['latitude_of_origin',0],PARAMETER['central_meridian',121],PARAMETER['scale_factor',0.9999],PARAMETER['false_easting',250000],PARAMETER['false_northing',0],UNIT['metre',1,AUTHORITY['EPSG','9001']],AXIS['X',EAST],AXIS['Y',NORTH],AUTHORITY['EPSG','3826']]\")
Add the wgs84,TW97-2的指令,包含C++使用
**4326
insert into spatial_ref_sys values(4326,"epsg",4326,"WGS 84","+proj=longlat +datum=WGS84 +no_defs","GEOGCS['WGS 84',DATUM['WGS_1984',SPHEROID['WGS 84',6378137,298.257223563,AUTHORITY['EPSG','7030']],AUTHORITY['EPSG','6326']],PRIMEM['Greenwich',0,AUTHORITY['EPSG','8901']],UNIT['degree',0.0174532925199433,AUTHORITY['EPSG','9122']],AUTHORITY['EPSG','4326']]")
insert into spatial_ref_sys values(4326,\"epsg\",4326,\"WGS 84\",\"+proj=longlat +datum=WGS84 +no_defs\",\"GEOGCS['WGS 84',DATUM['WGS_1984',SPHEROID['WGS 84',6378137,298.257223563,AUTHORITY['EPSG','7030']],AUTHORITY['EPSG','6326']],PRIMEM['Greenwich',0,AUTHORITY['EPSG','8901']],UNIT['degree',0.0174532925199433,AUTHORITY['EPSG','9122']],AUTHORITY['EPSG','4326']]\")
**3826
insert into spatial_ref_sys values(3826,"epsg",3826,"TWD97 / TM2 zone 121","+proj=tmerc +lat_0=0 +lon_0=121 +k=0.9999 +x_0=250000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","PROJCS['TWD97 / TM2 zone 121',GEOGCS['TWD97',DATUM['Taiwan_Datum_1997',SPHEROID['GRS 1980',6378137,298.257222101,AUTHORITY['EPSG','7019']],TOWGS84[0,0,0,0,0,0,0],AUTHORITY['EPSG','1026']],PRIMEM['Greenwich',0,AUTHORITY['EPSG','8901']],UNIT['degree',0.0174532925199433,AUTHORITY['EPSG','9122']],AUTHORITY['EPSG','3824']],PROJECTION['Transverse_Mercator'],PARAMETER['latitude_of_origin',0],PARAMETER['central_meridian',121],PARAMETER['scale_factor',0.9999],PARAMETER['false_easting',250000],PARAMETER['false_northing',0],UNIT['metre',1,AUTHORITY['EPSG','9001']],AXIS['X',EAST],AXIS['Y',NORTH],AUTHORITY['EPSG','3826']]"
insert into spatial_ref_sys values(3826,\"epsg\",3826,\"TWD97 / TM2 zone 121\",\"+proj=tmerc +lat_0=0 +lon_0=121 +k=0.9999 +x_0=250000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs\",\"PROJCS['TWD97 / TM2 zone 121',GEOGCS['TWD97',DATUM['Taiwan_Datum_1997',SPHEROID['GRS 1980',6378137,298.257222101,AUTHORITY['EPSG','7019']],TOWGS84[0,0,0,0,0,0,0],AUTHORITY['EPSG','1026']],PRIMEM['Greenwich',0,AUTHORITY['EPSG','8901']],UNIT['degree',0.0174532925199433,AUTHORITY['EPSG','9122']],AUTHORITY['EPSG','3824']],PROJECTION['Transverse_Mercator'],PARAMETER['latitude_of_origin',0],PARAMETER['central_meridian',121],PARAMETER['scale_factor',0.9999],PARAMETER['false_easting',250000],PARAMETER['false_northing',0],UNIT['metre',1,AUTHORITY['EPSG','9001']],AXIS['X',EAST],AXIS['Y',NORTH],AUTHORITY['EPSG','3826']]\")
沒有留言:
張貼留言