Select to view content in your preferred language

Feature layer publish, Display in WPF app

4322
30
06-13-2010 10:55 PM
xariaD
by
Occasional Contributor
We have a feature layer, which we intend to publish using ArcGIS Server.
We have a WPF application which displays maps. This feature layer is to be overlayed upon the map.
The feature layers represents certain units installed at particular locations. We have the co-ordinates of these units.

The units have different state eg Enabled/disabled. We wish to represent the enabled units with different icon and disabled with different icon. Obviously the state is obtained dynamically. How to achieve this?
Also, Upon clicking these units on the map some function should be performed.
How do we determine which unit has been clicked?
0 Kudos
30 Replies
dotMorten_esri
Esri Notable Contributor
But does 2.0 support VS 2008? I see the minimum install is VS 2010 and I m using WPF not silverlight.
We are using Expression Blend 3 .


VS2010 is only required for the Silverlight portion. You can continue to use VS2008 if you are doing WPF.
0 Kudos
xariaD
by
Occasional Contributor
This is what I get from Feature layer http://.........MapServer/0?j=pjson

Layer: Labels (ID: 0)
Sub Layers:

    * S_PR-TOWER
    * S_Grid1
    * S_TWY1-CtrLine-Txt
    * RW2
    * S_Bline
    * TITLE_BLOCK
    * GATENAME

Display Field: TextString

Type: Annotation Layer

Geometry Type: esriGeometryPolygon

Description:

Definition Expression:

Copyright Text:

Min. Scale: 0

Max. Scale: 0

Extent:

      XMin: 6213.22240586483
      YMin: -4580.88478070292
      XMax: 7108.20544900603
      YMax: -373.866660260542
      Spatial Reference:

