POST
|
Hi, I have selected a feature on Map , and i am trying to read the attribute of the selected feature . But all attributes are null. I am using ArcGIS 10.4 Engine Postgresql 9.4 64 bit Following is my code snippet. public void onMouseDown(IMapControlEvents2OnMouseDownEvent event) throws AutomationException, IOException { double x = event.getMapX(); double y = event.getMapY(); if (event.getButton() == 1) { try { selectFeaturesScreenPoint(mapBean.getMap(),event.getX(),event.getY(),20); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); public void selectFeaturesScreenPoint(IMap map, int x, int y, int pixelTol)throws Exception { tagRECT r[] = new tagRECT[1]; r[0]=new tagRECT(); // Construct a small rectangle out of the x,y coordinates' pixel // tolerance. r[0].left = x - pixelTol; // Upper left x, top left is 0,0. r[0].top = y - pixelTol; // Upper left y, top left is 0,0. r[0].right = x + pixelTol; // Lower right x, top left is 0,0. r[0].bottom = y + pixelTol; // Lower right y, top left is 0,0. // Transform the device rectangle into a geographic rectangle via the // display transformation. IEnvelope envelope = new Envelope(); IActiveView activeView = (IActiveView)map; IDisplayTransformation displayXform = activeView.getScreenDisplay() .getDisplayTransformation(); displayXform.transformRect(envelope, r, 100); // 5 = esriTransformPosition + esriTransformToMap. envelope.setSpatialReferenceByRef(map.getSpatialReference()); ISelectionEnvironment selectionEnv = new SelectionEnvironment(); selectionEnv.setCombinationMethod(esriSelectionResultEnum.esriSelectionResultNew); map.selectByShape(envelope, selectionEnv, true); activeView.refresh(); if(map.getSelectionCount()>0) { System.out.println("Item is selected "); MapSelection mapSelection = new MapSelection(map.getFeatureSelection()); mapSelection.reset(); IFeature feature = mapSelection.next(); System.out.println("Selected Feature is "+feature.getFields().getFieldCount()); Fields fields = (Fields) feature.getFields(); int fieldCount = fields.getFieldCount(); // Go through each field and print to the console for (int index = 0; index < fieldCount; index++) { System.out.print( "\t" + " " +fields.getField(index).getDefaultValue()); } } } Can anybody help me.
... View more
05-29-2017
02:42 AM
|
0
|
1
|
701
|
POST
|
Thanks for Solution . It is working now ..One Problem is that we should connect the DB using SDE User ,then run this particular tool on that connection ,it works.
... View more
05-24-2017
01:53 AM
|
0
|
1
|
825
|
POST
|
I am using Postgres 9.4.11(64bit) , PostGIS 2.3.2 (64bit) , ArcGIS 10.4 .. Windows 8 64Bit OS.
... View more
05-22-2017
09:07 PM
|
0
|
0
|
825
|
POST
|
I am using Postgres 9.4.11(64bit) , PostGIS 2.3.2 (64bit) , ArcGIS 10.4 .. Windows 8 64Bit OS.
... View more
05-22-2017
09:06 PM
|
0
|
5
|
825
|
POST
|
I am running Create Enterprise GeoDatabase tool on PostgreSQL Database on windows ,this tool is throwing above error
... View more
05-21-2017
09:05 PM
|
0
|
11
|
2570
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|