I need to draw a circle/area with a transparent color. the radius must be in miles or kms. How may I do this?
Thanks in advance for your support.
jm.
I need to draw a circle/area with a transparent color. the radius must be in miles or kms. How may I do this?
Thanks in advance for your support.
jm.
Hi Jean-marie,
We need more detailed description for your requirement. For example: Do you draw a circle by using code, or you’ll click on the map to draw a circle?
We’ll keep an eye on your feedback.
Regards,
Ivan
OK!
I need to draw a circle at a specific location (gps coordinates) using code. The circle center is a distributeur or channel partner and I need to find how far this channel partner reach in term of final customers. I have the channel partner on one layer and end customers on another layer then i need to find the farest customer for this channel partner and this will be my circle radius. The circle will be made of transparent color.
thanks for your support.
Jean Marie,
You are given us few information about your scenario. I will take a specific case and I think you will be able to adapt the code for your case. Let's say, I have a point for GPS location in longitude and latitude and I want to create a circle of a radius of 0.8 kilometers to display on World Map Kit in Spherial Mercator (same projection as Google Map) with the circle having a semi transparent fill. See the code below on how to accomplish that. You can also see the screen shot of the result.
winformsMap1.MapUnit = GeographyUnit.Meter;
winformsMap1.CurrentExtent = new RectangleShape(-10781481,3911303,-10773712,3906496);
winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 198, 255, 255));
//Displays the World Map Kit as a background.
ThinkGeo.MapSuite.DesktopEdition.WorldMapKitWmsDesktopOverlay worldMapKitDesktopOverlay = new ThinkGeo.MapSuite.DesktopEdition.WorldMapKitWmsDesktopOverlay();
worldMapKitDesktopOverlay.Projection = WorldMapKitProjection.SphericalMercator;
winformsMap1.Overlays.Add(worldMapKitDesktopOverlay);
//Gets the GPS coordinates in Longitude and latitude.
double GPSlongitude = DecimalDegreesHelper.GetDecimalDegreeFromDegreesMinutesSeconds(-96, 49, 41.8);
double GPSlatitude = DecimalDegreesHelper.GetDecimalDegreeFromDegreesMinutesSeconds(33, 6, 9.9);
//Converts the Longitude/Latitude coordinates to match Spherical Mercator World Map Kit.
Proj4Projection proj4 = new Proj4Projection();
proj4.InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(4326); //WGS84(Longitude/Latitude)
proj4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString(); //Spherical Mercator projection(Google Map, Bing Map etc)
proj4.Open();
Vertex GPSvertex_SphericalMercator = proj4.ConvertToExternalProjection(GPSlongitude, GPSlatitude);
proj4.Close();
PointShape GPSpointShape = new PointShape(GPSvertex_SphericalMercator);
//Creates the circle with 0.8 kilometers of radius.
EllipseShape ellipseShape = new EllipseShape(GPSpointShape, 0.8, winformsMap1.MapUnit, DistanceUnit.Kilometer);
InMemoryFeatureLayer inMemoryFeatureLayer = new InMemoryFeatureLayer();
//Sets the symbol as black outline and semi transparent red.
inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle
(GeoColor.FromArgb(150,GeoColor.StandardColors.Red),GeoColor.StandardColors.Black,2);
inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.Red, 8);
inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
inMemoryFeatureLayer.InternalFeatures.Add(new Feature(ellipseShape));
inMemoryFeatureLayer.InternalFeatures.Add(new Feature(GPSpointShape));
LayerOverlay dynamicOverlay = new LayerOverlay();
dynamicOverlay.Layers.Add(inMemoryFeatureLayer);
winformsMap1.Overlays.Add(dynamicOverlay);
winformsMap1.Refresh();
VERY GOOD!!!
THANKS SO MUCH FOR YOUR HELP!!!
JM
Jean-Marie,
You are welcome. If you have any other questions, let us know.
Hi Jean-Marie,
It’s really good solution which was you provided here…
But my scenario is little bit different from this. i have to draw the circle or rectangle in the win-forms like GPS video Sync software… This software has two windows. One is 2dForm and another window is video. This software will help to see the player movement with video…
Currently in this software we have an ugly mechanism to draw the circle or rectangle (its call as ground in the software) by the entering co-ordinates from the user…
For e.g.: while drawing a circle in the win-forms…
We are getting 8 inputs from the user like upper left, upper right, lower left, lower right of the latitude and longitude.
After that we will draw the circle…
Do you have any idea on this?
I would like to draw the circle without user interaction. One more clue we have GPS data of enter ground
Hi VIjay,
Thanks for your post. One thing I don’t quite understand is what’s connection between the circle and the rectangle? what’s “draw the circle without user interaction”?
do you have a screen shot or something to let us know what’s the UI looks like?
Thanks,
Lee
The above solution is impressive…
How do we save the above circle to a shapefile? What should be the shapefiletype to save a circle?
I think I got it… The shapefiletype is polygon. It can be created like any other polygon shapefile.
Ok Jacob,
Good to hear you figure it out. Any other questions, please feel free to let us know.
Thanks,
Troy