postgresql, string function example
update
veri.datas3
set x_coord = trim(substring(trim(cor) from 0 for position(’,’ in cor))),
y_coord = trim(substring(trim(cor) from position(’,’ in cor)+1 for position(’,’ in cor)+ position(’,’ in cor)))
update
veri.datas3
set x_coord = trim(substring(trim(cor) from 0 for position(’,’ in cor))),
y_coord = trim(substring(trim(cor) from position(’,’ in cor)+1 for position(’,’ in cor)+ position(’,’ in cor)))
Bildiğiniz gibi ESRI, 9.3 versiyonunu yeni çıkardı. Peşinede SP1 geldi.
Gelen en büyük yeniliklerden birisi de ArcSDE yi Oracle üzerine kurarken, ArcSDE nin SHAPE geometry kolonu yerineOracle Spatial ın SDO_GEOMETRY kolonunu seçilebiliyor olması. Bu özellik aslında eskiden de vardı, ancak 9.3 ün kurulumundanSeçilebilir halde olacak kadar açığa çıkmış değildi.
Bu durum bize Spatial Join gibi coğrafi işlemler için Oracle Spatial ın gücünü de aynı zamanda kullanma imkanı verdi.
Birazda teknik detaylara inelim.
Sistem:Arcgis Server 9.3ArcSde 9.3Oracle 10g R2 Patch 1
protected void Button2_Click(object sender, EventArgs e){
try
{
string kaynaktbl = txtSourceTableName.Text.ToString();string hedeftbl = txtTargetTableName.Text.ToString();//workspace connection
string server = txtServer.Text.ToString();string instance = txtInstance.Text.ToString();
string username = txtUsername.Text.ToString();string password = txtPassword.Text.ToString();
string database = txtDatabase.Text.ToString();string version = txtVersion.Text.ToString();
IWorkspace pWS = SDEWorkspaceFromPropertySet(server, instance, username, password, database, version);IWorkspaceEdit pWSEdit;pWSEdit = (
IWorkspaceEdit)pWS;pWSEdit.StartEditing(false);pWSEdit.StartEditOperation();
IFeatureWorkspace pFeatureWS;pFeatureWS = (
IFeatureWorkspace)pWS;IFeatureClass pFClass;
IFeatureClass pFClassMulti;pFClassMulti = pFeatureWS.OpenFeatureClass(hedeftbl);
pFClass = pFeatureWS.OpenFeatureClass(kaynaktbl);
ITable pfClassTable = (ITable)pFClass;int satirSayisi = pfClassTable.RowCount(null);System.Collections.Generic.
List<int> constructoidList = new System.Collections.Generic.List<int>();for (int k = 1; k <= satirSayisi; k++){
constructoidList.Add(k);
}
int[] oidList = constructoidList.ToArray();IFeatureCursor featureCursor = pFClass.GetFeatures(oidList, false);
IFeature feature = featureCursor.NextFeature();while (feature != null){
IFeature geom = feature;
IPoint pnt = (IPoint)geom.Shape;double xcoord = pnt.X;
double ycoord = pnt.Y;string pObjectId = geom.get_Value(0).ToString(); //objectid
string pKod = geom.get_Value(1).ToString(); //kod
string pAd = geom.get_Value(2).ToString(); //ad
string pTip = geom.get_Value(3).ToString(); //tip
//———
IPoint mpnt = new PointClass();mpnt.X = xcoord;
mpnt.Y = ycoord;
object missing = Type.Missing;Multipoint Multipnt = new Multipoint();Multipnt.AddPoint(mpnt,
ref missing, ref missing);IFeature pFeatMulti = pFClassMulti.CreateFeature();pFeatMulti.Shape = (
IGeometry)Multipnt;pFeatMulti.set_Value(1, pKod);
pFeatMulti.set_Value(2, pAd);
pFeatMulti.set_Value(3, pTip);
pFeatMulti.Store();
//———
feature = featureCursor.NextFeature();
}
pWSEdit.StopEditing(true); //KAYIT ETMEK İÇİN TRUE YAPILMASI GEREKLİ
pWSEdit.StopEditOperation();
Response.Write(“<font color=’green’><b>ISLEM TAMAM!</b></font><hr>”);/////////////////////////////////////////////////////////////////////////////////
}
catch (Exception etc){
Response.Write(“<font color=’red’><b>” + etc.Message.ToString() + “</b></font><hr>”);}
}
public ESRI.ArcGIS.Geodatabase.IWorkspace SDEWorkspaceFromPropertySet(String server, String instance, String user, String password, String database, String version){
ESRI.ArcGIS.esriSystem.IPropertySet propertySet = new ESRI.ArcGIS.esriSystem.PropertySetClass();propertySet.SetProperty(“SERVER”, server);propertySet.SetProperty(
“INSTANCE”, instance);propertySet.SetProperty(“DATABASE”, database);propertySet.SetProperty(
“USER”, user);propertySet.SetProperty(“PASSWORD”, password);propertySet.SetProperty(
“VERSION”, version);ESRI.ArcGIS.Geodatabase.IWorkspaceFactory2 workspaceFactory;workspaceFactory = (ESRI.ArcGIS.Geodatabase.
IWorkspaceFactory2)new ESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactoryClass();return workspaceFactory.Open(propertySet, 0);}
kullanılan referanslar
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.DataSourcesGDB;
Arama ! -> ESRI.ArcGIS.esriSystem için ESRI.ArcGIS.System i yüklenmeli!
Powered by WordPress