How to display label infomation

8035
7
05-20-2014 12:14 AM
zijianzhu
New Contributor
Hello,
    I am currently doing an Android project which shows the plan of networks. I have an online mapservice and feature service which contains the label infomation. But neither of them can display the label information in the map. Could someone tell me how to do it?
0 Kudos
7 Replies
RaymondHuang
Occasional Contributor
Hi Zijian,

Generally speaking, there are two methods to this:

If you want the map service to automatically show labels, you need to set up labels in your data in ArcMap before you publish it as a map service. Labels are only supported on map services. For details on making a map with labels in ArcMap, see http://resources.arcgis.com/en/help/main/10.2/index.html#/Essential_labeling_concepts/00s80000000t00....

However, if you wish to pull in attribute information from the feature service to setup and draw the label in android, check out this: https://developers.arcgis.com/android/api-reference/reference/com/esri/core/map/LabelingInfo.html

Hope it helps point your project in the right direction.

Cheers,
Raymond
0 Kudos
AneteFridrihsone
New Contributor II

Hello,

Ive only seen labelingInfo being cast on dynamiclayer (by using DrawingInfo) in android apps. Any advices how can I cast it on ArcGISFeatureLayer? Thanks!

0 Kudos
zijianzhu
New Contributor
Hi Zijian,

Generally speaking, there are two methods to this:

If you want the map service to automatically show labels, you need to set up labels in your data in ArcMap before you publish it as a map service. Labels are only supported on map services. For details on making a map with labels in ArcMap, see http://resources.arcgis.com/en/help/main/10.2/index.html#/Essential_labeling_concepts/00s80000000t00....

However, if you wish to pull in attribute information from the feature service to setup and draw the label in android, check out this: https://developers.arcgis.com/android/api-reference/reference/com/esri/core/map/LabelingInfo.html

Hope it helps point your project in the right direction.

Cheers,
Raymond


As there is a huge number of geomotrys, I think the second one is not so good. But if I use the first one, I can not edit the attribut of the geometry. So if I can use the featureLayer(featureService) to display the plan and mapsercive to display the label info, the problem will be solved. But how to only display the label info? I have the mapservice, how can I use it, the ArcGISTiledMapServiceLayer doesn't work, neither featureLayer, is there any other way? Thanks for your helping
0 Kudos
RaymondHuang
Occasional Contributor
Hi Zijian,

Yes, you can use Feature Service to support editing functionalities while using the Map Service to display the label as per my previous suggestion from Method 1, that is, author the map with proper labelling. Whenever a geometry's attribute is added/updated through the Feature Service, the Map Server will be able to render new map images with the updated information.

For this to happen, you cannot use a TileMapServiceLayer which lets you to work with a cached map service resource exposed by the ArcGIS Server REST API. A cached service accesses tiles from a cache instead of dynamically rendering images. For dynamic map services, see https://developers.arcgis.com/android/api-reference/reference/com/esri/android/map/DynamicLayer.html.

Let me know if I understood you correctly.

Cheers,
Raymond
0 Kudos
zijianzhu
New Contributor
Hi Zijian,

Yes, you can use Feature Service to support editing functionalities while using the Map Service to display the label as per my previous suggestion from Method 1, that is, author the map with proper labelling. Whenever a geometry's attribute is added/updated through the Feature Service, the Map Server will be able to render new map images with the updated information.

For this to happen, you cannot use a TileMapServiceLayer which lets you to work with a cached map service resource exposed by the ArcGIS Server REST API. A cached service accesses tiles from a cache instead of dynamically rendering images. For dynamic map services, see https://developers.arcgis.com/android/api-reference/reference/com/esri/android/map/DynamicLayer.html.

Let me know if I understood you correctly.

Cheers,
Raymond



Hi Raymond,

Your suggestion is really helpful, now I want to use ArcGISDynamicMapServiceLayer to display the label info, but the problem is how I can only display the label info without the symbols. This is my code.


This is the map service
DynamicLayer li = new ArcGISDynamicMapServiceLayer(this.getResources()
    .getString(R.string.feature_url));
  mMapView.addLayer(li);

Clermont_TEST (MapServer)

View In:   ArcMap   ArcGIS Explorer   ArcGIS JavaScript   ArcGIS.com Map   Google Earth 

View Footprint In:   Google Earth 

Service Description: 

Map Name: Couches

Legend 

All Layers and Tables 

Layers:
SIG.COVAGE.RESCOV_SITES (0)
SIG.COVAGE.RESCOV_CABLES (1)
SIG.COVAGE.RESCOV_PT_TECH (2)
SIG.COVAGE.RESCOV_SUPPORT (3)
Description: 

