Select to view content in your preferred language

How to display a name attribute from a ShapefileFeatureTable on the map?

3983
6
01-13-2016 01:06 PM
EdgarCanul
Occasional Contributor

Greetings,

I have a CSV file in the following form:

Name,Latitude,Longitude

VS01,2153797.44782777,-10702155.84486526

VS02,2157776.89764107,-10702274.58364621

I have generated the corresponding shape file and used a ShapefileFeatureTable and FeatureLayer, but when the shape is displayed on the map only the points are shown. How can I also visualize the name attribute to the corresponding points?

In the attached image is what I've done so far.

I need to do this using the API ArcGis SDK for Java

0 Kudos
6 Replies
PatrickMarren
Emerging Contributor

Seems like you just need to label the features. You can use the Label tool on the Drawing toolbar to click each feature you want to display the name for, or you can use dynamic labels by enabling them in the feature Layer Properties dialog.

0 Kudos
EdgarCanul
Occasional Contributor

Sorry! I forgot to mention that I need to do this programmatically. I'm doing this using the ArcGis SDK for Java 10.2.4

0 Kudos
PatrickMarren
Emerging Contributor

Sorry, can't help with that, but your question is probably better asked in ArcGIS SDK for Java​.

0 Kudos
nita14
by
Frequent Contributor

HI,

Well, there are some options:

1) Set labels for Feature Layer - setEnableLabels method

2) Make a use of TextSymbol for Graphic in Grpahic Layers

Add graphics and text—ArcGIS Runtime SDK for Java | ArcGIS for Developers

3) Try to use MapTips

Show MapTips—ArcGIS Runtime SDK for Java | ArcGIS for Developers

Hope this helps,

Adam

0 Kudos
EdgarCanul
Occasional Contributor

Hello,

Sorry for the delay of my response, I'd been working out.

Option 2 is not an alternative because I have a great number of points, and all of them are placed dynamically.

I've tried option 3 and works great. Thanks a lot.

But I'd like to have the labes there permanently, not only when mouse hovers them, so that I tried the option 1 inside a layerInitializeComplete listener (as the documentation commands) but it happens nothing. There is none of the labels. And I don't receive any exception. Is there a preparing procedure before turn the labels visibility on?

0 Kudos
nita14
by
Frequent Contributor

Edgar,

You need to set the labels in ArcGIS for Desktop and then Create a Runtime Content geodatabase. This works for me.

Regards,

Adam

0 Kudos