Hello,
I am using the WebEdition. I followed the Isolines examples (wiki.thinkgeo.com/wiki/Map_Suite_Services_Edition_Layers_%26_FeatureSources_Samples#Isolines) and customized it with my own data from my application. That part is working fine.
My question is, how would I draw the isolines/colors only within a given shape? Currently the code (as per the sample) creates a rectangular extent which in this case is the same as the map extent. How would I change this, for example, to only show the isolines within Tennessee? In other words I want to restrict the drawing of the isoline layer within the bounds of a shapefile such as a state outline.
Please let me know any suggestions.
Thanks!
Randy
IsoLines and ShapeFiles
Hi Randy,
You can find a function named CreateGridCellMatrix, please modify the currentDrawingExtent, that can be limited your isoline extent.
If you want to use a bounds of a state outline, please use that extent replace the parameter Map1.CurrentExtent.
Please let me know whether that’s helpful.
Regards,
Don
I see how to do that with a rectangle extent. But how would I do that with a state or region boundary, as from a shapefile? For example I would need to only display the isolines within the state boundaries of Tennessee, not an exact rectangle.
I’ve seen examples of “Clipping” and “Intersecting”. But I’m not sure how to apply those with the grid/isoline code. Would something like that do it, or perhaps another approach? Any examples would be appreciated!
Thanks,
Randy
Hi Randy,
I am sorry it looks if you are using InMemoryGridIsoLineLayer, you cannot implement what you want.
But I think you can do that like this:
1. Use InMemoryGridIsoLineLayer to generate ISO lines, then get all features by isoLineLayer.GetIsoLineFeatures
2. Get your state boundaries, it should be a polygon, loop all lines and get intersection part like this:
MultilineShape lines = line1.GetIntersection(rect)
3. Create your own feature layer, put the new isolines on it, and set style for render them.
Wish that’s helpful.
Regards,
Don
I have implemented my code similar to your suggestion. I manually loop through the isoline features and get the intersections with the shape file shape. Then I add new features based on the intersection. This works great. (it would be nice to have something like this built-in). Thanks!
Hi Randy,
Glad to hear it works for you.
Thanks,
Kevin
I’m glad to hear it works for you, Randy.
Any question don’t hesitate to let us know.
Thanks,
Troy