ThinkGeo.com    |     Blog    |     Wiki    |     Support

Scaling a point feature with zoom level

Now that I have my Marker overlay scaling its images (thank you, Don, Peter, and Johnny), I have a similar issue with the InMemoryFeatureLayer. I am using the layer to add circles around selected features with the PointStyles.CreateSimpleCircleStyle(). I now need to change the size of the circle when the zoom level changes. I tried to apply the information I learned from working with the Markers, but I can’t find the right pieces to put in the right places.
I was able to create a custom style that will draw a circle, but I don’t see how to make the feature point the center of the circle. I would simply apply offsets if I knew where to do that and which (x,y) values are in world coordinates versus which are in screen coordinates. (And where is the method to convert from one to the other?)
Where should I be starting to create my custom style, and how should I be drawing the circle so that I get the desired size at the right location?

Hi JWhitemire,

For InMemoryFeatureLayer, why not directly set the size like this?

InMemoryFeatureLayer inMemoryFeatureLayer = new InMemoryFeatureLayer();
inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColors.Blue, 1);
inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel02.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColors.Blue, 3);
inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel03.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColors.Blue, 5);
inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel04.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColors.Blue, 7);
inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel05.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColors.Blue, 9);
inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel06.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColors.Blue, 11);

And convert between screen coordinates and world coordinates you can call the API in ExtentHelper like this:
ExtentHelper.ToScreenCoordinate
ExtentHelper.ToWorldCoordinate

Wish that’s helpful.

Regards,

Don

I thought I was looking for something more flexible, but that does get the job done… and without a custom style. Thank you! :smiley:

Hi JWhitemire,

I am glad to hear that works for you.

Regards,

Don