Show PointLayer on Map

May 13, 2015 at 12:56 PM
Hello together,

I have a Problem with Showing a PointLayer on an existing Layer, to see both...

This might be very simple and i searched many hours to fix this, but i cant handle it so far.

I got two different Layer, intersect them an show the result on my map.

IFeatureSet intersectedFeatureSet = Mapping.intersectedFeature;
IFeatureLayer myLayer = map1.Layers.Add(intersectedFeatureSet);
map1.FunctionMode = DotSpatial.Controls.FunctionMode.Pan;

this works fine, but now i want to add a PointLayer with many points inside my Layer and tried it like this:

ProjectionInfo wgs = KnownCoordinateSystems.Geographic.World.WGS1984;
map1.Projection = wgs;
map1.Projection.IsLatLon = true;

FeatureSet pointFeatureSet = new FeatureSet(FeatureType.Point);
pointFeatureSet.Projection = map1.Projection;

IFeatureLayer pointFeatureLayer = map1.Layers.Add(pointFeatureSet);

DotSpatial.Topology.Point pLO = LatLonToMeters(48.69633865, 12.010057938);

DotSpatial.Topology.Coordinate coord = new DotSpatial.Topology.Coordinate(pLO.X, pLO.Y);
DotSpatial.Topology.Point point = new DotSpatial.Topology.Point(coord);

IFeature currentFeature = pointFeatureSet.AddFeature(point);

The Problem is, that the intersected Layer isn´t visible anymore, but the attributes still are shown in the center of the map and the single point is shown as well (i just tried it with one Point). (all attributes from the intersectedLayer are still availible)

I think i dont´t know the right handling with the PointLayer to show it on my map...

I hope that someone can help me!?

May 14, 2015 at 6:41 AM

if the attributes are still shown do you mean they are still shown in the same resolution as before?
Or are they all really close to each other or on top of each other?
Can you see your intersected features like before if you zoom to your intersected layer?

If you can answer my 2nd and 3rd question with yes I think that either your layers have different projections or the coordinates you used where to far from each other so that the resolution of your map becomes to small to show everything correctly.

If your answer is no it would be nice if you could upload a working example for us to have a look at to find your error.

May 14, 2015 at 1:56 PM
Hi jany_,

thank you for your Answer!

you were right, when I zoom into the attributes of my map the intersected Layer becomes visible and is still there.
The Coordinates are in lat/lon GPS format, and as i figured out the Projection has to be WGS1984.
ProjectionInfo projectionPoints = DotSpatial.Projections.KnownCoordinateSystems.Geographic.World.WGS1984;
But i don´t know how to compile these Coordinates to show them in the right position of my intersected Layer.
What Projection do i need for my map?

I have to convert lat/lon to the Projection of my intersected Layer(but i dont know which Projection this is) right?

Here is my Code for the two Layers:
IFeatureSet intersectedFeatureSet = Mapping.intersectedFeature;
ProjectionInfo projectedMap = DotSpatial.Projections.KnownCoordinateSystems.Projected.Europe.ETRS1989LAEA;
ProjectionInfo projectionPoints = DotSpatial.Projections.KnownCoordinateSystems.Geographic.World.WGS1984;

map1.Projection = projectionPoints;
map1.Projection.IsLatLon = true;
IFeatureSet pointFeatureSet = new FeatureSet(FeatureType.Point);
pointFeatureSet.Projection = projectionPoints;

DotSpatial.Topology.Coordinate coord = LatLonToMeters(48.69633865 ,12.010057938);
DotSpatial.Topology.Point point  = new DotSpatial.Topology.Point(coord);

IFeature pointFeature = pointFeatureSet.AddFeature(point);

IFeatureLayer intersectedFeatureLayer = map1.Layers.Add(intersectedFeatureSet);
IFeatureLayer pointFeatureLayer = map1.Layers.Add(pointFeatureSet);

pointFeatureLayer.Symbolizer = new PointSymbolizer(Color.Black, DotSpatial.Symbology.PointShape.Star, 14);

map1.FunctionMode = DotSpatial.Controls.FunctionMode.Pan;
May 19, 2015 at 7:34 AM
If you don't know the projection of your intersected layer I can't help you there. Where do those points come from? If you got them from someone you can ask there what projection you should use.

Having a look at your code I'm wondering why you say IsLatLon = true but convert your points to meters? Is that correct? I never worked with LatLon before, but I'd say if you convert them to meter they are no longer LatLon...