ThinkGeo.com    |     Documentation    |     Premium Support

Plot Features Out side map boundary(-180,90,180,-90) for problem in Overlay Image

Hi,
I am trying to plot feature(point) at Long=200. But it’s not plotting at 200.it’s plotting up to 180.
Is there any functionality to do it. or not.

PointShape pt = new PointShape(“POINT(200 10)”);

Actually my issue is relate to Overlay a Image. Image bounds should be 100E to -100W.

GdiPlusRasterLayer rasterLayerF = new GdiPlusRasterLayer(“PGGE05_00WX.jpeg”, _proj.ConvertToExternalProjection(new RectangleShape(100.17, 52.59, 249.75, -61.26)));

But it’s not overlaying it. It’s stretching.
Could you please, suggest me how to solve this issue?

Thank You,
Riyaz

Hi Riyaz,

In ManagedProj4Projection the the value will be restrict to the values (-180, 90, 180, -90). It means that if you want to display a point out the range, you can’t use the ManagedProj4Projection.

There are 2 options for this.

  1. Use the DecimalDegree instead. The result should be like below:

2.UnmanagedProjection instead of ManagedProj4Projection like below and
it will render the point wrapped:

  var proj = new UnmanagedProj4Projection(4326, 3857) { DecimalDegreeBoundary = new RectangleShape(-180, 90, 210, -90)};

Any misunderstood here please let me know.

Thanks,
Peter

Hi Peter,
I checked your both ways.It’s coming.
But I want to plot feature(200,0) in Mercator(54004) projection.
Is it possible to do it?

Please suggest me to do this.

Thanking you,
Riyaz

Hi Riyaz,

Please try the following code:

proj.InternalProjectionParametersString = Proj4Projection.GetDecimalDegreesParametersString();
proj.ExternalProjectionParametersString = "+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs"; // 54004 proj4 string

Thanks,
Peter

Hi Peter,
I tried your code by Proj4Projection, ManagedProj4Projection and UnmanagedProj4Projection. But it’s not work out.

Please suggest, Any other ways to do it.

Thanks,
Riyaz

Hi Riyaz,

Could you please tell me the result, like the 1 or 2? and what’s your want?
1.
http://community.thinkgeo.com/uploads/default/original/3X/3/c/3c112a0d9f9a6b4bbaf4dc2725638fc837118cd7.png

http://community.thinkgeo.com/uploads/default/original/3X/d/f/dfb2aa88df032f19d6d5100ca9984040cf45508a.png

Thanks,
Peter

Hi Perer,
I want #1.

Thanks,
Riyaz

Hi Riyaz,

I guess there are 2 options for this.

  1. Divide the point (200, 10) into two points (180, 10) and (20, 0) and then apply projection to the 2 points and then add the x value, the code maybe like below:

    var point1 = proj.ConvertToExternalProjection(new PointShape(“POINT(180 10)”)) as PointShape;
    var point2 = proj.ConvertToExternalProjection(new PointShape(“POINT(20 0)”)) as PointShape;
    layer.InternalFeatures.Add(new Feature(new PointShape(point1.X + point2.X, point1.Y), new Dictionary<string, string> { { “Text”, “200, 10”} }));

  2. Use the DecimalDegress instead of Meter and just apply the projection to the GdiPlusRasterLayer, ,like I mentioned before.

Thanks,
Peter

Hi Peter,
It’s working fine. Thanks for your code. It’s helpful to me.

Thanks,
Riyaz

Hi Riyaz,

Very glad to hear it works.

Thanks,
Peter

Hi Peter,
One more problem.
I am trying to overlay bellow image. In normal projection(WGS84) it’s working fine.
GdiPlusRasterLayer rasterRadar = new GdiPlusRasterLayer(@"…/…/Data/L_plot_global_map.jpg", new RectangleShape(new PointShape(-211.714, 107.598), new PointShape(186.271, -112.4894)));

But whenever I am applying mercator projection(54004) it’s not coming correctly.
var point = _proj.ConvertToExternalProjection(new PointShape(“POINT(180 90)”)) as PointShape;
var point1 = _proj.ConvertToExternalProjection(new PointShape(“POINT(6.271 17.598)”)) as PointShape;
var point2 = _proj.ConvertToExternalProjection(new PointShape(“POINT(31.714 22.4894)”)) as PointShape;
GdiPlusRasterLayer rasterRadar = new GdiPlusRasterLayer(@"…/…/Data/L_plot_global_map.jpg", new RectangleShape(-(point.X + point2.X), point.Y + point1.Y, point.X + point1.X, -(point.Y + point2.Y)));

Please check and solve this issue. I want to overlay this image in Mercator Projection.

Thanks,
Riyaz

Hi Riyaz,

If you want to use 54004, please set map unit equal meter first.

Then build the projection class, convert vertex to 54004 and assign the projection to GdiPlusRasterLayer.ImageSource.Projection.

I think that will works now.

Regards,

Don

Hi Don,
it’s workout, But Image is stretching.
In WGS84, it’s working fine.But In UTM, image is strected.
Observe these 2 snapshots.

WGS84

UTM

Here I am attaching my sample application.
Please check and clarify it. Is it possible to make exact image(With out stretch) in UTM or not?

frmLightningOverlay.zip (5.2 KB)

Thanks,
Riyaz

Hi Riyaz,

Whether it will be stretch or not is totally decided by the extent you passed in when you create the GdiPlusRasterLayer.

The assigned projection will help you convert the extent you passed in from WGS84 to epsg 54004. If you don’t want it looks stretch, it won’t be placed in the correct coordinates at all.

But you still can implement that.

  1. Override drawcore function, directly call canvas.DrawScreenImageWithoutScaling api to draw this image on map.

  2. Directly use LogoAdornmentLayer, which maybe get the same effect.

But I want to make sure your requirement here, why you want to draw the image on map and ignore it’s projection? Which won’t works well with other layer, if you just want to use our map to show an image, I think you can directly use 4326 and DecimalDegree as your map setting.

Regards,

Don

Hi Don,

       One strange problem, I told you before, the image is overlaying at out of boundary.

It’s working fine in DEVELOPMENT dll’s.
Where as In release dlls, it’s coming error.

Error

I don’t know, what was the wrong. I debug it. the error is coming on Map Refresh.

Please let me know, what was the problem. How could be resolve it.

Thanks,
Riyaz

Hi Riyaz,

That should because our developer did enhancement in our development dlls, but it looks I hadn’t found which enhancement is works for your issue.

Because we will synchronous all the changes into our release dlls when new version release, I think you can get the update in our new version.

Regards,

Don