ArcGIS Save To Local Database like SQL or PostgreSQL

1634
6
Jump to solution
12-09-2020 04:10 AM
davidkp
New Contributor

I want to save coordinates in our local database. How can I do this?.. and also Draw new shapes and took that coordinates also I want to save in our local database...

0 Kudos
1 Solution

Accepted Solutions
PanagiotisPapadopoulos
Esri Regular Contributor

So on the web app you can use the ArcGIS Javascript API (https://developers.arcgis.com/javascript/) in order to create a map and the editing functionality.

The best way is to use an ArcGIS Enterprise in order to Enable and create a Geodatabase on the SQL Server (https://pro.arcgis.com/en/pro-app/tool-reference/data-management/enable-enterprise-geodatabase.htm) and create the appropriate web services (Feature services) for the web editing (https://enterprise.arcgis.com/en/server/latest/publish-services/windows/what-is-a-feature-service-.h...)

Finally on the Web App you can use the out of the box Editing Widget (https://developers.arcgis.com/javascript/3/sandbox/sandbox.html?sample=ed_simpletoolbar) or create custom editing tools (https://developers.arcgis.com/javascript/3/jssamples/ed_feature_creation.html)

The geometries stored directly to the Geodatabase (SQL Server in your case)

 

If your case is not to apply the ArcGIS Enterprise Solution on the system the only part you can use is the ArcGIS Javascript API to create the map and the editing tools, only for the drawing tools (https://developers.arcgis.com/javascript/3/jssamples/toolbar_draw.html).

After that from the result graphic you can get the geometry (https://developers.arcgis.com/javascript/3/jsapi/graphic-amd.html#geometry) and from the geometry (depends from the geometry type, point line, polygon) you can get the coordinates (vertices)

For point (https://developers.arcgis.com/javascript/3/jsapi/point-amd.html#x)

For Line (https://developers.arcgis.com/javascript/3/jsapi/polyline-amd.html#paths)

For Polygon (https://developers.arcgis.com/javascript/3/jsapi/polygon-amd.html#rings)

Also you can convert the geometry to Json.

A sample is here:

if (graphic.geometry.type==="point"){

graphic.geometry.x

graphic.geometry.y

…….

 

if (graphic.geometry.type==="polyline"){

var RG = graphic.paths[0]

var countVertex =0;

for (var im = 0, ilm = RG.length; im < ilm; im++)

{

  countVertex = countVertex + 1;

                           

  var vertex = graphic.getPoint(0,im);

….

….

}

…..

 

if (graphic.geometry.type==="polygon"){

var RG = graphic. rings[0]

var countVertex =0;

for (var im = 0, ilm = RG. length-1; im < ilm; im++)

{

  countVertex = countVertex + 1;

                            

  var vertex = graphic.getPoint(0,im);

….

….

}

…..

….

At this point you only have on the client side the graphic and the vertices. With out ArcGIS Enterprise depends to you to implement the way you have to store the data on the database

For this case see the Developer options you have in order to use the ArcGIS Javascript API https://developers.arcgis.com/

 

View solution in original post

6 Replies
davidkp
New Contributor

Actually I am doing in angular, Asp.net Core And Database is SQL server

0 Kudos
PanagiotisPapadopoulos
Esri Regular Contributor

So on the web app you can use the ArcGIS Javascript API (https://developers.arcgis.com/javascript/) in order to create a map and the editing functionality.

The best way is to use an ArcGIS Enterprise in order to Enable and create a Geodatabase on the SQL Server (https://pro.arcgis.com/en/pro-app/tool-reference/data-management/enable-enterprise-geodatabase.htm) and create the appropriate web services (Feature services) for the web editing (https://enterprise.arcgis.com/en/server/latest/publish-services/windows/what-is-a-feature-service-.h...)

Finally on the Web App you can use the out of the box Editing Widget (https://developers.arcgis.com/javascript/3/sandbox/sandbox.html?sample=ed_simpletoolbar) or create custom editing tools (https://developers.arcgis.com/javascript/3/jssamples/ed_feature_creation.html)

The geometries stored directly to the Geodatabase (SQL Server in your case)

 

If your case is not to apply the ArcGIS Enterprise Solution on the system the only part you can use is the ArcGIS Javascript API to create the map and the editing tools, only for the drawing tools (https://developers.arcgis.com/javascript/3/jssamples/toolbar_draw.html).

After that from the result graphic you can get the geometry (https://developers.arcgis.com/javascript/3/jsapi/graphic-amd.html#geometry) and from the geometry (depends from the geometry type, point line, polygon) you can get the coordinates (vertices)

For point (https://developers.arcgis.com/javascript/3/jsapi/point-amd.html#x)

For Line (https://developers.arcgis.com/javascript/3/jsapi/polyline-amd.html#paths)

For Polygon (https://developers.arcgis.com/javascript/3/jsapi/polygon-amd.html#rings)

Also you can convert the geometry to Json.

A sample is here:

if (graphic.geometry.type==="point"){

graphic.geometry.x

graphic.geometry.y

…….

 

if (graphic.geometry.type==="polyline"){

var RG = graphic.paths[0]

var countVertex =0;

for (var im = 0, ilm = RG.length; im < ilm; im++)

{

  countVertex = countVertex + 1;

                           

  var vertex = graphic.getPoint(0,im);

….

….

}

…..

 

if (graphic.geometry.type==="polygon"){

var RG = graphic. rings[0]

var countVertex =0;

for (var im = 0, ilm = RG. length-1; im < ilm; im++)

{

  countVertex = countVertex + 1;

                            

  var vertex = graphic.getPoint(0,im);

….

….

}

…..

….

At this point you only have on the client side the graphic and the vertices. With out ArcGIS Enterprise depends to you to implement the way you have to store the data on the database

For this case see the Developer options you have in order to use the ArcGIS Javascript API https://developers.arcgis.com/

 

PanagiotisPapadopoulos
Esri Regular Contributor

Also how to use ArcGIS Javascript API with Angular see here

https://github.com/Esri/angular-cli-esri-map

 

0 Kudos
davidkp
New Contributor

Thank You So Much ....

0 Kudos
PanagiotisPapadopoulos
Esri Regular Contributor

Also to get the coordinates there are many ways to achieve this.

1. Using Geometry Calculation from ArcGIS Pro (https://pro.arcgis.com/en/pro-app/tool-reference/data-management/calculate-geometry-attributes.htm)

2. Use python tools (https://pro.arcgis.com/en/pro-app/arcpy/data-access/featureclasstonumpyarray.htm)

3. If you are using enterprise Geodatabase with SQL and spatial functions (https://desktop.arcgis.com/en/arcmap/latest/manage-data/using-sql-with-gdbs/st-x.htm)

.....

0 Kudos