Fields:

    * OBJECTID (Type: esriFieldTypeOID, Alias: OBJECTID)
    * SHAPE (Type: esriFieldTypeGeometry, Alias: SHAPE)
    * FeatureID (Type: esriFieldTypeInteger, Alias: FeatureID)
    * ZOrder (Type: esriFieldTypeInteger, Alias: ZOrder)
    * AnnotationClassID (Type: esriFieldTypeInteger, Alias: AnnotationClassID)
    * Element (Type: esriFieldTypeBlob, Alias: Element)
    * SymbolID (Type: esriFieldTypeInteger, Alias: SymbolID)
    * Status (Type: esriFieldTypeSmallInteger, Alias: Status)
    * TextString (Type: esriFieldTypeString, Alias: TextString)
    * FontName (Type: esriFieldTypeString, Alias: FontName)
    * FontSize (Type: esriFieldTypeDouble, Alias: FontSize)
    * Bold (Type: esriFieldTypeSmallInteger, Alias: Bold)
    * Italic (Type: esriFieldTypeSmallInteger, Alias: Italic)
    * Underline (Type: esriFieldTypeSmallInteger, Alias: Underline)
    * VerticalAlignment (Type: esriFieldTypeSmallInteger, Alias: VerticalAlignment)
    * HorizontalAlignment (Type: esriFieldTypeSmallInteger, Alias: HorizontalAlignment)
    * XOffset (Type: esriFieldTypeDouble, Alias: XOffset)
    * YOffset (Type: esriFieldTypeDouble, Alias: YOffset)
    * Angle (Type: esriFieldTypeDouble, Alias: Angle)
    * FontLeading (Type: esriFieldTypeDouble, Alias: FontLeading)
    * WordSpacing (Type: esriFieldTypeDouble, Alias: WordSpacing)
    * CharacterWidth (Type: esriFieldTypeDouble, Alias: CharacterWidth)
    * CharacterSpacing (Type: esriFieldTypeDouble, Alias: CharacterSpacing)
    * FlipAngle (Type: esriFieldTypeDouble, Alias: FlipAngle)
    * Override (Type: esriFieldTypeInteger, Alias: Override)
    * Entity (Type: esriFieldTypeString, Alias: Entity)
    * Handle (Type: esriFieldTypeString, Alias: Handle)
    * Owner (Type: esriFieldTypeString, Alias: Owner)
    * Layer (Type: esriFieldTypeString, Alias: Layer)
    * LyrFrzn (Type: esriFieldTypeSmallInteger, Alias: LyrFrzn)
    * LyrLock (Type: esriFieldTypeSmallInteger, Alias: LyrLock)
    * LyrOn (Type: esriFieldTypeSmallInteger, Alias: LyrOn)
    * LyrVPFrzn (Type: esriFieldTypeSmallInteger, Alias: LyrVPFrzn)
    * LyrHandle (Type: esriFieldTypeString, Alias: LyrHandle)
    * Color (Type: esriFieldTypeSmallInteger, Alias: Color)
    * EntColor (Type: esriFieldTypeSmallInteger, Alias: EntColor)
    * LyrColor (Type: esriFieldTypeSmallInteger, Alias: LyrColor)
    * BlkColor (Type: esriFieldTypeSmallInteger, Alias: BlkColor)
    * Linetype (Type: esriFieldTypeString, Alias: Linetype)
    * EntLinetype (Type: esriFieldTypeString, Alias: EntLinetype)
    * LyrLnType (Type: esriFieldTypeString, Alias: LyrLnType)
    * BlkLinetype (Type: esriFieldTypeString, Alias: BlkLinetype)
    * Elevation (Type: esriFieldTypeDouble, Alias: Elevation)
    * Thickness (Type: esriFieldTypeDouble, Alias: Thickness)
    * LineWt (Type: esriFieldTypeSmallInteger, Alias: LineWt)
    * EntLineWt (Type: esriFieldTypeSmallInteger, Alias: EntLineWt)
    * LyrLineWt (Type: esriFieldTypeSmallInteger, Alias: LyrLineWt)
    * BlkLineWt (Type: esriFieldTypeSmallInteger, Alias: BlkLineWt)
    * RefName (Type: esriFieldTypeString, Alias: RefName)
    * LTScale (Type: esriFieldTypeDouble, Alias: LTScale)
    * ExtX (Type: esriFieldTypeDouble, Alias: ExtX)
    * ExtY (Type: esriFieldTypeDouble, Alias: ExtY)
    * ExtZ (Type: esriFieldTypeDouble, Alias: ExtZ)
    * DocName (Type: esriFieldTypeString, Alias: DocName)
    * DocPath (Type: esriFieldTypeString, Alias: DocPath)
    * DocType (Type: esriFieldTypeString, Alias: DocType)
    * DocVer (Type: esriFieldTypeString, Alias: DocVer)
    * ScaleX (Type: esriFieldTypeDouble, Alias: ScaleX)
    * ScaleY (Type: esriFieldTypeDouble, Alias: ScaleY)
    * ScaleZ (Type: esriFieldTypeDouble, Alias: ScaleZ)
    * Style (Type: esriFieldTypeString, Alias: Style)
    * FontID (Type: esriFieldTypeSmallInteger, Alias: FontID)
    * Text (Type: esriFieldTypeString, Alias: Text)
    * Height (Type: esriFieldTypeDouble, Alias: Height)
    * TxtAngle (Type: esriFieldTypeDouble, Alias: TxtAngle)
    * TxtWidth (Type: esriFieldTypeDouble, Alias: TxtWidth)
    * TxtOblique (Type: esriFieldTypeDouble, Alias: TxtOblique)
    * TxtGenType (Type: esriFieldTypeString, Alias: TxtGenType)
    * TxtJust (Type: esriFieldTypeString, Alias: TxtJust)
    * VertAlign (Type: esriFieldTypeString, Alias: VertAlign)
    * TxtFont (Type: esriFieldTypeString, Alias: TxtFont)
    * TxtBoxHt (Type: esriFieldTypeDouble, Alias: TxtBoxHt)
    * TxtBoxWd (Type: esriFieldTypeDouble, Alias: TxtBoxWd)
    * TxtRefWd (Type: esriFieldTypeDouble, Alias: TxtRefWd)
    * TxtAttach (Type: esriFieldTypeSmallInteger, Alias: TxtAttach)
    * TxtDir (Type: esriFieldTypeSmallInteger, Alias: TxtDir)
    * LnSpace (Type: esriFieldTypeSmallInteger, Alias: LnSpace)
    * SpaceFct (Type: esriFieldTypeDouble, Alias: SpaceFct)
    * TxtMemo (Type: esriFieldTypeString, Alias: TxtMemo)
    * SHAPE_Length (Type: esriFieldTypeDouble, Alias: SHAPE_Length)
    * SHAPE_Area (Type: esriFieldTypeDouble, Alias: SHAPE_Area)