Copyright Text: 


This is the first sublayer
Layer: SIG.COVAGE.RESCOV_SITES (ID:0)

Display Field: NOM

Type: Feature Layer 

Geometry Type: esriGeometryPoint 

Description: 

Definition Expression: RESEAU = 'CC' 

Copyright Text: 

Min. Scale: 0.0 

Max. Scale: 0.0 

Default Visibility: true

Extent:
XMin: 335847.84710250073
YMin: 6196674.762395348
XMax: 1227493.0724970268
YMax: 7108515.558903408
Spatial Reference: PROJCS["RGF_1993_Lambert_93",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",700000.0],PARAMETER["False_Northing",6600000.0],PARAMETER["Central_Meridian",3.0],PARAMETER["Standard_Parallel_1",44.0],PARAMETER["Standard_Parallel_2",49.0],PARAMETER["Latitude_Of_Origin",46.5],UNIT["Meter",1.0]]
Drawing Info:
Renderer:
Simple Renderer:
Symbol:
Picture Marker Symbol:

Label: 
Description: 
Transparency: 0
Labeling Info:
Label Placement: esriServerPointLabelPlacementAboveRight
Label Expression: [NOM]
Use Coded Values: true
Symbol:
Simple Text Symbol:
Color: [0, 0, 0, 255]
Background Color: N/A
Outline Color: N/A
Vertical Alignment: bottom
Horizontal Alignment: center
Right to Left: false
Angle: 0.0
XOffset: 0.0
YOffset: 0.0
Size: 8.0
Font Family: Arial
Font Style: normal
Font Weight: normal
Font Decoration: none
Min. Scale: 5000.0
Max. Scale: 0.0


I can display neither symbol nor label info. That is really strange. When I use the featureLayer, I can at least display symbols.

Thanks for your help.

Cheers
Zijian
0 Kudos
RaymondHuang
Occasional Contributor
Hi Zijian,

Can you share your Map Service and Feature Service URL for us to check the service parameters?

Raymond
0 Kudos
zijianzhu
New Contributor
Dear Raymond

I can not show you the site but I copy the info of my map server

ArcGIS Services Directory
Home > Clermont_TEST (MapServer) Help | API Reference
Clermont_TEST (MapServer)

View In:   ArcMap   ArcGIS Explorer   ArcGIS JavaScript   ArcGIS.com Map   Google Earth

View Footprint In:   Google Earth

Service Description:

Map Name: Couches

Legend

All Layers and Tables

Layers:
SIG.COVAGE.RESCOV_SITES (0)
SIG.COVAGE.RESCOV_CABLES (1)
SIG.COVAGE.RESCOV_PT_TECH (2)
SIG.COVAGE.RESCOV_SUPPORT (3)
Description:

Copyright Text:

Spatial Reference: PROJCS["RGF_1993_Lambert_93",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",700000.0],PARAMETER["False_Northing",6600000.0],PARAMETER["Central_Meridian",3.0],PARAMETER["Standard_Parallel_1",44.0],PARAMETER["Standard_Parallel_2",49.0],PARAMETER["Latitude_Of_Origin",46.5],UNIT["Meter",1.0]]

Single Fused Map Cache: false

Initial Extent:
XMin: 684972.8280251798
YMin: 6510896.448649341
XMax: 735224.7604746498
YMax: 6528690.575549481
Spatial Reference: PROJCS["RGF_1993_Lambert_93",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",700000.0],PARAMETER["False_Northing",6600000.0],PARAMETER["Central_Meridian",3.0],PARAMETER["Standard_Parallel_1",44.0],PARAMETER["Standard_Parallel_2",49.0],PARAMETER["Latitude_Of_Origin",46.5],UNIT["Meter",1.0]]
Full Extent:
XMin: 700903.4631999952
YMin: 6511705.272599347
XMax: 719294.1252998349
YMax: 6527881.751599476
Spatial Reference: PROJCS["RGF_1993_Lambert_93",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",700000.0],PARAMETER["False_Northing",6600000.0],PARAMETER["Central_Meridian",3.0],PARAMETER["Standard_Parallel_1",44.0],PARAMETER["Standard_Parallel_2",49.0],PARAMETER["Latitude_Of_Origin",46.5],UNIT["Meter",1.0]]
Units: esriMeters

Supported Image Format Types: PNG32,PNG24,PNG,JPG,DIB,TIFF,EMF,PS,PDF,GIF,SVG,SVGZ,BMP

Document Info:
Title:
Author:
Comments:
Subject:
Category:
Keywords:
AntialiasingMode: Fastest
TextAntialiasingMode: Normal
Supported Interfaces:   REST   SOAP   WFS

Supported Operations:   Export Map   Identify   Find



And the first sublayer of mapserver
Layer: SIG.COVAGE.RESCOV_SITES (ID:0)

Display Field: NOM

Type: Feature Layer

Geometry Type: esriGeometryPoint

Description:

Definition Expression: RESEAU = 'CC'

Copyright Text:

Min. Scale: 0.0

Max. Scale: 0.0

Default Visibility: true

Extent:
XMin: 335847.84710250073
YMin: 6196674.762395348
XMax: 1227493.0724970268
YMax: 7108515.558903408
Spatial Reference: PROJCS["RGF_1993_Lambert_93",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",700000.0],PARAMETER["False_Northing",6600000.0],PARAMETER["Central_Meridian",3.0],PARAMETER["Standard_Parallel_1",44.0],PARAMETER["Standard_Parallel_2",49.0],PARAMETER["Latitude_Of_Origin",46.5],UNIT["Meter",1.0]]
Drawing Info:
Renderer:
Simple Renderer:
Symbol:
Picture Marker Symbol:

Label:
Description:
Transparency: 0
Labeling Info:
Label Placement: esriServerPointLabelPlacementAboveRight
Label Expression: [NOM]
Use Coded Values: true
Symbol:
Simple Text Symbol:
Color: [0, 0, 0, 255]
Background Color: N/A
Outline Color: N/A
Vertical Alignment: bottom
Horizontal Alignment: center
Right to Left: false
Angle: 0.0
XOffset: 0.0
YOffset: 0.0
Size: 8.0
Font Family: Arial
Font Style: normal
Font Weight: normal
Font Decoration: none
Min. Scale: 5000.0
Max. Scale: 0.0

Has Attachments: false

HTML Popup Type: esriServerHTMLPopupTypeAsHTMLText

Type ID Field: N/A

Fields:
OBJECTID ( Type: esriFieldTypeOID, Alias: OBJECTID )
NOM ( Type: esriFieldTypeString, Alias: NOM , Length: 20 )
ETAT ( Type: esriFieldTypeString, Alias: ETAT , Length: 20 )
DATEMODIFICATION ( Type: esriFieldTypeString, Alias: DATEMODIFICATION , Length: 20 )
CODE ( Type: esriFieldTypeString, Alias: CODE , Length: 20 )
DATE ( Type: esriFieldTypeString, Alias: DATE , Length: 20 )
RESEAU ( Type: esriFieldTypeString, Alias: RESEAU , Length: 20 )
IDCONTENEUR ( Type: esriFieldTypeString, Alias: IDCONTENEUR , Length: 20 )
TYPESTRUCTUREL ( Type: esriFieldTypeString, Alias: TYPESTRUCTUREL , Length: 20 )
EMPRISE ( Type: esriFieldTypeString, Alias: EMPRISE , Length: 20 )
DSP ( Type: esriFieldTypeString, Alias: DSP , Length: 20 )
GESTIONNAIRE ( Type: esriFieldTypeString, Alias: GESTIONNAIRE , Length: 20 )
PROPRIETAIRE ( Type: esriFieldTypeString, Alias: PROPRIETAIRE , Length: 20 )
IDADRESSE ( Type: esriFieldTypeString, Alias: IDADRESSE , Length: 20 )
ID ( Type: esriFieldTypeString, Alias: ID , Length: 20 )
CREATEUR ( Type: esriFieldTypeString, Alias: CREATEUR , Length: 20 )
TYPEFONCTIONNEL ( Type: esriFieldTypeString, Alias: TYPEFONCTIONNEL , Length: 20 )
DATECREATION ( Type: esriFieldTypeString, Alias: DATECREATION , Length: 20 )
MODIFICATEUR ( Type: esriFieldTypeString, Alias: MODIFICATEUR , Length: 20 )
SHAPE ( Type: esriFieldTypeGeometry, Alias: SHAPE )
Supported Interfaces:   REST

Supported Operations:   Query


I used the dynamicMapServiceLayer to display but it doesn't work

ArcGISDynamicMapServiceLayer mapLayer = new
   ArcGISDynamicMapServiceLayer(
   "http://10.192.1.44:8399/arcgis/rest/services/Clermont_TEST/MapServer");
   mMapView.addLayer(mapLayer);
0 Kudos