ThinkGeo.com    |     Documentation    |     Premium Support

Graticule Dash style and Line Smooth correction

Hi,

Image 1

graticule dash style showing clearly.

I applied this code
shplatlon10.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = new LineStyle(new GeoPen(GeoColor.StandardColors.SlateGray, 2));
shplatlon10.ZoomLevelSet.ZoomLevel01.DefaultLineStyle.OuterPen.DashStyle = LineDashStyle.Dash;

If I tried to apply Line Width=1, it’s showing like this

Image 2

graticule dash style not showing clearly.

I applied this code
shplatlon10.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = new LineStyle(new GeoPen(GeoColor.StandardColors.SlateGray, 1));
shplatlon10.ZoomLevelSet.ZoomLevel01.DefaultLineStyle.OuterPen.DashStyle = LineDashStyle.Dash;

Finally, I want line size=1 and graticule dash style showing clearly.

One more thing,
I want to Know, what are the factors affecting for making Line(Great Circle Line) smooth.

Please help to fix it.

Thanks,
Riyaz

Hi Riyaz,

I think you should want to use LineDashStyle.Custom style, you can find how to use it here: Line style

And if you want to use a arc line smooth, just make the vertex on it more closely, because all the arc is render by line.

Regards,

Don

Hi Don,
Thanks. it’s work out.
For Line smooth, I am taking ‘Great Circle Line’. Applied ‘Anti Alias’ ,‘DrawingQuality’ and ‘DrawingMarginPercentage’.

wfMap.TextRenderingHint = TextRenderingHint.AntiAlias;
imRouteLayer.DrawingQuality = DrawingQuality.HighQuality;
imRouteLayer.DrawingMarginPercentage = 50;

It’s coming fine. But I want to know, Is any other ways we can increase line smoothness.

Thanks,
Riyaz

Hi Riyaz,

Your setting should be enough for that, I hadn’t found more API related with draw quality.

Regards,

Don

Hi Don,
It’s fine. Helpful.
Thanks.
Riyaz

Hi Riyaz,

I am glad to hear that’s helpful.

Regards,

Don

Hi Don,
One more thing, I got an exception(Out Of Memory Exception) on applying ‘Polar Projection’ to graticule shape files.

_proj.ExternalProjectionParametersString = “+proj=stere +lat_0=90 +lon_0=50 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m no_defs <>”;

Please check it and fix this issue?

Thanks,
Riyaz

Hi Riyaz,

Your projection string is invalid, it contains something like " <>" which cannot pass validation.

Please check your string, that should be proj4 format. You can double check that in this page: epsg.io

Regards,

Don

Hi Don,

         Thanks for your reply. I updated 'Polar projection' (Proj4 string) from ESRI:102018 http://spatialreference.org/ref/esri/102018/proj4/ 

_proj.ExternalProjectionParametersString = "+proj=stere +lat_0=90 +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs ";

Even though it’s not work out.
Please check and fix it.

Thanks,
Riyaz

Hi Riyaz,

As below is my test sample, which works well with our latest version without exception. Could you please try it again?

        private void Pan_Load(object sender, EventArgs e)
    {
        ManagedProj4Projection proj4 = new ManagedProj4Projection();
        proj4.InternalProjectionParametersString = ManagedProj4Projection.GetDecimalDegreesParametersString();
        proj4.ExternalProjectionParametersString = ManagedProj4Projection.GetEsriParametersString(102018);
        proj4.Open();

        winformsMap1.MapUnit = GeographyUnit.Meter;
        winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);

        GraticuleAdornmentLayer layer = new GraticuleAdornmentLayer();
        layer.Projection = proj4;
        winformsMap1.AdornmentOverlay.Layers.Add(layer);

        ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"..\..\SampleData\Data\Countries02.shp");
        worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
        worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green));
        worldLayer.FeatureSource.Projection = proj4;

        LayerOverlay staticOverlay = new LayerOverlay();
        staticOverlay.Layers.Add("WorldLayer", worldLayer);
        winformsMap1.Overlays.Add(staticOverlay);

        worldLayer.Open();
        winformsMap1.CurrentExtent = worldLayer.GetBoundingBox();

        winformsMap1.Refresh();
    }

Regards,

Don

Hi Don,

        While applying 'Graticule Custom Dash style'. it's taking more time for loading.

