Points Attribute Editing

368
3
04-01-2013 07:05 PM
DaniSetiawan
New Contributor
Hi,

I would like to implement attribute editing for point features. There is a nice sample "AttributeEditor" for editing attributes but polygon layer is used in it. There is no problem by selecting a polygon feature on the map. But, what about point layer? I've changed the feature layer with point layer but I cannot select a point on the map.

What should I must do?
Have any of you solved this?

Regards
0 Kudos
3 Replies
NigelDsouza
Occasional Contributor
Hi,
Since the point feature is too small hence the query does not fire properly on the layer. I had faced the same problem.
The solution? Since this sample works best for polygon layers, I decided to put the point i click in a polygon itself. So using geometric engine i create a small buffer(0.1) round the point. Now this buffer returns a polygon which is the same geometry type of the sample.
Now when you click your point you should see your attributes pop up in no time 😄 .

Note: Since the buffer distance is (0.1) for better accuracy, you might have to zoom a bit and then click the point to view your attributes.

Code:
pointClicked = mapControl.toMapPoint(x, y);

Polygon poly = (Polygon) GeometryEngine.buffer(pointClicked, mapControl.getSpatialReference(),0.1,mapControl.getSpatialReference().getUnit());

Regards,
Nigel.
0 Kudos
ErwinSoekianto
Esri Regular Contributor
I agree, technically you can use point layer, but it is just not accurate, since point is too small. Sometime it looks like you are tapping on the point, but it actually doesn't

The workaround is to increase the tolerance of the radius around the tapped point for which graphic ids will be returned, which is the DP value.
0 Kudos
ErwinSoekianto
Esri Regular Contributor
Another workaround, please use buffer for the geometry,

=============
Query query = new Query();
        query.setOutFields(new String[] { "*" });
        query.setSpatialRelationship(SpatialRelationship.INTERSECTS);
        Geometry geom=(GeometryEngine.buffer(pointClicked,mapView.getSpatialReference(),100,null));
        query.setGeometry(geom);
        query.setInSpatialReference(mapView.getSpatialReference());
=============

Please note that the buffer number can be adjusted, I purposely make it big to make sure that we can get the query result back.
0 Kudos