ThinkGeo.com    |     Documentation    |     Premium Support

Points not Rendering on Map

I have the following code in my application to render points on a WPF map control. Similar code works fine in other scenarios that I've worked with. In this instance, however, the Points are not rendering on the map regardless of the zoom level.


Any ideas?


Are there any properties related to DefaultPointStyle that control how many points in an area are rendered - similar to the GridSize or TextLineSegmentRatio properties of the DefaultTextStyle?


Thanks,


Nick


// 10.0 - Establish Map Unit System

wpfMap1.MapUnit = GeographyUnit.DecimalDegree;


// 20.0 - Change color of ocean.

wpfMap1.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);


// 30.0 - Create Map Layer representing the US 

ShapeFileFeatureLayer usLayer = new ShapeFileFeatureLayer(@"C:\Program Files\ThinkGeo\Map Suite Desktop Evaluation Edition 3.0 (BETA)\Samples\SampleData\Data\USStates.shp");

usLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;

usLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;


// 40.0 - Create Map Layer representing Addresses as Points on the Map.   

InMemoryFeatureLayer AddressPointLayer = new InMemoryFeatureLayer();

AddressPointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.Capital1;

AddressPointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;


// 50.0 - Get all addresses from .CSV file

Collection<VendorWebAddress> vendorWebAddresses = GetVendorWebAddresses();         


// 60.0 - 1) Attempt to Verify & Resolve addresses with GeoCode Engine data to see if it matches an existing address

//     2) If address is resolved, save & return the Latitude and Longitude points.

Collection<PointShape> vendorWebAddressPoints = GetVendorWebAddressPoints(vendorWebAddresses);


// 70.0 - Add address points (as Features) to the AddressPointLayer which will

//     later be added to the Map control.

foreach (PointShape addressPoint in vendorWebAddressPoints)

{

 AddressPointLayer.InternalFeatures.Add(new Feature(addressPoint));

}


// 80.0 - Add Layers to Map

wpfMap1.StaticOverlay.Layers.Add("USLayer", usLayer);

wpfMap1.StaticOverlay.Layers.Add("AddressPointLayer", AddressPointLayer);

wpfMap1.CurrentExtent = new RectangleShape(-230, 105, 30, 26);


// 90.0 - Render Map with Changes

wpfMap1.Refresh();



Nick, 
  
 Your code seems fine, just a bit strange on the CurrentExtent. As a decimal degree coordinate, the latitude should be between -90 to 90 and the longitude should be between -180 to 180, seems yours is our of range. 
  
 If you still have this issue, can we first comment out the method AddressPointLayer.InternalFeatueres.Add(new Feature(addressPoint)) and artificially add one point within that extent like AddressPointLayer.InternalFeatures.Add(new Feature(-100, 40)). If that point shows properly, we can say something wrong with the features got by the address points; otherwise I’m not sure, maybe you need to write a simple sample just to show a point, and compare the codes. Point style has no properties like GridSize or SegmentRation, it will always display. 
  
 Let me know what the result is. 
  
 Thanks, 
  
 Ben