POST
|
My problem is sr lock is not releasing on gdb , also please see that code can be improved? Below is my code public String exportGDB(String whereClause,IServerObjectHelper serverObjectHelper) // returns the path of GDB { String tempPath = System.getProperty("java.io.tmpdir"); SOEHelper soeHelper = new SOEHelper(); String fileName = System.currentTimeMillis() + ".gdb"; try { // Create a FileGDB workspace factory IWorkspaceFactory workspaceFactory = new FileGDBWorkspaceFactory(); // Create a new File geodatabase IWorkspaceName workspaceName = workspaceFactory.create(tempPath,fileName , null, 0); IName wsName = (IName) workspaceName; IWorkspace workspace = new IWorkspaceProxy(wsName.open()); IFeatureWorkspace featureWorkspace = new IFeatureWorkspaceProxy(workspace); IMapLayerInfos layerInfos = soeHelper.getLayerInfo(serverObjectHelper); IQueryFilter qf = new QueryFilter(); qf.setWhereClause(whereClause); IFeatureClass fc = null; IMapLayerInfo layerInfo = null; IFeatureClass gdbFeatureClass = null; IFeature newFeature = null; IFeature feature = null; IFeatureCursor featureCursor = null; for (int i=0; i < layerInfos.getCount(); i++) { layerInfo = layerInfos.getElement(i); fc = soeHelper.getFeatureClass(layerInfo.getID(), serverObjectHelper); // // IWorkspaceName fcwsName = (IWorkspaceName)fc.getFeatureDataset().getWorkspace(); // IFeatureClassDescription fcDesc = new FeatureClassDescription(); IObjectClassDescription ocDesc = (IObjectClassDescription) fcDesc; // // gdbFeatureClass = new FeatureClass(featureWorkspace.createFeatureClass(layerInfo.getName(), layerInfo.getFields(), ocDesc.getInstanceCLSID(), ocDesc.getClassExtensionCLSID(), esriFeatureType.esriFTSimple, "SHAPE", "")); // IFeatureClassName sourceFeatureClassName = new FeatureClassName(); // // IFeatureDataConverter2 featureDataConverter = new FeatureDataConverter(); // // IEnumInvalidObject enumInvalidObject = featureDataConverter.convertFeatureClass((IDatasetName)fcwsName, // qf, null,(IFeatureDatasetName)workspaceName, sourceFeatureClassName, // soeHelper.getGeomRef(fc), // layerInfo.getFields(), "", 1000, 0); // // // // Check for errors. // IInvalidObjectInfo invalidObjectInfo = null; // enumInvalidObject.reset(); // while ((invalidObjectInfo = enumInvalidObject.next()) != null){ // // Handle the errors in a way appropriate to the application. // System.out.println("Errors occurred for the following feature: " + // invalidObjectInfo.getInvalidObjectID()); // } featureCursor = fc.search(qf, true); feature = featureCursor.nextFeature(); while(feature != null) { newFeature = gdbFeatureClass.createFeature(); for (int j = 0; j < featureCursor.getFields().getFieldCount(); j++) { if(featureCursor.getFields().getField(j).getType() == esriFieldType.esriFieldTypeOID) { // skip continue; } newFeature.setValue(newFeature.getFields().findField(featureCursor.getFields().getField(j).getName()), feature.getValue(j)); } newFeature.store(); feature = featureCursor.nextFeature(); Cleaner.release(newFeature); } Cleaner.release(gdbFeatureClass); Cleaner.release(featureCursor); } // Cleaner.releaseAllInCurrentThread(); // Cleaner.release(gdbFeatureClass); // Cleaner.release(featureCursor); // soeHelper.releaseSilently(workspaceName); soeHelper.releaseSilently(wsName); soeHelper.releaseSilently(layerInfos); Cleaner.release(featureWorkspace); Cleaner.release(workspace); Cleaner.release(workspaceFactory); qf = null; workspace = null; featureWorkspace = null; workspaceFactory = null; fc = null; layerInfo = null; gdbFeatureClass = null; newFeature = null; feature = null; featureCursor = null; return fileName; } catch (Exception e) { e.printStackTrace(); return null; } }
... View more
11-09-2015
08:04 PM
|
0
|
0
|
2362
|
POST
|
I have no link I can think of that clearly relates to your problem. It would probably have to be pieced together from many code snippets. I have no real idea how comfortable you are with adapting sample code to your specific problem, so I don't know what level of examples to direct you to. For example, can I assume you are familiar with using cursors or not? If you mean you want an example of running a geoprocessing tool in .Net you can look at this link. The example you came up with also could create the event table on the fly with very little modification. If this tool does not require real time data from newly created or edited features, you could just run the Locate Features Along Routes tool outside of your code and consume the table with an ICursor process. I have only developed Addins with .Net. I have no idea what is involved in developing an soe. You will have to look to others for any help specific to soe development. IS is pooible that M values can be negative?
... View more
05-26-2014
04:15 AM
|
0
|
0
|
547
|
POST
|
If u can post a link of an example it would be useful and I should have mentioned it earlier that I am creating soe
... View more
05-22-2014
07:42 AM
|
0
|
0
|
547
|
POST
|
this was just wriiten as an expample that i have these two polyline and points list jsut was asking about an example. i think this example is good enough http://help.arcgis.com/en/sdk/10.0/vba_desktop/conceptualhelp/index.html#//0001000000q5000000
... View more
05-22-2014
05:14 AM
|
0
|
0
|
547
|
POST
|
for example i have this Polyline poly = new Polyline(); Multipoint mp = new Multipoint(); can you tell me which classes to use?
... View more
05-22-2014
04:58 AM
|
0
|
0
|
547
|
POST
|
I have a point on line let say x,y and a list of points i want to find out the points closest to the point x,y at both ends for example ------------------------------ x1,y1 p1------------------------------|----------------------------------p2 and a list of point(p2,p3,p4,p5.......) now i want to find the closest two points ------------------------- p5-----x1,y1----p6 p1-----------------------|-------|---------|----------------------------------p2 is there any functioality available in arcobject that can perform this operation?
... View more
05-22-2014
03:59 AM
|
0
|
10
|
1265
|
POST
|
I have following code SOEHelper soeHelper = new SOEHelper(); IRouteLocator routeLocator = soeHelper.GetRouteLocator(featureClass, idFieldNameValue, soeHelper.getMeasurementUnit(measureUnit)); if(routeLocator == null) { serverLog.addMessage(2, 500,"Route Locator is null" ); } else { serverLog.addMessage(2, 500,"Route Locator" ); } IRouteLocation routeLocation = new RouteMeasurePointLocation(); routeLocation.setRouteID(routeID); routeLocation.setMeasureUnit(routeLocator.getMeasureUnit()); routeLocation.setLateralOffset(offset); IRouteMeasurePointLocation routeMeasurePointLocation = (IRouteMeasurePointLocation)routeLocation; routeMeasurePointLocation.setMeasure(measure); serverLog.addMessage(2, 500, "index " + routeLocator.getRouteFeatureClass().getFields().getFieldCount() ); IGeometry[] geometry = new Point[1]; int[] locatingError = null; routeLocator.locate(routeLocation,geometry , locatingError); if(geometry !=null) { serverLog.addMessage(2, 500,"geometry length" + geometry.length ); } else { serverLog.addMessage(2, 500,"geometry IS NULL" ); } if(locatingError != null) { String str = ""; for(int errorCode : locatingError) { str += errorCode + ","; } serverLog.addMessage(2, 500,str ); } else { serverLog.addMessage(2, 500,"locating error IS NULL" ); } but i am getting empty geometry and error code the log output is Route Locator index 11 geometry IS NULL locating error IS NULL Any idea what might be be wrong here? when i am passing int[] locatingError = new int[1]; now it is giving me the error code but when i do this to geometry IGeometry[] geometry = new Point[1]; it is returuning null in geometry[0] ??
... View more
05-20-2014
08:46 PM
|
0
|
0
|
530
|
POST
|
Actually i have SOE in c# (http://www.arcgis.com/home/item.html?id=e3bfa7c991e34aa8872c937ca9169507) and i want to convert it to java , in this SOE there is a function as below private byte[] PointLocationOperHandler(NameValueCollection boundVariables, JsonObject operationInput, string outputFormat, string requestProperties, out string responseProperties) { responseProperties = "{\"Content-Type\" : \"application/json\"}"; ; int routeLayerID = Convert.ToInt32(boundVariables["RouteLayersID"], CultureInfo.InvariantCulture); when i am using eclipse plugin to generate the SOE template i cant find boundVariables And if you can please refer material or book for arcobjects in java
... View more
05-20-2014
02:21 AM
|
0
|
0
|
200
|
POST
|
I have an SOE in which i have to acess the layer id in the url e.g i have http://serverurl/rest/services/Utility/MapServer/exts/Utility/routeLayers/0/IdentifyRoute?............... how can i get the layer id(0) from the url in SOE
... View more
05-19-2014
10:52 PM
|
0
|
2
|
790
|
POST
|
Hi, if i have a polyline i want to find out the point at , let say 5 km in flex is there a function available to do it without service call.
... View more
05-17-2014
03:35 AM
|
0
|
0
|
408
|
POST
|
if i have this IRouteLocator2 routeLocator = GetRouteLocator(featureClass, idFieldNameValue, measureUnit); IRouteLocation routeLocation = new RouteMeasurePointLocation(); routeLocation.setRouteID(routeID); routeLocation.setMeasureUnit(routeLocator.getMeasureUnit()); routeLocation.setLateralOffset(offset); how can i get the polyline of the routeiD
... View more
05-14-2014
05:18 AM
|
0
|
0
|
1854
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|