Code:
ManagedProj4Projection _proj = new ManagedProj4Projection();
_proj.InternalProjectionParametersString = ManagedProj4Projection.GetEpsgParametersString(4326);
_proj.ExternalProjectionParametersString = “+proj=stere +lat_0=90 +lon_0=60 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m no_defs <>”;

LineStyle customDashLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(255,255,0,0), 1, LineDashStyle.Custom, true);
customDashLineStyle.CenterPen.DashPattern.Add(4f);
customDashLineStyle.CenterPen.DashPattern.Add(4f);
customDashLineStyle.CenterPen.DashPattern.Add(4f);
customDashLineStyle.CenterPen.DashPattern.Add(4f);

ShapeFileFeatureLayer shplatlon10 = new ShapeFileFeatureLayer(@“Path\graticules_10.shp”);
shplatlon10.FeatureSource.Projection = _proj;
shplatlon10.RequireIndex = false;
shplatlon10.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(customDashLineStyle);
shplatlon10.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

I tried to apply normal Line Dash style, that one also taking long time for loading.
LineStyle customDashLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(255,255,0,0), 1, LineDashStyle.Custom, true);
customDashLineStyle.CenterPen.DashStyle = LineDashStyle.Dash;
shplatlon10.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(customDashLineStyle);

Pls check it and Fix it ASAP. finally i want to apply dash style to ‘PSG’ projection.

Note : i am taking my own graticule by shape file format.
For your reference here i am attaching my custom Graticule shape file.
1.zip (77.8 KB)

Thanks,
Riyaz

Hi Riyaz,

We did some test based on your file, as below is the test result:

  1. Your shape file render correct under 4326:

  2. It render correct under projection 102018 with other style:

  3. Your projection string still be invalid, it cannot make the map render, so I still use the code as below to test: proj4.ExternalProjectionParametersString = Proj4Projection.GetEsriParametersString(102018);

  4. When I tested with the customDashLineStyle and projection 102018, the map cannot render anything. Our developer will look into this problem and update about this.

Regards,

Don

Hi Riyaz,

That’s proved a bug and our developer had fixed it, please get our latest package from NuGet: ThinkGeo MapSuite 11.0.0-beta019, you can download it in one days.

Your customDashLineStyle works well for the projection 102018:

BTW, re-projection based on your data have some problem, because the re-projected data will beyond the bounding box limitation of target projection 102018, our suggestion is convert the data into target projection by the utility for example our GisEditor, then directly render the converted data, but not do that when the application run.

Any question please let us know.

Regards,

Don

Hi Don,
Greetings of the Day. Thanks for your valuable reply.

We can’t use ThinkGeo MapSuite 11.0.0-beta019 version from NuGet. Because We are using ‘Visual studio 2010’ with Thinkgeo Mapsuite 9.X.X.XXX versions(ThinkGeo MapSuite 11.0.0-beta019 version from NuGet not support VS 2010).

So, Can you fix it in Thinkgeo Mapsuite 9.X.X.XXX versions?

Thanks,
Riyaz

Hi Riyaz,

Thanks to let us know that, we also solve that in 9.0, please download the version 9.0.716.0 or higher version from product center.

That version will be updated in one or two days.

Regards,

Don

Hi Don,
I checked PSG custom graticule in Thinkgeo Mapsuite 9.0.718 and 9.0.722 version .
But same problem, it’s taking long time for rendering graticule.

Can You Please, Check it and Resolve it ASAP.

Thanks,
Riyaz

Hi Riyaz,

We don’t have a 9.0.722.0, so I tested that with 9.0.718.0, it works well, please see attached sample here:

It contains the bin folder, so you can directly run it.

Regards,

Don

Hi Don,
I checked your ‘debug’ folder application run. It’s working fine. I need that one only.
But while open your project in ‘VS 2010’, it’s not open.

I am getting this error.

Please let me know, is it open on ‘VS 2010’ or not.

Thanks,
Riyaz

Hi Riyaz,

Thanks to let us know that, please try this modified project and then replace the dll to target version. We don’t have a VS2010 for test, but I think that should works this time, you can also directly open the project instead of open the solution.

For reduce the size to upload, I hadn’t attach bin folder this time.

8271.zip (182.2 KB)

Regards,

Don