Supported Operations:   Query Layer
0 Kudos
xariaD
by
Occasional Contributor
We have a map in AutoCAD.
For our application we do not need to display the city map. We just need to display the area of our concern.
Now we were able to convert the AutoCad to mxd.
But this AutoCad file has co-ordinates of its own and is not using Spatial reference or WKID.

We created another layer, from this mxd to display as feature layer for our WPF application.
Then we created a web application on the ArcGIS server and the layer displays, but it does not display on the wpf app.
I have upgraded the API to 2.0 still it will not display:(
0 Kudos
dotMorten_esri
Esri Notable Contributor
You can display a layer without a spatial reference by itself. However, if you want to overlay it on another map, it must have a valid spatial reference associated with it, so the map knows how to reproject the data to match the basemap.
0 Kudos
xariaD
by
Occasional Contributor
So then the feature layer is alright.

Below is the code for our map display:
<Grid x:Name="LayoutRoot" ShowGridLines="False">
        <Grid.Resources>
        <esriSymbols:SimpleMarkerSymbol  x:Key="MyMarkerSymbol" x:Name="MyMarkerSymbol" Color="Green" Style="Diamond" Size="14" />
    </Grid.Resources>


  <esri:Map x:Name="MyMap" Background="White" Grid.Row="0" Grid.Column="1" Grid.RowSpan="2"
                  Margin="15" Initialized="MyMap_Initialized" ExtentChanged="MyMap_ExtentChanged"
                  ZoomDuration="00:00:00" PanDuration="00:00:00"
                  Extent="6100,-3200,7189,-163" Loaded="MyMap_Loaded">
         
            <esri:Map.Layers>
                <esri:ArcGISDynamicMapServiceLayer x:Name="StreetMap" ID="Street"
                                              Url="http://10.1.3.127/ArcGIS/rest/services/mybasemap/MapServer" />
                <esri:FeatureLayer Visible="True" ID="myLocationLayer" x:Name="myLocation"
                                   Url="http://10.1.3.127/ArcGIS/rest/services/myFeaturelayer/MapServer/0"
                                   MouseLeftButtonDown="TowerLocation_MouseLeftButtonDown"
                                   FeatureSymbol="{StaticResource MyMarkerSymbol}"/>

            </esri:Map.Layers>        
        </esri:Map>

Upon debugging  I found out that Initialized has two layers: ArcGISDynamicMapServiceLayer  and Featurelayer.
What is wrong? Why can't the app display the feature layer :((
0 Kudos
xariaD
by
Occasional Contributor
Update:

Okay I am able to show the feature layer in my WPF app now.
But it is not displaying correctly.
My features are supposed to be horizontal but they are displaying vertically.
Also the labels(annotation) are not being displayed.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
I noticed that the geometry of your feature layer was of type polygon :
Geometry Type: esriGeometryPolygon

and that you were using a marker symbol
FeatureSymbol="{StaticResource MyMarkerSymbol}"

You should use a fill symbol instead.


My features are supposed to be horizontal but they are displaying vertically.

Could you give more info about this issue?


Also the labels(annotation) are not being displayed.

I am not sure on how the annotation layers are managed with API 2.0. Need to wait for Morten's answer.
0 Kudos
xariaD
by
Occasional Contributor
I noticed that the geometry of your feature layer was of type polygon :

and that you were using a marker symbol
You should use a fill symbol instead.


Yeah that is what I did and then I could see the features.
0 Kudos
xariaD
by
Occasional Contributor

My features are supposed to be horizontal but they are displaying vertically.

Could you give more info about this issue?


I think North is not aligned with the DynamicMapLayer. Coz for the DynamicLayer North is pointing towards the right of the screen. but I believe for the feature layer North is towards the top of screen.
0 Kudos
xariaD
by
Occasional Contributor
Please guide me what, where should I be looking at????
:confused: 😞
0 Kudos