FeatureLayer (legacy) | ArcGIS API for JavaScript 3.41

文章推薦指數: 80 %
投票人數:10人

Creates a new instance of a feature layer object from the ArcGIS Server REST resource identified by the input URL. new esri.layers.FeatureLayer( ... ArcGISDevelopers Features Pricing Documentation YourName SignOut Home Guide APIReference SampleCode Community HideTableofContents APIReferenceOverview Setupadevelopmentenvironment PreferredArgumentAliases esri basemaps Color config Credential domUtils Graphic graphicsUtils IdentityManager IdentityManagerBase ImageSpatialReference InfoTemplate InfoWindowBase kernel lang Map OperationBase request ServerInfo SnappingManager SpatialReference TimeExtent UndoManager units urlUtils esri/arcadeProfiles fieldCalculateProfile labelingProfile popupProfile visualizationProfile esri/arcgis OAuthInfo Portal PortalComment PortalFolder PortalGroup PortalItem PortalQueryResult PortalRating PortalUser utils esri/dijit AttributeInspector Attribution Basemap BasemapGallery BasemapLayer BasemapToggle BookmarkItem Bookmarks ClassedColorSlider ClassedSizeSlider ColorInfoSlider ColorPicker Directions ElevationProfile FeatureTable Gallery Gauge Geocoder HeatmapSlider HistogramTimeSlider HomeButton HorizontalSlider ImageServiceMeasure InfoWindow InfoWindowLite LayerList LayerSwipe Legend LocateButton Measurement ObliqueViewer OpacitySlider OverviewMap Popup PopupMobile PopupTemplate Print RendererSlider Scalebar Search SizeInfoSlider SymbolStyler TimeSlider VisibleScaleRangeSlider esri/dijit/analysis AggregatePoints AnalysisBase CalculateDensity ChooseBestFacilities ConnectOriginsToDestinations CreateBuffers CreateDriveTimeAreas CreateViewshed CreateWatersheds DeriveNewLocations DissolveBoundaries EnrichLayer ExtractData FindExistingLocations FindHotSpots FindNearest FindSimilarLocations InterpolatePoints MergeLayers OverlayLayers PlanRoutes SummarizeNearby SummarizeWithin TraceDownstream esri/dijit/editing Add AttachmentEditor Cut Delete Editor TemplatePicker Union Update esri/dijit/geoenrichment DataBrowser Infographic InfographicsCarousel InfographicsOptions InfographicsOptionsItem esri/dijit/geoenrichment/ReportPlayer DataProviderGE PlayerCommands PlayerResizeModes PlayerThemes PlayerViewModes PlayerZoomBehaviors ReportPlayer esri/dijit/util busyIndicator esri/geometry Circle coordinateFormatter Extent geodesicUtils GeographicTransformation GeographicTransformationStep Geometry geometryEngine geometryEngineAsync jsonUtils mathUtils Multipoint normalizeUtils Point Polygon Polyline projection scaleUtils ScreenPoint screenUtils webMercatorUtils esri/layer/pixelFilters StretchFilter esri/layers ArcGISDynamicMapServiceLayer ArcGISImageServiceLayer ArcGISImageServiceVectorLayer ArcGISTiledMapServiceLayer CodedValueDomain CSVLayer DataAdapterFeatureLayer DataSource DimensionalDefinition Domain DynamicLayerInfo DynamicMapServiceLayer FeatureEditResult FeatureLayer FeatureTemplate FeatureType Field GeoRSSLayer GraphicsLayer ImageParameters ImageServiceParameters InheritedDomain JoinDataSource KMLFolder KMLGroundOverlay KMLLayer LabelClass LabelLayer Layer LayerDataSource LayerDrawingOptions LayerInfo LayerMapSource LayerSource LayerTimeOptions LOD MapImage MapImageLayer MosaicRule OpenStreetMapLayer PixelBlock QueryDataSource RangeDomain RasterDataSource RasterFunction RasterLayer StreamLayer TableDataSource TiledMapServiceLayer TileInfo TimeInfo TimeReference VectorTileLayer WCSConnection WCSCoverageDescription WCSLayer WebTiledLayer WFSLayer WMSLayer WMSLayerInfo WMTSLayer WMTSLayerInfo esri/plugins FeatureLayerStatistics spatialIndex esri/process Processor SpatialIndex esri/renderers BlendRenderer ClassBreaksRenderer DotDensityRenderer HeatmapRenderer jsonUtils Renderer ScaleDependentRenderer SimpleRenderer smartMapping SymbolAger TemporalRenderer TimeClassBreaksAger TimeRampAger UniqueValueRenderer VectorFieldRenderer esri/styles basic choropleth heatmap relationship size type esri/support expressionUtils esri/symbols CartographicLineSymbol FillSymbol Font jsonUtils LineSymbol MarkerSymbol PictureFillSymbol PictureMarkerSymbol SimpleFillSymbol SimpleLineSymbol SimpleMarkerSymbol Symbol TextSymbol esri/tasks AddressCandidate AlgorithmicColorRamp AreasAndLengthsParameters BufferParameters ClassBreaksDefinition ClassificationDefinition ClosestFacilityParameters ClosestFacilitySolveResult ClosestFacilityTask ColorRamp DataFile DataLayer Date DensifyParameters DirectionsFeatureSet DistanceParameters FeatureSet FindParameters FindResult FindTask GeneralizeParameters GenerateRendererParameters GenerateRendererTask GeometryService Geoprocessor GPMessage IdentifyParameters IdentifyResult IdentifyTask ImageServiceIdentifyParameters ImageServiceIdentifyResult ImageServiceIdentifyTask ImageServiceMeasureParameters ImageServiceMeasureTask JobInfo LegendLayer LengthsParameters LinearUnit Locator MultipartColorRamp NAMessage NAOutputLine NAOutputPolygon NATravelDirection NATypes NAUTurn OffsetParameters ParameterValue PrintParameters PrintTask PrintTemplate ProjectParameters Query QueryTask RasterData RelationParameters RelationshipQuery RouteParameters RouteResult RouteTask ServiceAreaParameters ServiceAreaSolveResult ServiceAreaTask StatisticDefinition TrimExtendParameters UniqueValueDefinition esri/tasks/datareviewer BatchValidationJob BatchValidationJobInfo BatchValidationParameters BatchValidationTask DashboardResult DashboardTask GetResultsQueryParameters ReviewerAttributes ReviewerFilters ReviewerLifecycle ReviewerResultsTask ReviewerSession SessionOptions esri/tasks/geoenrichment AddressStudyArea DriveBuffer DriveUnits GeographyLevel GeographyQuery GeographyQueryBase GeometryStudyArea IntersectingGeographies RingBuffer StandardGeographyQueryTask StandardGeographyStudyArea StudyArea SubGeographyQuery esri/tasks/locationproviders CoordinatesLocationProvider GeometryLocationProvider LocationProviderBase LocationProviderClientBase LocationProviderRemoteBase LocatorLocationProvider QueryTaskLocationProvider StandardGeographyQueryLocationProvider esri/toolbars Draw Edit ImageServiceMeasureTool Navigation esri/virtualearth VEAddress VEGeocoder VEGeocodeResult VETiledLayer esri/workers WorkerClient Printthispage Class:FeatureLayer [AMDModuleRequire|LegacyModuleRequire] Constructors|Constants|Properties|Methods|Events dojo.require("esri.layers.FeatureLayer"); Description (Addedatv2.0)ThefeaturelayerinheritsfromthegraphicslayerandcanbeusedtodisplayfeaturesfromasinglelayerineitheraMapServiceorFeatureService.Thelayercanbeeithera(spatial)layeror(non-spatial)table.ThefeaturesinafeaturelayercanbeeditediftheisEditablemethodistrue.TheFeatureLayerwill,bydefault,usethedrawinginformationfromtheserver(requiresArcGISServer10orabove).Foranexample,seethesimplerendererintheDrawingInfoathttp://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/EarthquakesFromLastSevenDays/MapServer/0 WebGLrenderingStartingatversion3.24,youcanoptintorenderFeatureLayerwithWebGL.Thisallowsyoutodisplaymoredatainthemapandupdatethevisualizationoffeaturesmorerapidly.ToenableWebGLrenderingofFeatureLayer,pastethefollowingscriptinyourapplicationpriortoloadingtheArcGISAPIforJavaScript: Onceenabledgloballyfortheapp,WebGLcanbetoggledon/offusingtheAPIbelow: webglEnabled-Aconstructoroptionandproperty.setWebglEnabled()-AmethodfortogglingWebGLon/offforthelayer.hasWebGLSurface()-AmethodforcheckingwhetheralayerisrenderedwithWebGL.KnownLimitationsThefollowingarecurrentlimitationsofWebGL-renderedFeatureLayerssubjecttochangeinfuturereleases.Ifanyoftheseconditionsarenotmet,thenthelayerwillautomaticallyswitchfromWebGLtoSVGduringthesession.SupportislimitedtolayerscreatedfromfeatureserviceshostedonArcGISOnlineandnon-hostedenterprisefeatureservicesversions10.6.1orlater.FeatureLayerscreatedfromFeatureCollectionsarenotsupported.Polygonlayersmustsupportreturningcentroids.Thelayermustnotbeeditable.Thelayermustnotbeclustered.Thelayermustuseon-demandfetchmode.Thelayermustnotuselabels.ThelayermustnotuseArcadeexpressionscontaininggeometryoperations.Thelayer'srenderermustbeoftypeSimpleRenderer,ClassBreaksRenderer,orUniqueValueRenderer.Colorandopacityvisualvariablesmusthave8stopsorless.Attribute-drivensizevisualvariablesmusthave6stopsorless.Thisdoesnotaffectvariablesdrivenbymapscale.Linesymbolsmustnothavearrowmarkers.Selectionsymbolisnotsupported.NotethatonlytheclickeventwillfirewhenWebGLisenabled.Allothereventsarenotsupported.FeatureLayersubclassesdonotsupportWebGLrendering.Alsonotethatmodifyingattributes,symbol,geometryandvisibilityofindividualfeaturesinaWebGL-renderedlayerwillNOThaveanyeffect. Samples Searchforsamplesthatusethisclass. Classhierarchy esri/layers.Layer |_esri/layers.GraphicsLayer |_esri/layers.FeatureLayer Subclasses CSVLayer,DataAdapterFeatureLayer,StreamLayer Constructors NameSummary newesri.layers.FeatureLayer(url,options?)CreatesanewinstanceofafeaturelayerobjectfromtheArcGISServerRESTresourceidentifiedbytheinputURL. newesri.layers.FeatureLayer(featureCollectionObject,options?)CreatesanewinstanceofafeaturelayerusingaFeatureCollectionobject. Constants NameDescription MODE_AUTODelegatetoeitheron-demandorsnapshotmodedependingonthecharacteristicsoftheservice.Thisisonlyapplicabletohostedfeatureservices. IfthetotalnumberoffeaturesinalayerarelessthanmaxRecordCountandtotalvertexesislessthan250,000,snapshotmodeisused.Otherwise,on-demandmodeisused.Thepurposebehindthismodeistoreduceserver-sideload.Insteadofgettingasmallnumberoffeatureswithseveralrequests(on-demandmode),getallfeatureswithasinglerequest.Thismoderequiresanadditionalrequesttocompletebeforeretrievinganyfeatures. MODE_ONDEMANDInon-demandmode,thefeaturelayerretrievesfeaturesfromtheserverwhenneeded.Thisisbasedontherequirementsdefinedinthefollowingproperties: Mappropertiessuchasthecurrentspatialextentandtimeextent. Layerpropertiessuchastimeoffsetanddefinitionexpression. MODE_SELECTIONInselectionmode,featuresareretrievedfromtheserveronlywhentheyareselected.Featuresareavailableontheclientonlywhiletheyareselected.Toworkwithselectedfeatures: CalltheselectFeaturesmethod. ListenfortheonSelectionCompleteevent. OnceonSelectionCompletefires,retrievetheselectedfeaturesusingthegetSelectedFeaturesmethod. Wheneditingfeaturelayersinselectionmode,youwillneedtoaddthemapserviceassociatedwiththefeatureservicetothemapasadynamicmapservice.Ifyoudonothavethemapserviceaddedasadynamicmapservicethenthechangeswillnotbevisiblebecauseoncetheeditsarecompletethefeatureisnolongerselected. MODE_SNAPSHOTInsnapshotmode,thefeaturelayerretrievesallthefeaturesfromtheassociatedlayerresourceanddisplaysthemasgraphicsontheclient.Definitionexpressionsandtimedefinitionsarehonored.Thefeaturesareretrievedoncethefeaturelayerisaddedtothemap.AftertheonUpdateEndeventhasfired,youcanaccessthefeaturesusingthegraphicspropertyofthelayerorthroughselectionandqueryoperations. POPUP_HTML_TEXTThepopupdisplayscontentinHTML/TEXT. POPUP_NONENopopuptypedefined. POPUP_URLThepopupdisplaysthecontentsofaURL. SELECTION_ADDAddsfeaturestothecurrentselectionset. SELECTION_NEWCreatesanewselection. SELECTION_SUBTRACTRemovesfeaturesfromthecurrentselection. Properties NameTypeSummary advancedQueryCapabilitiesObjectAnobjectthatcontainsservicelevelmetadataaboutwhetherornotthelayersupportsqueriesusingstatistics,orderbyfields,DISTINCT,pagination,querywithdistance,andreturningquerieswithextents. allowGeometryUpdatesBooleanReturnstrueifthegeometryofthefeaturesinthelayercanbeedited,falseotherwise. allowUpdateWithoutMValuesBooleanIndicateswhetherattributefeaturescontainingm-valuescanbeedited. attributionDataUrlStringTheURL,whenavailable,wherethelayer'sattributiondataisstored. capabilitiesStringInformationaboutthecapabilitiesenabledforthislayer. classNameStringclassattributeofthelayer'snode. copyrightStringCopyrightinformationforthelayer. credentialCredentialProvidescredentialinformationforthelayersuchasuseridandtokenifthelayerrepresentsaresourcethatissecuredwithtoken-basedauthentication. dataAttributesString|String[]Listofattributefieldsaddedascustomdataattributestographicsnode. defaultDefinitionExpressionStringMetadatadescribingthedefaultdefinitionexpressionforthelayerasdefinedbytheservice. defaultVisibilityBooleanIndicatesthedefaultvisibilityforthelayer. descriptionStringThedescriptionofthelayerasdefinedinthemapservice. displayFieldStringThenameofthelayer'sprimarydisplayfield. editFieldsInfoObjectIndicatesthefieldnamesfortheeditorfields. editingInfoObjectApplicabletoArcGISOnlinehostedfeatureservices. fieldsField[]Thearrayoffieldsinthelayer. fullExtentExtentThefullextentofthelayer. gdbVersionStringThegeodatabaseversion. geometryTypeStringGeometrytypeofthefeaturesinthelayer. globalIdFieldStringTheglobalIdFieldforthelayer. graphicsGraphic[]Arrayoffeaturesinthelayer. hasAllFeaturesBooleanIndicateswhetherthelayerdisplaysallfeaturesintersectingthecurrentview. hasAttachmentsBooleanTrueifattachmentsareenabledonthefeaturelayer. hasAttributionDataBooleanWhentrue,thelayerhasattributiondata. htmlPopupTypeStringThehtmlpopuptypedefinedforthelayer. idStringIDassignedtothelayer. infoTemplateInfoTemplateTheinfotemplateforthelayer. labelingInfoLabelClass[]Labeldefinitionforthislayer,specifiedasanarrayoflabelclasses. layerIdNumberUniqueIDofthelayerthattheFeatureLayerwasconstructedagainst. loadErrorErrorSetifthelayerfailedtoload. loadedBooleanWhenthelayerisloaded,thevaluebecomes"true",andlayerpropertiescanbeaccessed. maxAllowableOffsetNumberThemaximumallowableoffset,onlyapplicableforlayersthatarenoteditable. maxRecordCountNumberThemaximumnumberofresultsthatwillbereturnedfromaquery. maxScaleNumberMaximumvisiblescaleforthelayer. minScaleNumberMinimumvisiblescaleforthelayer. multipatchOptionStringSupportsfeatureserviceswhosedatasourceisamultipatchfeatureclass. DefaultisxyFootprintifgeometryTypeisesriGeometryMultiPatch. nameStringThenameofthelayerasdefinedinthemapservice. objectIdFieldStringThenameofthefieldthatcontainstheObjectIDfieldforthelayer. opacityNumberOpacityortransparencyoflayer. ownershipBasedAccessControlForFeaturesObjectIndicatestheownershipaccesscontrolconfiguration. refreshIntervalNumberRefreshintervalofthelayerinminutes. relationshipsObject[]Eachelementinthearrayisanobjectthatdescribesthelayer'srelationshipwithanotherlayerortable. rendererRendererTherendererforthelayer. showAttributionBooleanWhentrue,thelayer'sattributionisdisplayedonthemap. showLabelsBooleanDeterminesiflabelsaredisplayed. sourceLayerSourceThedynamiclayerortablesource. stylingBooleanIndicateswhetherthelayerisresponsibleforstylinggraphics. supportsAdvancedQueriesBooleanWhentrue,thelayersupportsorderByFieldsinaqueryoperation. supportsAttachmentsByUploadIdBooleanWhentrue,thelayersupportsuploadingattachmentswithUploadsRESToperation,whichthencanbeusedintheAddAttachmentorUpdateAttachmentRESToperations. supportsCalculateBooleanWhentrue,thelayersupportstheCalculateRESToperationwhenupdatingfeatures. supportsFieldDescriptionBooleanIftrue,thelayersupportsauser-definedfielddescription. supportsStatisticsBooleanWhentrue,thelayersupportsstatisticalfunctionsinqueryoperations. surfaceTypeStringTypeofvectorgraphicssurfaceusedtodrawgraphics. suspendedBooleanWhentrue,thelayerissuspended. templatesFeatureTemplate[]AnarrayoffeaturetemplatesdefinedintheFeatureServicelayer. timeInfoTimeInfoTimeinformationforthelayer,suchasstarttimefield,endtimefield,trackidfield,layerstimeextentandthedrawtimeinterval. typeStringSpecifiesthetypeoflayer. typeIdFieldStringThefieldthatrepresentstheTypeIDfield. typesFeatureType[]AnarrayofsubtypesdefinedintheFeatureServicelayer. urlStringURLtotheArcGISServerRESTresourcethatrepresentsamapservice. versionNumberTheversionofArcGISServerwherethelayerispublished. visibleBooleanVisibilityofthelayer. visibleAtMapScaleBooleanWhentrue,thelayerisvisibleatthecurrentmapscale. webglEnabledBooleanIndicatesifWebGLisenabledonthelayer. Methods NameReturntypeSummary addAttachment(objectId,formNode,callback?,errback?)DeferredAddanattachmenttothefeaturespecifiedbytheObjectId. applyEdits(adds?,updates?,deletes?,callback?,errback?)DeferredApplyeditstothefeaturelayer. attr(name,value)LayerAddsanewattributeorchangesthevalueofanexistingattributeonthelayer'snode. clearSelection()FeatureLayerClearsthecurrentselection. deleteAttachments(objectId,attachmentIds,callback?,errback?)DeferredDeleteoneormoreattachmentsforthefeaturespecifiedbytheinputObjectId. disableFeatureReduction()NoneDisablesfeaturereduction(forexampleclustering)onthelayer. disableMouseEvents()NoneDisablesallmouseeventsonthegraphicslayer. enableFeatureReduction()NoneEnablesfeaturereduction(forexampleclustering)onthelayerusingtheoptionssetinsetFeatureReduction(). enableMouseEvents()NoneEnablesallmouseeventsonthegraphicslayer. getAggregateGraphics()Graphic[]Returnsgraphicsrepresentingtheaggregationofseveralpointfeaturesclusteredtogether. getAttributionData()DeferredAsynchrouslyreturnscustomdataforthelayerwhenavailable. getDefinitionExpression()StringReturnsthecurrentdefinitionexpression. getDomain(fieldName,options?)DomainReturnstheDomainassociatedwiththegivenfieldname. getEditCapabilities(options?)ObjectReturnsanobjectthatdescribestheeditcapabilitiesofthelayer. getEditInfo(feature,options?)ObjectReturnsanobjectdescribingthemostrecenteditoperationperformedonthegivenfeature,ifavailable. getEditSummary(feature,options?)StringReturnsalocalizedsummaryofthelasteditoperationperformedonthegivenfeature,ifavailable. getFeatureReduction()ObjectReturnstheoptionsusedtoreducethenumberoffeaturesvisualizedbythelayer(forexampleclustering). getField(fieldName)FieldReturnstheFieldgiventhespecifiedfieldname. getMap()MapReturnsreferencetothemapcontrolthelayerisaddedto. getMaxAllowableOffset()NumberReturnsthecurrentvalueofthemaxAllowableOffsetusedbythelayer. getNode()HTMLElementReturnsthelayer'sDOMnode. getOrderByFields()String[]Returnsthelistoffieldsusedtoorderfeaturesby. getSelectedFeatures()Graphic[]Getsthecurrentlyselectedfeatures. getSelectionSymbol()SymbolGetsthecurrentselectionsymbol. getSingleGraphics()Graphic[]Returnsgraphicsfromthelayerthatarenotrepresentedbyaggregategraphicswhenfeaturereduction(suchasclustering)isenabled. getTimeDefinition()TimeExtentGetthecurrenttimedefinitionappliedtothefeaturelayer. getType(feature)FeatureTypeReturnsaFeatureTypedescribingthefeature'stype. hasUpdateError()NoneIndicateswhetheranerroristhrownafterthelayerupdates. hasWebGLSurface()BooleanIndicatesifthelayerisrenderedinWebGL. hasXYFootprint()BooleanReturnstrueifgeometryTypeisesriGeometryMultipatchandmultipatchOptionisxyFootprint. hide()NoneSetsthevisibilityofthelayerto"false". isEditable()BooleanReturnstrueiftheFeatureLayeriseditable. isFeatureReductionActive()BooleanIndicatesiffeaturereduction(forexampleclustering)isactiveintheview. isFeatureReductionEnabled()BooleanIndicatesiffeaturereduction(forexampleclustering)isenabled. isVisibleAtScale(scale)BooleanReturnstrueifthelayerisvisibleatthegivenscale. queryAttachmentInfos(objectId,callback?,errback?)DeferredQueryforinformationaboutattachmentsassociatedwiththespecifiedObjectIds. queryCount(query,callback?,errback?)DeferredGetacountofthenumberoffeaturesthatsatisfytheinputquery. queryExtent(query,callback?,errback?)DeferredGettheextentoffeaturesthatsatisfytheinputquery. queryFeatures(query,callback?,errback?)DeferredQueryfeaturesfromthefeaturelayer. queryIds(query,callback?,errback?)DeferredQueryforObjectIds. queryRelatedFeatures(relQuery,callback?,errback?)DeferredQueryfeaturesorrecords,fromanotherlayerortable,relatedtofeaturesinthislayer. redraw()NoneRedrawsallthegraphicsinthegraphicslayer. refresh()NoneRefreshesthefeaturesinthefeaturelayer. resume()NoneResumeslayerdrawing. selectFeatures(query,selectionMethod?,callback?,errback?)DeferredSelectsfeaturesfromtheFeatureLayer. setAutoGeneralize(enable)FeatureLayerEnableordisableautogeneralizationforthelayer. setDefinitionExpression(expression)FeatureLayerSetsthedefinitionexpressionfortheFeatureLayer. setEditable(editable)FeatureLayerSettheeditabilityoffeaturelayerscreatedfromafeaturecollection. setFeatureReduction(options)NoneSetsfeaturereductionoptionsonthelayer(forexampleclusteringoptions). setGDBVersion(versionName)FeatureLayerSetthelayer'sdatasourcetothespecifiedgeodatabaseversion. setInfoTemplate(infoTemplate)NoneSpecifyorchangetheinfotemplateforalayer. setLabelingInfo(labelingInfo)NoneSetslabelinginfoonthelayer. setMaxAllowableOffset(offset)NoneSetsthemaximumallowableoffsetusedwhengeneralizinggeometries. setMaxScale(scale)NoneSetthemaximumscaleforthelayer. setMinScale(scale)NoneSettheminimumscaleforthelayer. setOpacity(opacity)NoneInitialopacityortransparencyoflayer. setRefreshInterval(interval)LayerChangesthelayer'srefreshintervaltothegivenvalue(inminutes). setRenderer(renderer)NoneSettherendererforthefeaturelayer. setScaleRange(minScale,maxScale)NoneSetthescalerangeforthelayer. setSelectionSymbol(symbol)FeatureLayerSetstheselectionsymbolforthefeaturelayer. setShowLabels(showLabels)NoneSetswhethertodisplaylabelsornot. setTimeDefinition(definition)FeatureLayerSetsthetimedefinitionforthefeaturelayer. setTimeOffset(offsetValue,offsetUnits)FeatureLayerTimeoffsetallowsyoutodisplaythefeaturesatadifferenttimesotheycanbeoverlaidontopofpreviousorfuturetimeperiods. setUseMapTime(update)NoneDetermineifthelayerwillupdateitscontentbasedonthemap'scurrenttimeextent. setVisibility(isVisible)NoneSetsthevisibilityofthelayer. setWebGLEnabled(enable)NoneTogglesWebGLrenderingon/offonthelayer. show()NoneSetsthevisibilityofthelayerto"true". suspend()NoneSuspendslayerdrawing. toJson()ObjectReturnsaneasilyserializableobjectrepresentationofthelayer. Events[OnStyleEvents|ConnectStyleEvent]AllOnStyleeventlistenersreceiveasingleeventobject.Additionally,theeventobjectalsocontainsa'target'propertywhosevalueistheobjectwhichfiredtheevent.Events NameEventObjectSummary add-attachment-complete{ result: }FireswhenaddAttachments()iscomplete. before-apply-edits{ adds:, deletes:, updates: }Firedbeforeeditsareappliedtothefeaturelayer. capabilities-changeFiredwhenthecapabilitiesofthelayeraremodifiedusingthesetEditablemethod. click{ event: }Fireswhenagraphichasbeenclicked. dbl-click{ event: }Fireswhenafeaturehasbeendoubleclicked. delete-attachments-complete{ results: }FireswhendeleteAttachmentsiscomplete. edits-complete{ adds:, deletes:, updates: }FiresafterapplyEdits()iscomplete. error{ error: }Fireswhenthereisaproblemretrievingalayer. gdb-version-changeFiredwhenthegeodatabaseversionisswitched. graphic-add{ graphic: }FireswhenagraphicisaddedtotheGraphicsLayer. graphic-draw{ graphic: }Fireswhenagraphicisdrawn. graphic-node-add{ graphic:, node: }Fireswhenagraphic'sDOMnodeiscreatedandaddedtothelayer. graphic-node-remove{ graphic:, node: }Thiseventisfiredwhenagraphic'sDOMnodeisremoved(considerthenodedestroyed). graphic-remove{ graphic: }FireswhenagraphicisremovedfromtheGraphicsLayer. graphics-clearFireswhenallgraphicsintheGraphicsLayerarecleared. labeling-info-changeFiredwhenlabelinginfoonthelayerchanges. load{ layer: }Firesafterlayerpropertiesforthelayeraresuccessfullypopulated. mouse-downmouseEventFireswhenamousebuttonispresseddownandthemousecursorisonagraphic. mouse-dragmouseEventFireswhilethemouseisbeingdraggeduntilthemousebuttonisreleased. mouse-movemouseEventFiresasthemousemovesthroughagraphicontheGraphicsLayer. mouse-outmouseEventFiresasthemouseexitsagraphicontheGraphicsLayer. mouse-overmouseEventFireswhenthemousefirstentersintoagraphicontheGraphicsLayer. mouse-upmouseEventFireswhenamousebuttonisreleasedandthemousecursorisonagraphic. opacity-change{ opacity: }Fireswhenthelayeropacityhasbeenchanged,andreturnsanobjectwiththeopacityvalue. query-attachment-infos-complete{ info: }FireswhenqueryAttachmentInfosmethodiscalled. query-count-complete{ count: }Fireswhenthequeryforthecountiscomplete. query-extent-complete{ count:, extent: }FireswhenqueryExtentmethodhascompleted. query-features-complete{ featureSet: }FireswhenqueryFeatures()iscomplete. query-ids-complete{ objectIds: }FireswhenqueryIds()iscomplete. query-limit-exceededFiredwhenthefeaturelayercouldnotdrawallthefeaturesduetoamaxRecordCountlimitationonaqueryoperation. query-related-features-complete{ relatedFeatures: }FireswhenqueryRelatedFeatures()iscomplete. refresh-interval-changeThiseventisfiredwhenthelayer'srefreshIntervalismodified. refresh-tickFiresrightbeforetheactualrefreshkicksinforthelayer,andonlyfireswhentherefreshistriggeredbytherefreshInterval. resumeFireswhenalayerresumesdrawing. scale-range-changeFireswhenalayer'sminScaleand/ormaxScaleischanged. scale-visibility-changeFireswhenalayer'sscalevisibilitychanges. selection-clearFiresafterclearSelectionhasbeencalled. selection-complete{ features:, method: }FireswhenselectFeatures()completes. show-labels-changeFiredwhenthefeaturelayer'slabelsarechanged. suspendFireswhenalayersuspendsdrawing. updateFiresanytimealayerhasfinishedloadingorupdatingitself. update-end{ error:, info: }Firedwhenthelayerhasfinishedupdatingitscontent. update-startFiredwhenthelayerbeginstoupdateitscontent. visibility-change{ visible: }Fireswhenthelayervisibilityhasbeenchanged,andreturnsanobjectwithaBooleanvisiblepropertycontainingthenewvisibilityvalueofthelayer. OldEvents NameSummary onAddAttachmentComplete(result)FireswhenaddAttachments()iscomplete. onBeforeApplyEdits(adds,updates,deletes)Firedbeforeeditsareappliedtothefeaturelayer. onCapabilitiesChange()FiredwhenthecapabilitiesofthelayeraremodifiedusingthesetEditablemethod. onClick(event)Fireswhenagraphichasbeenclicked.. onDblClick(event)Fireswhenafeaturehasbeendoubleclicked. onDeleteAttachmentsComplete(results)FireswhendeleteAttachmentsiscomplete. onEditsComplete(addResults,updateResults,deleteResults)FiresafterapplyEdits()hasbeencalled. onError(error)Fireswhenthereisaproblemretrievingalayer. onGraphicAdd(graphic)FireswhenagraphicisaddedtotheGraphicsLayer. onGraphicDraw(evt)Fireswhenagraphicisdrawn. onGraphicNodeAdd(evt)Fireswhenagraphic'sDOMnodeiscreatedandaddedtothelayer. onGraphicNodeRemove(evt)Thiseventisfiredwhenagraphic'sDOMnodeisremoved(considerthenodedestroyed). onGraphicRemove(graphic)FireswhenagraphicisremovedfromtheGraphicsLayer. onGraphicsClear()FireswhenallgraphicsintheGraphicsLayerarecleared. onLabelingInfoChange()Firedwhenlabelinginfoonthelayerchanges. onLoad(layer)Firesafterlayerpropertiesforthelayeraresuccessfullypopulated. onMouseDown(event)Fireswhenamousebuttonispresseddownandthemousecursorisonagraphic. onMouseDrag(event)Fireswhilethemouseisbeingdraggeduntilthemousebuttonisreleased. onMouseMove(event)FiresasthemousemovesthroughagraphicontheGraphicsLayer. onMouseOut(event)FiresasthemouseexitsagraphicontheGraphicsLayer. onMouseOver(event)FireswhenthemousefirstentersintoagraphicontheGraphicsLayer. onMouseUp(event)Fireswhenamousebuttonisreleasedandthemousecursorisonagraphic. onOpacityChange(opacity)Fireswhenthelayeropacityhasbeenchanged,andreturnstheopacityvalue. onQueryAttachmentInfosComplete(attachmentInfos)FireswhenqueryAttachmentInfos()iscomplete. onQueryCountComplete(count)Fireswhenthequeryforthecountiscomplete. onQueryExtentComplete(extent,count)FireswhenqueryExtentmethodhascompleted. onQueryFeaturesComplete(featureSet)FireswhenqueryFeatures()iscomplete. onQueryIdsComplete(ids)FireswhenqueryIds()iscomplete. onQueryLimitExceeded()FiredwhenthefeaturelayercouldnotdrawallthefeaturesduetoamaxRecordCountlimitationonaqueryoperation. onQueryRelatedFeaturesComplete(relatedFeatures)FireswhenqueryRelatedFeatures()iscomplete. onRefreshIntervalChange()Thiseventisfiredwhenthelayer'srefreshIntervalismodified. onResume()Fireswhenalayerresumesdrawing. onScaleRangeChange()Fireswhenalayer'sminScaleand/ormaxScaleischanged. onScaleVisibilityChange()Fireswhenalayer'sscalevisibilitychanges. onSelectionClear()FiresafterclearSelectionhasbeencalled. onSelectionComplete(features,selectionMethod)FireswhenselectFeatures()hascompleted. onShowLabelsChange()Fireswhenthelabelsofthefeaturelayerhavechanged. onSuspend()Fireswhenalayersuspendsdrawing. onUpdate()Firesanytimealayerhasfinishedloadingorupdatingitself. onUpdateEnd(error,info)Firedwhenthelayerhasfinishedupdatingitscontent. onUpdateStart()Firedwhenthelayerbeginstoupdateitscontent. onVisibilityChange(visbility)Fireswhenthelayervisibilityhasbeenchanged,andreturnsthenewvisibility. ConstructorDetails newesri.layers.FeatureLayer(url,options?) CreatesanewinstanceofafeaturelayerobjectfromtheArcGISServerRESTresourceidentifiedbytheinputURL.Oncecreatedyoucanoptionallysetadefinitionexpressionortimedefinition.Parameters: url Required URLtotheArcGISServerRESTresourcethatrepresentsafeatureservice.Anexampleishttp://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0.FormoreinformationonconstructingaURL,seeTheServicesDirectoryandtheRESTAPI. options Optional Optionalparameters.Seeoptionslist. optionsproperties: allowUpdateWithoutMValues Optional Indicateswhetherattributefeaturescontainingm-valuescanbeedited.Defaultvalueisfalse. autoGeneralize Optional Enableordisabletheautogeneralizationoffeaturesfromanon-editablelayerinon-demandmode.Whentrue,thelayerusesthecurrentmapresolutionasthemaxAllowableOffsetforallqueriesissuedtotheserver.Thedefaultvalueistrue.Asofv2.7 className Optional Classattributetosetforthelayer'snode. definitionExpression Optional Whereclausetouseasdefinitionexpressionforlayer.Addedatv3.11 displayOnPan Optional Whentrue,graphicsaredisplayedduringpanning.Whenfalse,thegraphicsareturnedoffduringpanmovement.SettingtofalsemayimproveperformanceinInternetExplorer.Thedefaultistrue. editSummaryCallback Optional SetacallbackfunctionthatwillbeinvokedbyFeatureLayer.getEditSummary.Asofv2.8 featureReduction Optional Enablesfeaturereduction(forexampleclustering)onpointlayers.SeesetFeatureReduction()formoredetails.SeethefeatureReductionobjectspecificationtablebelowforoptionsthatmaybesetinthisobject. Supportforfeaturereductionislimitedtothefollowingscenarios: Pointdata(fromserviceorFeatureCollection). ThemapmusthaveaspatialreferenceofWebMercatororWGS84. Ifthelayercontainsmorethan50,000features,thenonlythefirst50,000willbeclustered. AFeatureLayercreatedfromaserviceURLmustpointtoaservicethatsupportspagination(ArcGISServerversion10.3.1orhigher). WheneditingisinitiatedwiththeEditorwidget,thenfeaturereductionisdisableduntiltheEditorwidgetisdestroyed. Featurereductionisdisabledwhenthelayerhasoneofthefollowingrenderers:HeatmapRenderer, BlendRenderer,TemporalRenderer,or ScaleDependentRenderer. gdbVersion Optional Specifythegeodatabaseversiontodisplay.(Asofv2.7).RequiresArcGISServerservice10.1orgreater id Optional UniqueIDtoassigntothelayer.Ifnotassigned,esri.MapcreatesauniqueID. infoTemplate Optional Thetemplatethatdefinesthecontenttodisplayinthemapinfowindowwhentheuserclicksonafeature.Ifnotspecified,theinfowindowwillnotbedisplayed. maxAllowableOffset Optional Themaximumallowableoffset,onlyapplicableforlayersthatarenoteditable. mode Optional Thequerymodeforthefeaturelayer.Eachmodedetermineswhenandhowmanyfeaturesaresenttotheclient.Thedefaultmodeistoqueryondemandastheextent,timeandlayerdefinitionchanges.Youcanspecifythefollowingvalues: FeatureLayer.MODE_SNAPSHOT:featuresarefetchedfromtheserverbasedonDefinitionExpressionandTimeDefinition.Ifthedefinitionchanges,thelayerupdatesitselfbyqueryingfeaturesbackfromtheserver.Oncethefeaturesarefetchedtotheclient,their"visibility"onthemapisbasedonthetimeandspatialextentsofthemap.Forexample,foratimeanimation,youcanrequestallfeaturesfromserver,thenadjusttimeextentonMaptoonlyshowasubset. FeatureLayer.MODE_ONDEMAND:featuresarefetchedfromtheserverasneeded. FeatureLayer.MODE_SELECTION:onlyselectedfeaturesareavailabeontheclient.Typicallyusedincombinationwithadynamicmapserviceshowingfeaturesthatcanbeselected. FeatureLayer.MODE_AUTO:featuresarefetchedwitheitheron-demandorsnapshotmodedependingonthecharacteristicsoftheservice.Onlyapplicabletohostedfeatureservices.Seetheconstantstablefordetails. ThedefaultvalueisMODE_ONDEMAND. Seetheconstantstableforadditionaldetailsoneachmode. opacity Optional Initialopacityortransparencyoflayer.Valuesrangefrom0.0to1.0,where0.0is100%transparentand1.0hasnotransparency.Thedefaultvalueis1.0.NotsupportedinInternetExplorer. orderByFields Optional Oneormorefieldsusedtoorderfeaturesby-forqueriesaswellasforrendering. SpecfiyASC(ascending)orDESC(descending)afterthefieldnametocontroltheorder.Example:["POPULATIONDESC"]. Whenvisualizingafeaturelayerusingarendererwithdata-basedsizing,thisoptionisusefultomakesuresmallerfeaturesaredrawnontopoflargeronesandnothiddenunderneath. Ifnotspecified,featurelayerwillchoosetheorderasfollows: Layerhasarendererwithdata-basedsizing:descendingorderofRenderer.sizeInfo.field. LayerhasaClassBreaksRendererwithbackgroundFillSymbol:descendingorderofRenderer.attributeField. LayerhasaClassBreaksRendererwhereeachbreakhasvaryingsymbolsizes:descendingorderofRenderer.attributeField. outFields Optional AnarrayofstringswhichcorrespondtofieldstoincludeintheFeatureLayer.Ifnotspecified,thefeaturelayerwillreturntheOBJECTIDfieldandifapplicablethestarttimefield,endtimefieldandtypeidfield.Youcanspecify["*"]tofetchthevaluesforallfieldsinthelayer,thisisusefulwheneditingfeatures. refreshInterval Optional Refreshintervalofthelayerinminutes.Non-zerovaluesetsupautomaticlayerrefreshatthespecifiedinterval. resourceInfo Optional Specifythemetadataofthelayer. showAttribution Optional Whentrue,thelayer'sattributionisdisplayedonthemap.Thedefaultvalueistrue.Addedatv3.1 require([ "esri/layers/FeatureLayer",... ],function(FeatureLayer,...){ varcensusBlock=newFeatureLayer(layerUrl,{ showAttribution:false }); ... }); showLabels Optional Indicateswhethertoshowlabelsonthelayer. IftheFeatureLayerhaslabelingdefinedonit,labelswillautomaticallydisplayiftheMap'sshowLabelsistrue. Ifyoudonotwishtohaveyourfeaturelayerlabel,youcanoverridethisbehaviorbysettingitsshowLabelspropertytofalse. Indicatewhethertodisplaylabels.Iftrue,anyFeatureLayeraddedtothemapwillautomaticallylabelbasedonlabelingInfo.Defaultisfalse.Addedatv3.11 NOTE:Inorderforthelabelstodisplay,allfieldsusedbythelabelingInfoshouldbesetinoutFields.Inaddition,onlysimplelabelingissupported,forexample{CITY_NAME}.Forexample,SQLkeywordssuchas"CONCAT"arenotsupported.ConsiderusingtheLabelLayerclasswhereyoucanspecifythetextExpressionifneedingmorefunctionality. varmap=newMap("map",{showLabels:true}); ... varfl1=newFeatureLayer(url,{showLabels:true,outFields:["*"]}); varfl2=newFeatureLayer(url2,{showLabels:false,outFields:["*"]}); map.addLayers([fls,fl2]); Addedatv3.11 source Optional Thedynamiclayerortablesource.Theurlshouldendwith/dynamicLayer. tileHeight Optional Specifythesizeofthevirtualtiles,usedinon-demandmode.Thevirtualtileschemeisusedinon-demandmodetomakeeffectiveuseofbrowsercaching.Thedefaultvalueis512.Thisoptionisonlyvalidinon-demandmodeandmustbeasquare.Forexample,specifyingavaluelike512x256isnotsupported. tileWidth Optional Specifythesizeofthevirtualtiles,usedinon-demandmode.Thevirtualtileschemeisusedinon-demandmodetomakeeffectiveuseofbrowsercaching.Thedefaultvalueis512.Thisoptionisonlyvalidinon-demandmodeandmustbeasquare.Forexample,specifyingavaluelike512x256isnotsupported. require([ "esri/layers/FeatureLayer",... ],function(FeatureLayer,...){ varfeatureLayer=newFeatureLayer("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Hydrography/Watershed173811/FeatureServer/1",{ mode:FeatureLayer.MODE_ONDEMAND, tileWidth:200, tileHeight:200 }); ... }); trackIdField Optional ThenameofthetrackIdField. require([ "esri/layers/FeatureLayer",... ],function(FeatureLayer,...){ varfeatureLayer=newFeatureLayer(featureLayerURL,{ mode:FeatureLayer.MODE_SELECTION, trackIdField:"Animal_1" }); ... }); useMapTime Optional Whentrue,thelayerwillupdateitscontentbasedonthemap'stimeextent.Thedefaultvaluesistrue. visible Optional Initialvisibilityofthelayer.Defaultistrue. webglEnabled Optional IndicatesifthelayerwillenableWebGLforrendering.Defaultvalueistrue. ObjectSpecifications: clusterRadius Optional Theradiusinpixelsofeachareainwhichmultiplepointswillbesummarizedandvisualizedasasinglecluster. infoTemplate Optional TheInfoTemplateusedtodisplaysummaryinformationaboutaggregategraphics. type Required Thereduction(oraggregation)methodforreducingthefeaturesdisplayedinthemap.Theonlyvalidvalueiscluster. Sample: varinfoTemplate=newesri.InfoTemplate("${FIELD_NAME}",content); varfeatureLayer=newesri.layers.FeatureLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Petroleum/KGS_OilGasFields_Kansas/MapServer/0",{ mode:esri.layers.FeatureLayer.MODE_ONDEMAND, infoTemplate:infoTemplate, outFields:["*"] }); newesri.layers.FeatureLayer(featureCollectionObject,options?) CreatesanewinstanceofafeaturelayerusingaFeatureCollectionobject.Thefeaturelayer,wheninitializedwithafeaturecollectionobjecthasthefollowingbehavior: Editsareappliedontheclientnotpostedtotheserver. Thefeaturelayergeneratesauniqueobjectidfornewfeatures. Doesnotsupportqueriesthatneedtobeperformedontheserver,forexamplequerieswithawhereclauseornon-extentbasedspatialqueries. ThefeaturelayertoJsonmethodreturnsanobjectwiththesamepropertiesasthefeaturecollection.Thereturnedobjectincludesallthefeaturesthatareinthelayerwhenthemethodiscalled.Thismethodcanbeusedtoaccessaserializablerepresentationofthefeaturesthatcanbesavedontheserver. Parameters: featureCollectionObject Required Afeaturecollectionobject.Seetheobjectspecificationstablesbelowfordetails. options Optional Optionalparameters.Seeoptionslist. ObjectSpecifications: featureSet Required Acollectionoffeatures. layerDefinition Required ThestructureisthesameastheinformationreturnedbyRESTforalayerinafeatureormapservice.Theminimumlayerdefinitionrequiredtocreateafeaturecollectionobjectdependsontherequiredfunctionality,i.e.time,renderingetc. Sample: varlayerDefinition={ "geometryType":"esriGeometryPolygon", "fields":[{ "name":"BUFF_DIST", "type":"esriFieldTypeInteger", "alias":"BufferDistance" }] } varfeatureCollection={ layerDefinition:layerDefinition, featureSet:null }; featureLayer=newesri.layers.FeatureLayer(featureCollection); PropertyDetails advancedQueryCapabilities Anobjectthatcontainsservicelevelmetadataaboutwhetherornotthelayersupportsqueriesusingstatistics,orderbyfields,DISTINCT,pagination,querywithdistance,andreturningquerieswithextents.ThisobjectcontainstheexistingpropertiessupportsStatisticsandsupportsAdvancedQuerieswhichisreturnedinthenewsupportsOrderByproperty.ForbackwardcompatibilitysupportsStatisticsandsupportsAdvancedQuerieswillremainpropertiesofFeatureLayer. "advancedQueryCapabilities":{ "supportsPagination":true, "supportsQueryWithDistance":true, "supportsReturningQueryExtent":true, "supportsStatistics":true, "supportsOrderBy":true, "supportsDistinct":true, "supportsQueryWithCacheHint":true } (Addedatv3.12)Seealso:supportsAdvancedQueries, supportsStatistics allowGeometryUpdates Returnstrueifthegeometryofthefeaturesinthelayercanbeedited,falseotherwise.InArcGISServerversion10.1,thisoptioncanbeconfiguredwhenpublishingtheservice.Forearlierversions,thisisalwaystrue.(Addedatv2.8)Knownvalues:true|false allowUpdateWithoutMValues Indicateswhetherattributefeaturescontainingm-valuescanbeedited.(Addedatv3.21)Defaultvalue:false attributionDataUrl TheURL,whenavailable,wherethelayer'sattributiondataisstored.(Addedatv3.1) capabilities Informationaboutthecapabilitiesenabledforthislayer. className classattributeofthelayer'snode.(Addedatv3.7) copyright Copyrightinformationforthelayer. credential Providescredentialinformationforthelayersuchasuseridandtokenifthelayerrepresentsaresourcethatissecuredwithtoken-basedauthentication.Thisvalueisavailableafterthelayerhasbeenloadedi.e.layer.loadedistrue.(Addedatv2.5) dataAttributes Listofattributefieldsaddedascustomdataattributestographicsnode.ApplicableonlywhenlayersurfaceTypeis"svg".(Addedatv3.7) defaultDefinitionExpression Metadatadescribingthedefaultdefinitionexpressionforthelayerasdefinedbytheservice.Thedefaultdefinitionexpressionlimitsthefeaturesavailablefordisplayandquery.YoucannotoverridethisvaluebutyoudefineadditionalfiltersonthedefaultexpressionusingthesetDefinitionExpressionmethod.Forexample,ifthedefaultdefinitionexpressionissettodisplaydatawhere"STATE_NAME='California'"youcouldusesetDefinitionExpressiontoonlydisplayasubsetofthefeaturesinCalifornia,forexampleusing"COUNTY='SanDiego'".Seealso:setDefinitionExpression() defaultVisibility Indicatesthedefaultvisibilityforthelayer.(Addedatv3.0)Knownvalues:true|falseSample: varisVisible=layer.defaultVisibility; description Thedescriptionofthelayerasdefinedinthemapservice. displayField Thenameofthelayer'sprimarydisplayfield.Thevalueofthispropertymatchesthenameofoneofthefieldsofthelayer. editFieldsInfo Indicatesthefieldnamesfortheeditorfields.Ifownershipbasedaccesscontrolisnotenabledforthefeatureservicethevaluewillbenull.Theobjecthasthefollowingproperties: { creatorField, creationDateField, editorField, editDateField } RequiresArcGISServerfeatureserviceversion10.1orgreater.(Addedatv2.6) editingInfo ApplicabletoArcGISOnlinehostedfeatureservices.Ifpresent,thisobjectspecifiesinformationaboutediting.SeetheobjectspecificationstablebelowforthestructureoftheeditingInfoobject.(Addedatv3.28)ObjectSpecifications: lastEditDate Required Aread-onlyvaluethatindicatesthelasttimealayerwasedited.Thisvaluegetsupdatedeverytimethelayerdataiseditedorwhenanyofthelayerpropertieschange.ThevalueisdepictedasaUnixtimestamp,e.g. "editingInfo":{ "lastEditDate":1536363634886 } fields Thearrayoffieldsinthelayer. fullExtent Thefullextentofthelayer. gdbVersion Thegeodatabaseversion.Onlyapplicableifthelayer'sdatasourceisregisteredasversionedinSDE.OnlyvalidwithArcGISServerservicesversion10.1orgreater.(Addedatv2.7) geometryType Geometrytypeofthefeaturesinthelayer.Canbeoneofthefollowing:"esriGeometryPoint","esriGeometryPolygon"or"esriGeometryPolyline". globalIdField TheglobalIdFieldforthelayer. graphics Arrayoffeaturesinthelayer. hasAllFeatures Indicateswhetherthelayerdisplaysallfeaturesintersectingthecurrentview.Typically,thismethodshouldbecalledafterthelayeremitstheupdate-endevent.(Addedatv3.28)Defaultvalue:trueSeealso:on("update-end") hasAttachments Trueifattachmentsareenabledonthefeaturelayer.UsethequeryAttachmentInfosmethodtodetermineifthefeaturehasattachments.Ifthelayeriseditable(isEditable)andsupportsattachmentsthefollowingoperationscanbeperformed. Addattachmentstofeatures. Deleteexistingattachments. Knownvalues:true|falseSeealso:queryAttachmentInfos() hasAttributionData Whentrue,thelayerhasattributiondata.Thedefaultvalueisfalse.UsethegetAttributionDatamethodtoretrievethisdataasJSON.(Addedatv3.1)Knownvalues:true|falseDefaultvalue:false htmlPopupType Thehtmlpopuptypedefinedforthelayer.Viewtheconstantstableforalistofvalidvalues. id IDassignedtothelayer.Ifnotassigned,esri.Mapassignsvalue.Bydefault,theIDofthelayeris"layer"followedbyanumber.TheIDcanbeuserdefinedonlyinthelayerconstructor.Sample: SettingthelayerIDinthelayerconstructor. population=newesri.layers.ArcGISDynamicMapServiceLayer("http://myserver/arcgis/rest/population/MapServer/Layers",{id:"population"}); SettingthelayerIDafteralayerisinitialized. population.id="population"; RetrievingthelayerID. functiongetMapLayers(){ for(varj=0,jl=myMap.layerIds.length;jinfoTemplate Theinfotemplateforthelayer.(Addedatv3.9) labelingInfo Labeldefinitionforthislayer,specifiedasanarrayoflabelclasses.Usethispropertytospecifyanychangestothestructureofthelabel.Forexample,labelexpression,placement,andsizecanbemodifiedandpassedtothisproperty.(Addedatv3.10) layerId UniqueIDofthelayerthattheFeatureLayerwasconstructedagainst. loadError Setifthelayerfailedtoload.(Addedatv3.9) loaded Whenthelayerisloaded,thevaluebecomes"true",andlayerpropertiescanbeaccessed.TheonLoadeventisalsofired.Knownvalues:true|false maxAllowableOffset Themaximumallowableoffset,onlyapplicableforlayersthatarenoteditable.(Addedatv2.7) maxRecordCount Themaximumnumberofresultsthatwillbereturnedfromaquery.RequiresArcGISServerversion10.1orgreater.(Addedatv2.6) maxScale Maximumvisiblescaleforthelayer.Ifthemapiszoomedinbeyondthisscale,thelayerwillnotbevisible.Avalueof0meansthelayerdoesnothaveamaximumscale.(Addedatv3.1)Defaultvalue:0 minScale Minimumvisiblescaleforthelayer.Ifthemapiszoomedoutbeyondthisscale,thelayerwillnotbevisible.Avalueof0meansthelayerdoesnothaveavisiblescale.(Addedatv3.1)Defaultvalue:0 multipatchOption Supportsfeatureserviceswhosedatasourceisamultipatchfeatureclass. DefaultisxyFootprintifgeometryTypeisesriGeometryMultiPatch.Otherwise,undefined. UsercanoverridethispropertywithadifferentchoiceinthefuturewhenFSsupportsit. QueriesmadethroughtheFeatureLayerwillincludemultipatchOptionparameterifreturnGeometryistrue. Appliestosnapshot,ondemand,selectFeatures,andqueryFeatures Note:RequiresArcGIS10.3andabove.(Addedatv3.12)Defaultvalue:xyFootprintSeealso:Query.multipatchOption name Thenameofthelayerasdefinedinthemapservice. objectIdField ThenameofthefieldthatcontainstheObjectIDfieldforthelayer. opacity Opacityortransparencyoflayer.Valuesrangefrom0.0to1.0,where0.0is100%transparentand1.0hasnotransparency.Knownvalues:0.0-1.0Defaultvalue:1.0 ownershipBasedAccessControlForFeatures Indicatestheownershipaccesscontrolconfiguration.Ifownershipbasedaccesscontrolisnotenabledforthefeatureservicethevaluewillbenull.Ifownershipbasedaccesscontrolisnotenabledforthefeatureservicethevaluewillbenull.ThisobjecthastwopropertiesallowDeleteToOthersandallowUpdateToOthers.Whentruefeaturescanbedeletedorupdatedbyusersotherthanthecreator. { allowUpdateToOthers, allowDeleteToOthers } (Addedatv2.6) refreshInterval Refreshintervalofthelayerinminutes.Non-zerovalueindicatesautomaticlayerrefreshatthespecifiedinterval.Valueof0indicatesautorefreshisnotenabled.(Addedatv3.7) relationships Eachelementinthearrayisanobjectthatdescribesthelayer'srelationshipwithanotherlayerortable.UsethequeryRelatedFeaturesmethodtoretrievefeaturesorrecordsrelatedtoafeatureinthislayer.Theobjecthasthefollowingproperties: id UniqueIDfortherelationship name Nameoftherelationship. relatedTableId UniqueIDoftherelatedtableorlayer Sample: varrelationships=wellFeatureLayer.relationships; dojo.forEach(relationships,function(relationship){ console.log("name:"+relationship.name); console.log("id:"+relationship.id); console.log("relationshipid:"+relationship.relatedTableId); }); Seealso:queryRelatedFeatures() renderer Therendererforthelayer. showAttribution Whentrue,thelayer'sattributionisdisplayedonthemap.(Addedatv3.1)Knownvalues:true|falseDefaultvalue:true showLabels Determinesiflabelsaredisplayed.Whenfalse,labelsforthelayerarenotdisplayed. IftheFeatureLayerhaslabelingdefinedonit,labelswillautomaticallydisplayiftheMap'sshowLabelsistrue. Ifyoudonotwishtohaveyourfeaturelayerlabel,youcanoverridethisbehaviorbysettingitsshowLabelspropertytofalse. NOTE:Inorderforthelabelstodisplay,allfieldsusedbythelabelingInfoshouldbesetinoutFields.Inaddition,onlysimplelabelingissupported,forexample{CITY_NAME}.Forexample,SQLkeywordssuchas"CONCAT"arenotsupported.ConsiderusingtheLabelLayerclasswhereyoucanspecifythetextExpressionifneedingmorefunctionality. Addedatv3.11Knownvalues:true|falseDefaultvalue:true source Thedynamiclayerortablesource.(Addedatv2.7) styling Indicateswhetherthelayerisresponsibleforstylinggraphics.Whentrue,stylingisbasedongraphicssymbolorthelayer'srenderer.Whenfalse,graphicsstylingisdisabled.ApplicableonlywhenlayersurfaceTypeis"svg".(Addedatv3.7)Knownvalues:true|false supportsAdvancedQueries Whentrue,thelayersupportsorderByFieldsinaqueryoperation.RequiresArcGISServerserviceversion10.1orgreater(Addedatv2.6)Knownvalues:true|falseSeealso:advancedQueryCapabilities supportsAttachmentsByUploadId Whentrue,thelayersupportsuploadingattachmentswithUploadsRESToperation,whichthencanbeusedintheAddAttachmentorUpdateAttachmentRESToperations.RequiresArcGISOnlinehostedfeatureservice.(Addedatv3.11)Knownvalues:true|false supportsCalculate Whentrue,thelayersupportstheCalculateRESToperationwhenupdatingfeatures.RequiresArcGISOnlinehostedfeatureservice.(Addedatv3.11)Knownvalues:true|false supportsFieldDescription Iftrue,thelayersupportsauser-definedfielddescription.PleaseseetheArcGISOnlinehelptopic,Describeattributefieldsforadditionalinformation.(Addedatv3.28) supportsStatistics Whentrue,thelayersupportsstatisticalfunctionsinqueryoperations.RequiresArcGISServerserviceversion10.1orgreater(Addedatv2.6)Knownvalues:true|falseSeealso:advancedQueryCapabilities surfaceType Typeofvectorgraphicssurfaceusedtodrawgraphics.(Addedatv3.7)Knownvalues:"svg"|"canvas-2d"|"vml"Defaultvalue:"svg"onallbrowsers-exceptIE8orearlierwhere"vml"isusedtodrawgraphics. suspended Whentrue,thelayerissuspended.Alayerisconsideredtobesuspendedwhenoneofthefollowingistrue: Thelayerishidden. Thelayerisnotvisibleatthecurrentmapscale. ThelayerisexplicitlysuspendedbycallingtheLayer.suspendmethod. (Addedatv3.1)Knownvalues:true|false templates AnarrayoffeaturetemplatesdefinedintheFeatureServicelayer.OnlyapplicableforArcGISServerFeatureServicelayers.Sample: vartemplates=layer.templates; dojo.forEach(templates,function(template){ console.log(template.description); console.log(template.name); }); timeInfo Timeinformationforthelayer,suchasstarttimefield,endtimefield,trackidfield,layerstimeextentandthedrawtimeinterval.Onlyapplicableifthelayeristimeaware. type Specifiesthetypeoflayer.Canbe"FeatureLayer"or"Table". typeIdField ThefieldthatrepresentstheTypeIDfield.OnlyapplicableforArcGISServerFeatureServicelayers. types AnarrayofsubtypesdefinedintheFeatureServicelayer.OnlyapplicableforArcGISServerFeatureServicelayers. url URLtotheArcGISServerRESTresourcethatrepresentsamapservice.ToobtaintheURL,useServicesDirectory.AnexampleURLfortheStreetMapserviceonArcGISOnlineis:https://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer.(Addedatv1.2) version TheversionofArcGISServerwherethelayerispublished.Examplesare9.3,9.31,10.(Addedatv2.1) visible Visibilityofthelayer.Knownvalues:true|falseDefaultvalue:true visibleAtMapScale Whentrue,thelayerisvisibleatthecurrentmapscale.(Addedatv3.1)Knownvalues:true|false webglEnabled IndicatesifWebGLisenabledonthelayer.Notethatthisdoesn'tindicatethatWebGLisactuallybeingusedintherendering.UsehasWebGLSurface()tocheckifthelayerisdrawnwithWebGL.(Addedatv3.24)Defaultvalue:true MethodDetails addAttachment(objectId,formNode,callback?,errback?) AddanattachmenttothefeaturespecifiedbytheObjectId.OnlyapplicableifisEditableandhasAttachmentsaretrue.Returntype:DeferredParameters: objectId Required TheObjectIdofthefeaturetowhichtheattachmentisadded. formNode Required HTMLformthatcontainsafileuploadfieldpointingtothefiletobeaddedasanattachment.IfyouareusingHTMLthenyourformshouldfollowthisbasicpattern: IfyouwishtocreatetheformdatainJavaScript,thenyoucancreateaformusingthefollowingpattern: varformData=newFormData(); formData.append("attachment",file); callback Optional Thefunctiontocallwhenthemethodhascompleted.TheargumentsinthefunctionarethesameastheaddAttachmentCompleteevent. errback Optional Anerrorobjectisreturnedifanerroroccursduringtaskexecution. Seealso:on("add-attachment-complete") applyEdits(adds?,updates?,deletes?,callback?,errback?) Applyeditstothefeaturelayer.ApplicableforlayerscreatedfromaFeatureServiceoraFeatureCollection.NOTE:Datefieldvaluesarealwaysrepresentedasnumericvalues.Thismeansthatwhenupdatingexistingfeatures,datefieldsmusthavenumericvaluesandnotdateobjects.Returntype:DeferredParameters: adds Optional Arrayoffeaturestoaddtothelayer.NewfeaturesaretypicallycreatedusingtheDrawtoolbar. updates Optional Arrayoffeatureswhosegeometryand/orattributeshavechanged.FeaturesmusthaveavalidOBJECTID.ThegeometryoffeaturesistypicallymodifiedusingtheEdittoolbar.AttributesaremodifiedusingtheAttributeInspector. deletes Optional Arrayoffeaturestodelete.MusthavevalidObjectId callback Optional Thisfunctionwillbecalledwhentheoperationiscomplete.TheargumentspassedtothisfunctionarethesameastheonEditsCompleteevent. errback Optional Anerrorobjectisreturnedifanerroroccurs. Sample: vartargetGraphic=firePerimeterFL.getSelectedFeatures()[0].setGeometry(reshapedGeometry); firePerimeterFL.applyEdits(null,[targetGraphic],null); Seealso:on("edits-complete") attr(name,value) Addsanewattributeorchangesthevalueofanexistingattributeonthelayer'snode.Removestheattributeifthevalueisnullorundefined.(Addedatv3.7)Returntype:LayerParameters: name Required Thenameoftheattribute. value Required Thevalueoftheattribute.Setthisvalueasnulltoremovetheattribute. clearSelection() Clearsthecurrentselection.Returntype:FeatureLayerSeealso:on("selection-clear") deleteAttachments(objectId,attachmentIds,callback?,errback?) DeleteoneormoreattachmentsforthefeaturespecifiedbytheinputObjectId.OnlyapplicableifisEditableandhasAttachmentsaretrue.Returntype:DeferredParameters: objectId Required TheObjectIdofthefeaturefromwhichtheattachmentisremoved. attachmentIds Required Thearrayofattachmentidstodelete. callback Optional Thefunctiontocallwhenthemethodhascompleted. errback Optional Anerrorobjectisreturnedifanerroroccurs. Seealso:on("delete-attachments-complete") disableFeatureReduction() Disablesfeaturereduction(forexampleclustering)onthelayer.Thisisusefulforcertainworkflows,suchasediting,wherefeaturereductioncanhinderthedesireduserexperience.Onlyapplicabletopointlayers.(Addedatv3.22) disableMouseEvents() Disablesallmouseeventsonthegraphicslayer. enableFeatureReduction() Enablesfeaturereduction(forexampleclustering)onthelayerusingtheoptionssetinsetFeatureReduction().Onlyapplicabletopointlayers.(Addedatv3.22) enableMouseEvents() Enablesallmouseeventsonthegraphicslayer. getAggregateGraphics() Returnsgraphicsrepresentingtheaggregationofseveralpointfeaturesclusteredtogether.Onlyapplicablewhenfeaturereductionisenabled.(Addedatv3.22)Returntype:Graphic[] getAttributionData() Asynchrouslyreturnscustomdataforthelayerwhenavailable.(Addedatv3.1)Returntype:Deferred getDefinitionExpression() Returnsthecurrentdefinitionexpression.Returntype:String getDomain(fieldName,options?) ReturnstheDomainassociatedwiththegivenfieldname.ThisbeingeitheraCodedValueDomainorRangeDomain.(Addedatv3.12)Returntype:DomainParameters: fieldName Required Nameoftheattributefield. options Optional Pleaseseetheoptionsobjectspecificationtablebelow. ObjectSpecifications: feature Required ThefeatureinwhichtheDomainisretrieved.NOTE:Ifthelayerhassub-types,thedomainwillbecalculatedbasedonthefeaturetypeanddomaindefinedforthattype. getEditCapabilities(options?) Returnsanobjectthatdescribestheeditcapabilitiesofthelayer.Thereturnedobjecthasthefollowingproperties: canCreate Whentrue,newfeaturescanbecreated. canUpdate Whentrue,existingfeaturescanbeupdated. canDelete Whentrue,featurescanbedeleted. (Addedatv2.6)Returntype:ObjectParameters: options Optional Ifthelayersupportsownershipbasedaccesscontrol,usetheoptionstodetermineifthespecifiedusercaneditfeatures.OwnershipbasedaccesscontrolrequiresArcGISServerservicesversion10.1orgreater.Seetheobjectspecificationstablebelowforthestructureoftheoptionsobject. ObjectSpecifications: feature Required Checktoseeifthespecifiedfeaturecanbeeditedbythespecifieduser. feature Required Checktoseeifthespecifiedfeaturecanbeeditedbythespecifieduser. userId Required Thenameofthecurrentlyloggedinuser.IftheapplicationusestheIdentityManagertheIdentityManagersuppliesthelayerwiththeuserIdsothisparameterisnotrequired. userId Required Thenameofthecurrentlyloggedinuser.IftheapplicationusestheIdentityManagertheIdentityManagersuppliesthelayerwiththeuserIdsothisparameterisnotrequired. Sample: varcapabilities=featureLayer.getEditCapabilities(); if(capabilities.canUpdate){ console.log("Thislayercanbeupdated"); } getEditInfo(feature,options?) Returnsanobjectdescribingthemostrecenteditoperationperformedonthegivenfeature,ifavailable.(Addedatv2.8)Returntype:ObjectParameters: feature Required Thefeaturetogettheeditinfofor. options Optional Seetheobjectspecificationstablebelowforthestructureoftheoptionsobject. ObjectSpecifications: action Required Bydefault,themethodreturnsasummaryofthemostrecenteditperformedonthefeature.Usethisoptiontooverridethisbehavior.'creation'indicatescreationsummaryisdesired.'edit'indicateseditsummaryisdesired. Sample: { "action":"creation",//or"edit" "userId":"Mike", "minutes":15, "hours":5, "weekDay":"Tuesday", "formattedDate":"1/1/2012", "formattedTime":"9:30AM", "displayPattern":"Minutes",//or"Seconds","Minute","Hour","Hours","WeekDay","Full" "timeValue":1330167842310 } getEditSummary(feature,options?) Returnsalocalizedsummaryofthelasteditoperationperformedonthegivenfeature,ifavailable.Forexample: EditedbyBjornsecondsago EditedbyBjornaminuteago EditedbyBjorn15minutesago EditedbyBjornanhourago EditedbyBjorn5hoursago EditedbyBjornonTuesdayat1:30PM EditedbyBjornon4/27/2014at11:30AM Theword"Edited"willbereplacedby"Created"iftheauthorhasdisablededitorFieldattributebutenabledcreatorFieldattribute.Theusercomponentanddate-timecomponentmayormaynotbeavailabledependingonyourlayer'sedittrackingsettings(seeeditFieldsInfopropertyofthislayerformoreinformation). Anemptystringwillbereturnedif: thelayerisnotinitializedor ifthelayer'sedittrackingsettingshavebeenturnedoffor ifthefeaturedoesnothaveedittrackingfieldsinitsattributes.(Addedatv2.8)Returntype:StringParameters: feature Required Thefeaturetogettheeditsummaryfor. options Optional Seetheobjectspecificationstablebelowforthestructureoftheoptionsobject. ObjectSpecifications: action Required Bydefault,themethodreturnsasummaryofthemostrecenteditperformedonthefeature.Usethisoptiontooverridethisbehavior.'creation'indicatescreationsummaryisdesired.'edit'indicateseditsummaryisdesired. callback Required Ifyouwanttocustomizeoroverridecertaincomponentsofthesummary,provideacallbackfunctionusingthisoption.Forexample: featureLayer.getEditSummary(feature,{ callback:function(feature,info){ if(info&&info.userId){ info.userId=""+info.userId+""; } returninfo; } }); getFeatureReduction() Returnstheoptionsusedtoreducethenumberoffeaturesvisualizedbythelayer(forexampleclustering).Thisisonlyapplicabletopointlayers.SeesetFeatureReduction()formoredetails.(Addedatv3.22)Returntype:Object getField(fieldName) ReturnstheFieldgiventhespecifiedfieldname.(Addedatv3.12)Returntype:FieldParameters: fieldName Required Nameoftheattributefield. getMap() Returnsreferencetothemapcontrolthelayerisaddedto.Returnsnullorundefinedifitisnotaddedtoamap.(Addedatv3.7)Returntype:Map getMaxAllowableOffset() ReturnsthecurrentvalueofthemaxAllowableOffsetusedbythelayer.Fornon-editablelayersinon-demandmodeifautoGeneralizeisenabledthemaxAllowableOffsetissettothecurrentmapresolution.(Addedatv2.7)Returntype:NumberSample: varcurrentOffset=featureLayer.getMaxAllowableOffset(); getNode() Returnsthelayer'sDOMnode.(Addedatv3.7)Returntype:HTMLElement getOrderByFields() Returnsthelistoffieldsusedtoorderfeaturesby.Forqueriesaswellasrendering.(Addedatv3.8)Returntype:String[] getSelectedFeatures() Getsthecurrentlyselectedfeatures.Returntype:Graphic[] getSelectionSymbol() Getsthecurrentselectionsymbol.Returntype:Symbol getSingleGraphics() Returnsgraphicsfromthelayerthatarenotrepresentedbyaggregategraphicswhenfeaturereduction(suchasclustering)isenabled.(Addedatv3.22)Returntype:Graphic[] getTimeDefinition() Getthecurrenttimedefinitionappliedtothefeaturelayer.Returntype:TimeExtentSample: timeSlider.createTimeStopsByTimeInterval(featureLayer.getTimeDefinition(), 1,esri.layers.TimeInfo.UNIT_HOURS); getType(feature) ReturnsaFeatureTypedescribingthefeature'stype. NOTE:ThisisapplicableifthelayercontainingthefeaturehasaTypeIdField.(Addedatv3.12)Returntype:FeatureTypeParameters: feature Required Afeaturefromthislayer. hasUpdateError() Indicateswhetheranerroristhrownafterthelayerupdates.(Addedatv3.24) hasWebGLSurface() IndicatesifthelayerisrenderedinWebGL.(Addedatv3.24)Returntype:Boolean hasXYFootprint() ReturnstrueifgeometryTypeisesriGeometryMultipatchandmultipatchOptionisxyFootprint.Whentrue,theFeatureLayerwillbehaveasifitwereapolygon. Autogeneralizationwillbeenabledbydefault. Automodewilltreatthelayerlikeapolygonlayer. (Addedatv3.12)Returntype:Boolean hide() Setsthevisibilityofthelayerto"false".Thelayerisnotremoved,butitishiddenfromview. isEditable() ReturnstrueiftheFeatureLayeriseditable.Ifthelayeriseditable,oneormoreofthefollowingoperationscanbeperformeddependingonthepermissionssetontheservice. Addnewfeatures. Modifythegeometryandattributesofexistingfeatures. Deletefeatures. Toseewhichoftheaboveeditingactionsmaybeperformedonthelayer,executegetEditCapabilities()onthelayerafterverifyingthatisEditable()returnstrue.Returntype:BooleanSeealso:setEditable() isFeatureReductionActive() Indicatesiffeaturereduction(forexampleclustering)isactiveintheview.Featurereductionisactiveatallscales.Atanygivenscale,iftherearefeaturesthatdonotfallwithinacluster,theyaredisplayedasindividualfeatures.Thismethodisonlyapplicabletopointlayerswhenfeaturereductionisenabled.(Addedatv3.22)Returntype:Boolean isFeatureReductionEnabled() Indicatesiffeaturereduction(forexampleclustering)isenabled.Onlyapplicabletopointlayers.SeealsosetFeatureReduction().(Addedatv3.22)Returntype:Boolean isVisibleAtScale(scale) Returnstrueifthelayerisvisibleatthegivenscale.(Addedatv3.1)Returntype:BooleanParameters: scale Required Thescaleatwhichtocheckifthelayerisvisible. queryAttachmentInfos(objectId,callback?,errback?) QueryforinformationaboutattachmentsassociatedwiththespecifiedObjectIds.Returntype:DeferredParameters: objectId Required TheObjectIdforthefeaturetoqueryforattachmentinformation. callback Optional Thefunctiontocallwhenthemethodhascompleted. errback Optional Anerrorobjectisreturnedifanerroroccurs. Seealso:on("query-attachment-infos-complete"), hasAttachments queryCount(query,callback?,errback?) Getacountofthenumberoffeaturesthatsatisfytheinputquery.ValidonlyforlayerspublishedusingArcGISServer10SP1orgreater.LayerspublishedwithearlierversionsofArcGISServerreturnanerrortotheerrorcallback.(Addedatv2.1)Returntype:DeferredParameters: query Required Theinputquery.Thequeryobjecthasthefollowingrestrictionstoavoidconflictsbetweenlayerandmapproperties. outFieldsspecifiedbythequeryobjectareoverriddenbytheoutFieldsspecifiedintheFeatureLayerconstructor. ThereturnGeometryvaluespecifiedbythequeryobjectisignoredandtrueisused. TheoutSpatialReferencesetbythequeryobjectisignoredandthemap'sspatialreferenceisused. callback Optional Thefunctiontocallwhenthemethodhascompleted. errback Optional Anerrorobjectisreturnedifanerroroccurs. Sample: varquery=newesri.tasks.Query(); query.where="POP90_SQMI<100"; featureLayer.queryCount(query,function(count){ console.log(count+"featuressatisfiedtheinputquery"); },function(error){ console.log(error); }); queryExtent(query,callback?,errback?) Gettheextentoffeaturesthatsatisfytheinputquery.Thecountoffeaturesthatsatisfytheinputqueryisreturnedaswell.Thisisvalidonlyforhostedfeatureservicesonarcgis.comandforArcGISServer10.3.1andlater.(Addedatv3.9)Returntype:DeferredParameters: query Required Thequerydefinition. callback Optional Thefunctioncalledwhenthemethodhascompleted. errback Optional Thefunctioncalledwhenerroroccurred. queryFeatures(query,callback?,errback?) Queryfeaturesfromthefeaturelayer.Layerdefinitionandtimedefinitionarehonored.Wheneverpossiblethefeaturelayerwillperformthequeryontheclient.Returntype:DeferredParameters: query Required Theinputquery.Thequeryobjecthasthefollowingrestrictionstoavoidconflictsbetweenlayerandmapproperties. outFieldsspecifiedbythequeryobjectareoverriddenbytheoutFieldsspecifiedintheFeatureLayerconstructor. ThereturnGeometryvaluespecifiedbythequeryobjectisignoredandtrueisused.Asofversion3.5thereturnGeometryvalueishonored. TheoutSpatialReferencesetbythequeryobjectisignoredandthemap'sspatialreferenceisused. callback Optional Thefunctiontocallwhenthemethodhascompleted. errback Optional Anerrorobjectisreturnedifanerroroccurs. Sample: varquery=newesri.tasks.Query(); query.objectIds=[features[0].attributes.OBJECTID]; query.outFields=["*"]; //QueryforthefeatureswiththegivenobjectID featureLayer.queryFeatures(query,function(featureSet){ }); Seealso:on("query-features-complete") queryIds(query,callback?,errback?) QueryforObjectIds.ThereisnolimitonthenumberofObjectIdsthatarereturnedfromtheserver.LikequeryFeaturesthisoperationwillperformqueriesontheclient(browser)wheneverpossible.ValidonlyforlayerspublishedusingArcGISServer10SP1orgreater.Returntype:DeferredParameters: query Required Theinputquery.Thequeryobjecthasthefollowingrestrictionstoavoidconflictsbetweenlayerandmapproperties. outFieldsspecifiedbythequeryobjectareoverriddenbytheoutFieldsspecifiedintheFeatureLayerconstructor. ThereturnGeometryvaluespecifiedbythequeryobjectisignoredandtrueisused. TheoutSpatialReferencesetbythequeryobjectisignoredandthemap'sspatialreferenceisused. callback Optional Thefunctiontocallwhenthemethodhascompleted. errback Optional Anerrorobjectisreturnedifanerroroccurs. Sample: //createaquerytofetchobjectIDsforallrecords varquery=newesri.tasks.Query(); query.where="1=1"; featureLayer.queryIds(query,function(objectIds){ //dosomethingwiththeobjectIdshere }); Seealso:on("query-ids-complete") queryRelatedFeatures(relQuery,callback?,errback?) Queryfeaturesorrecords,fromanotherlayerortable,relatedtofeaturesinthislayer.Returntype:DeferredParameters: relQuery Required Theinputquery. callback Optional Thefunctiontocallwhenthemethodhascompleted. errback Optional Anerrorobjectisreturnedifanerroroccurs. Sample: varrelatedQuery=newesri.tasks.RelationshipQuery(); relatedQuery.outFields=["AGREE_WITH_INCIDENT"]; relatedQuery.relationshipId=1; //queryforthefeaturesrelatedtothe"clicked"feature dojo.connect(featureLayer,"onClick",function(evt){ graphicAttributes=evt.graphic.attributes; relatedQuery.objectIds=[graphicAttributes.OBJECTID]; featureLayer.queryRelatedFeatures(relatedQuery,relatedRecords); }); Seealso:on("query-related-features-complete"), relationships redraw() Redrawsallthegraphicsinthegraphicslayer.Unlikerefresh(),redrawdoesnotre-queryfeaturesfromtheserver.(Addedatv3.3) refresh() Refreshesthefeaturesinthefeaturelayer.Thefeaturelayerrequeriesallthefeaturesintheservice,excepttheselectedfeatures,andupdatesitself. resume() Resumeslayerdrawing.(Addedatv3.1) selectFeatures(query,selectionMethod?,callback?,errback?) SelectsfeaturesfromtheFeatureLayer.Layerpropertieslikelayerdefinitionandtimedefinitionarehonored.Theselectionmethoddefineshowqueryresultsarepassedtotheselection.Thefeaturelayerwillhighlightthecurrentselectionifaselectionsymbolhasbeendefined.Wheneverpossible,thefeaturelayerwillperformthequeryoperationontheclient(browser).Returntype:DeferredParameters: query Required Theinputquery.Thequeryobjecthasthefollowingrestrictionstoavoidconflictsbetweenlayerandmapproperties. outFieldsspecifiedbythequeryobjectareoverriddenbytheoutFieldsspecifiedintheFeatureLayerconstructor. ThereturnGeometryvaluespecifiedbythequeryobjectisignoredandtrueisused. TheoutSpatialReferencesetbythequeryobjectisignoredandthemap'sspatialreferenceisused. selectionMethod Optional Theselectionmethoddefineshowtherestoftheselectioniscombinedwiththeexistingselection.SeeConstantstableforvalidvalues.Thedefaultoptionistocreateanewselection. callback Optional Thefunctiontocallwhenthemethodhascompleted.TheargumentsinthefunctionarethesameastheonSelectionCompleteevent. errback Optional Anerrorobjectisreturnedifanerroroccurs. Sample: varquery=newesri.tasks.Query(); query.geometry=feature.geometry; featureLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW); Seealso:on("selection-complete") setAutoGeneralize(enable) Enableordisableautogeneralizationforthelayer.Notethatautogeneralizationisonlyapplicabletonon-editablefeaturelayersinon-demandmode.(Addedatv2.7)Returntype:FeatureLayerParameters: enable Required Whentrue,autogeneralizeisenabled.Defaultvaluefornon-editableon-demandfeaturelayersistrue. Sample: featureLayer.setAutoGeneralize(false); setDefinitionExpression(expression) SetsthedefinitionexpressionfortheFeatureLayer.Onlythefeaturesthatmatchthedefinitionexpressionaredisplayed.Adefinitionexpressionlimitsthefeaturesavailablefordisplayandqueriesbyapplyingconstraintstothelayer'sattributefields.Settingadefinitionexpressionisusefulwhenthedatasetislargeandyoudon'twanttobringeverythingtotheclientforanalysis.Thismethodistypicallycalledbeforeaddingthelayertothemap.Ifthemethodiscalledafterthelayerisaddedtothemapthelayerwillrefreshitselftoreflectthenewdefinitionexpression. Thisdefinitionexpressioniscombinedwiththelayer'sdefaultdefinitionexpressionwhichresultsinafurtherrestrictionofthelayer.Returntype:FeatureLayerParameters: expression Required Thedefinitionexpressiontoapply.Forexample,"TYPE='Park'" Sample: featureLayer.setDefinitionExpression("STATE_NAME='SouthCarolina'"); Seealso:defaultDefinitionExpression setEditable(editable) Settheeditabilityoffeaturelayerscreatedfromafeaturecollection.Thismethodisonlyvalidforfeaturelayerscreatedfromfeaturecollections. Whenthefeaturelayer'seditabilityisupdatedtheonCapabilitiesChangeeventisfired.UsetheisEditablemethodtodetermineifthelayeriseditable. (Addedatv2.6)Returntype:FeatureLayerParameters: editable Required Whentrue,thelayerwillbesetaseditable. Sample: featureLayer.setEditable(true); Seealso:on("capabilities-change"), isEditable() setFeatureReduction(options) Setsfeaturereductionoptionsonthelayer(forexampleclusteringoptions).Whenset,featuresinthelayerwillaggregate,thuschangingthevisualization.Thiswillnotchangetherendererofthelayer.Seethevalidparametersinthetablebelow. Supportforfeaturereductionislimitedtothefollowingscenarios: PointdatainFeatureLayer(fromserviceorFeatureCollection)andCSVLayer. ThemapmusthaveaspatialreferenceofWebMercatororWGS84. Ifthelayercontainsmorethan50,000features,thenonlythefirst50,000willbeclustered. AFeatureLayercreatedfromaserviceURLmustpointtoaservicethatsupportspagination(ArcGISServerversion10.3.1orhigher). WheneditingisinitiatedwiththeEditorwidget,thenfeaturereductionisdisableduntiltheEditorwidgetisdestroyed. Featurereductionisdisabledwhenthelayerhasoneofthefollowingrenderers:HeatmapRenderer, BlendRenderer,TemporalRenderer,or ScaleDependentRenderer. (Addedatv3.22)Parameters: options Required Optionsforreducing(oraggregating)thefeaturesinthemap.Seethetablebelowformoredetails. ObjectSpecifications: clusterRadius Optional Theradiusinpixelsofeachareainwhichmultiplepointswillbesummarizedandvisualizedasasinglecluster.Thedefaultvalueis80. infoTemplate Optional TheInfoTemplateusedtodisplaysummaryinformationaboutaggregategraphics. type Required Thereduction(oraggregation)methodforreducingthefeaturesdisplayedinthemap.Theonlyvalidtypeiscluster. setGDBVersion(versionName) Setthelayer'sdatasourcetothespecifiedgeodatabaseversion.IftheversionNameisnullthenthedatasourcewillbethepublishedmap'sdefaultversion.Onlyapplicableifthelayer'sdatasourceisregisteredasversionedinSDE.OnlyvalidwithArcGISServerservicesversion10.1orgreater.(Addedatv2.7)Returntype:FeatureLayerParameters: versionName Required Thenameofthegeodatabaseversiontouseasthelayer'sdatasource. setInfoTemplate(infoTemplate) Specifyorchangetheinfotemplateforalayer.(Addedatv2.2)Parameters: infoTemplate Required Thenewinfotemplate. Sample: vartemplate=newesri.InfoTemplate(); template.setTitle("${qAddress}"); template.setContent(getTextContent); featureLayer.setInfoTemplate(template); setLabelingInfo(labelingInfo) Setslabelinginfoonthelayer.InputvalueisanarrayofLabelClassobjects.(Addedatv3.10)Parameters: labelingInfo Required Thisisthelabeldefinitionforthislayer,specifiedasanarrayoflabelclasses.Usethispropertytospecifyanychangestothestructureofthelabel.Forexample,labelexpression,placement,andsizecanbemodifiedandpassedtothisproperty. setMaxAllowableOffset(offset) Setsthemaximumallowableoffsetusedwhengeneralizinggeometries.TheoffsetisintheunitsofthespatialReference.Thisisignoredwhenworkingwitheditablelayers.Parameters: offset Required Themaximumallowableoffset. Sample: featureLayer=newesri.layers.FeatureLayer(featureLayerUrl,{ maxAllowableOffset:1000 }); setMaxScale(scale) Setthemaximumscaleforthelayer.(Addedatv3.1)Parameters: scale Required Themaximumscaleatwhichthelayerisvisible. setMinScale(scale) Settheminimumscaleforthelayer.(Addedatv3.1)Parameters: scale Required Theminimumscaleatwhichthelayerisvisible. setOpacity(opacity) Initialopacityortransparencyoflayer.NotsupportedinInternetExplorer.Parameters: opacity Required Valuefrom0to1,where0is100%transparentand1hasnotransparency.Thedefaultvalueis1. Sample: featureLayer.setOpacity(.50); setRefreshInterval(interval) Changesthelayer'srefreshintervaltothegivenvalue(inminutes).Non-zerovaluesetsupautomaticlayerrefreshatthespecifiedinterval.Valueof0stopsautorefresh.(Addedatv3.7)Returntype:LayerParameters: interval Required Refreshintervalofthelayerinminutes.Non-zerovalueindicatesautomaticlayerrefreshatthespecifiedinterval.Valueof0indicatesautorefreshisnotenabled. setRenderer(renderer) Settherendererforthefeaturelayer.Parameters: renderer Required Therenderertoapplytothefeaturelayer Sample: varsymbol=newesri.symbol.SimpleFillSymbol().setColor(newesri.Color([255,0,0,0.5])); varrenderer=newesri.renderer.SimpleRenderer(symbol); featureLayer.setRenderer(renderer); setScaleRange(minScale,maxScale) Setthescalerangeforthelayer.IfminScaleandmaxScalearesetto0thenthelayerwillbevisibleatallscales.(Addedatv2.5)Parameters: minScale Required Theminimumscaleforthelayer.Ifthemapiszoomedoutbeyondthespecifiedscalethelayerwillnotbevisible.Avalueof0meansthelayerdoesnothaveaminimumscale. maxScale Required Themaximumscaleforthelayer.Ifthemapiszoomedoutbeyondthespecifiedscalethelayerwillnotbevisible.Avalueof0meansthelayerdoesnothaveamaximumscale. Sample: featureLayer.setScaleRange(591657528,147914381); setSelectionSymbol(symbol) Setstheselectionsymbolforthefeaturelayer.Ifnosymbolisspecified,featuresaredrawnusingthelayer'srenderer.Returntype:FeatureLayerParameters: symbol Required Symbolforthecurrentselection.Makesurethesymboltypeisappropriateforthegeometrytypeofthelayer. Sample:varselectionSymbol=newesri.symbol.SimpleFillSymbol().setColor(newesri.Color([255,255,0,0.5])); featureLayer.setSelectionSymbol(selectionSymbol); setShowLabels(showLabels) Setswhethertodisplaylabelsornot.Settofalsetoturnofflabeling.(Addedatv3.11)Parameters: showLabels Required Settotruetoshowlabels. setTimeDefinition(definition) Setsthetimedefinitionforthefeaturelayer.Atimedefinitiontemporarilyfiltersthefeaturesinthelayertomatchthespecifiedtimeextent.Onlyapplicablefortime-awarelayers.Onlysupportedwhenthefeaturelayerisinsnapshotmode. Inadditiontotimedefinition,time-awarelayersalsosupportthetimeextentsetonthemap.Time-awarelayersautomaticallyupdatewhenthemap'stimeextentischanged,similartohowlayersreactwhenthemap'sspatialreferenceismodified.Ifalayer'stimedefinitionissettodisplayfeaturesbetween1970and1975andthemaphasatimeextentsetto1972-1980,theeffectivetimeonthefeaturelayerwillbe1972-1975Returntype:FeatureLayerParameters: definition Required Thenewtimeextentusedtofilterthelayer. Sample: vardefn=newesri.TimeExtent(); defn.startTime=newDate("November30,20096:00:00") defn.endTime=newDate("November30,20098:00:00"); featureLayer.setTimeDefinition(defn); setTimeOffset(offsetValue,offsetUnits) Timeoffsetallowsyoutodisplaythefeaturesatadifferenttimesotheycanbeoverlaidontopofpreviousorfuturetimeperiods.Forexample,tovisualizethegrowthpatternoftwowildfiresthathappenedintwodifferentyears,oneofthelayerscanbegivenanoffsetthatwillcauseittoappearasifthefirestartedatthesametimeastheotherfire.Notethattheoffsetdoesnotchangethetemporalcomponentofthedataitselfandhasnoeffectifthelayerisnottimeaware. Example:Ifalayerhasdatarecordedfortheyear1970,anoffsetvalueof2yearswouldtemporarilyshiftthedatato1972(fordisplaypurposesonly,queryandselectionarenotaffectedbyoffset).Returntype:FeatureLayerParameters: offsetValue Required Thelengthoftimetooffsetfrom"this"time.Specifyapositiveornegativewholenumber. offsetUnits Required Unitsinwhichtheoffsetisspecified.SeetheTimeInfoconstantsforvalidvalues. setUseMapTime(update) Determineifthelayerwillupdateitscontentbasedonthemap'scurrenttimeextent.Defaultvalueistrue.(Addedatv2.2)Parameters: update Required Whenfalsethelayerwillnotupdateitscontentbasedonthemap'stimeextent.Defaultvalueistrue. setVisibility(isVisible) Setsthevisibilityofthelayer.Whentrue,thelayerisvisible.Parameters: isVisible Required Setthevisibilityofthelayer. setWebGLEnabled(enable) TogglesWebGLrenderingon/offonthelayer.(Addedatv3.24)Parameters: enable Required IndicateswhethertoenableWebGLonthelayer. Sample:layer.setWebGLEnabled(true); show() Setsthevisibilityofthelayerto"true". suspend() Suspendslayerdrawing.(Addedatv3.1) toJson() Returnsaneasilyserializableobjectrepresentationofthelayer.Regardlessofthelayer'smodeofoperation,onlyfeaturescurrentlyavailableontheclientareincluded. { layerDefinition:, featureSet:{ features: } } Returntype:Object EventDetails [OnStyleEvents|ConnectStyleEvent] add-attachment-complete FireswhenaddAttachments()iscomplete.ShouldbeusedinfavorofonAddAttachmentComplete.(Addedatv3.5)EventObjectProperties: result TheresultoftheaddAttachmentoperationindicatingiftheattachmentwassuccessfullyadded. Seealso:addAttachment() before-apply-edits Firedbeforeeditsareappliedtothefeaturelayer.ShouldbeusedinfavorofonBeforeApplyEdits.(Addedatv3.5)EventObjectProperties: adds Arrayoffeaturestoaddtothelayerinthefeatureservice. deletes Arrayoffeaturestodelete. updates Arrayoffeatureswhosegeometryand/orattributeshavechanged. capabilities-change FiredwhenthecapabilitiesofthelayeraremodifiedusingthesetEditablemethod.ShouldbeusedinfavorofonCapabilitiesChange.(Addedatv3.5)Seealso:setEditable() click Fireswhenagraphichasbeenclicked.ShouldbeusedinfavorofonClick.(Addedatv3.5)EventObjectProperties: event ThereturnedobjectcontainsscreenPoint,mapPoint,andGraphic. dbl-click Fireswhenafeaturehasbeendoubleclicked.(Addedatv3.6)EventObjectProperties: event ThereturnedobjectcontainsscreenPoint,mapPoint,andgraphic. Sample: require([ "dojo/_base/connect","esri/toolbars/Edit",... ],function(connect,Edit,...){ vareditToolbar=newEdit(...); connect.connect(firePerimeterFL,"onDblClick",function(evt){ editToolbar.activate(Edit.EDIT_VERTICES,evt.graphic); }); ... }); delete-attachments-complete FireswhendeleteAttachmentsiscomplete.ShouldbeusedinfavorofonDeleteAttachmentsComplete.(Addedatv3.5)EventObjectProperties: results Theresultobjects,oneforeachattachmentindicatingifitwassuccessfullyremoved. Seealso:deleteAttachments() edits-complete FiresafterapplyEdits()iscomplete.ShouldbeusedinfavorofonEditsComplete.(Addedatv3.5)EventObjectProperties: adds Anarrayofresultobjects,oneforeachfeature,indicatingifitwassuccessfullyadded.IfthefeaturewasaddedtheresultobjectwillcontaintheuniqueobjectIDassignedtothefeature. deletes Anarrayofresultobjects,oneforeachfeature,indicatingifitwassuccessfullydeleted.IfthefeaturewasdeletedtheresultobjectwillcontaintheuniqueobjectIDpreviouslyassignedtothefeature. updates Anarrayofresultobjects,oneforeachfeature,indicatingifitwassuccessfullyupdated.IfthefeaturewasupdatedtheresultobjectwillcontaintheuniqueobjectIDassignedtothefeature. Seealso:applyEdits() error Fireswhenthereisaproblemretrievingalayer.ShouldbeusedinfavorofonError.(Addedatv3.5)EventObjectProperties: error ArcGISServererrormessagereturnedinaJavaScripterrorobject. gdb-version-change Firedwhenthegeodatabaseversionisswitched.(Addedatv3.5) graphic-add FireswhenagraphicisaddedtotheGraphicsLayer.ShouldbeusedinfavorofonGraphicAdd.(Addedatv3.5)EventObjectProperties:



請為這篇文章評分?