Class LocalMapService
- java.lang.Object
-
- com.esri.arcgisruntime.localserver.LocalService
-
- com.esri.arcgisruntime.localserver.LocalMapService
-
- Direct Known Subclasses:
LocalFeatureService
public class LocalMapService extends LocalService
Class representing a local map service. A local map service requires a map package file (.mpk) which will have been authored in ArcGIS Desktop.- Since:
- 100.0.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.esri.arcgisruntime.localserver.LocalService
LocalService.StatusChangedEvent, LocalService.StatusChangedListener
-
-
Field Summary
-
Fields inherited from class com.esri.arcgisruntime.localserver.LocalService
mEndpoints
-
-
Constructor Summary
Constructors Constructor Description LocalMapService(String packagePath)
Creates a local map service from a package (.mpk) file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<DynamicWorkspace>
getDynamicWorkspaces()
Gets an unmodifiable list of this service's dynamic workspaces.int
getMaxRecords()
Gets the maximum number of records the service will return.protected Map<String,String>
getParameters()
Gets the parameters needed to start the local service.String
getUrl()
Returns the URL of this map service.void
setDynamicWorkspaces(Iterable<DynamicWorkspace> dynamicWorkspaces)
Sets the dynamic workspaces for this service.void
setMaxRecords(int maxRecords)
Sets the maximum number of records returned by the service.-
Methods inherited from class com.esri.arcgisruntime.localserver.LocalService
addStatusChangedListener, getError, getName, getPackagePath, getStatus, removeStatusChangedListener, startAsync, stopAsync
-
-
-
-
Constructor Detail
-
LocalMapService
public LocalMapService(String packagePath)
Creates a local map service from a package (.mpk) file.- Throws:
IllegalArgumentException
- if the package path is null or empty- Since:
- 100.0.0
-
-
Method Detail
-
getMaxRecords
public int getMaxRecords()
Gets the maximum number of records the service will return. The default value is 10000.- Returns:
- the maximum number of records the service will return
- Since:
- 100.0.0
-
setMaxRecords
public void setMaxRecords(int maxRecords)
Sets the maximum number of records returned by the service. Cannot be set on a running service.- Parameters:
maxRecords
- the maximum number of records- Throws:
IllegalArgumentException
- if the value is zero or lessIllegalStateException
- if the service is not in the STOPPED state- Since:
- 100.0.0
-
setDynamicWorkspaces
public void setDynamicWorkspaces(Iterable<DynamicWorkspace> dynamicWorkspaces)
Sets the dynamic workspaces for this service. Can only be set when the service is in theLocalServerStatus.STOPPED
state. Setting this property will replace any previously set values. Can be null or an empty list.- Parameters:
dynamicWorkspaces
- the workspaces- Throws:
IllegalStateException
- if the service is not in the STOPPED state- Since:
- 100.1.0
-
getDynamicWorkspaces
public List<DynamicWorkspace> getDynamicWorkspaces()
Gets an unmodifiable list of this service's dynamic workspaces.- Returns:
- an unmodifiable list of dynamic workspaces
- Since:
- 100.1.0
-
getUrl
public String getUrl()
Returns the URL of this map service. This is needed to access the service using anArcGISMapImageLayer
as show below:// create a map image layer from the local service and add it to the map ArcGISMapImageLayer mapImageLayer = new ArcGISMapImageLayer(localMapService.getUrl()); map.getOperationalLayers().add(mapImageLayer);
- Specified by:
getUrl
in classLocalService
- Returns:
- the URL
- Since:
- 100.0.0;
-
getParameters
protected Map<String,String> getParameters() throws UnsupportedEncodingException
Description copied from class:LocalService
Gets the parameters needed to start the local service.- Overrides:
getParameters
in classLocalService
- Returns:
- returns a map containing the parameters
- Throws:
UnsupportedEncodingException
-
-