# ShapeNetwork class example

**URL:** <https://mapwindow.discourse.group/t/shapenetwork-class-example/120>\
**Category:** MapWinGIS\
**Created:** [April 8, 2019, 6:46am UTC](https://mapwindow.discourse.group/t/shapenetwork-class-example/120 "2019-04-08T06:46:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![george](https://avatars.discourse-cdn.com/v4/letter/g/71e660/32.png) [@george](https://mapwindow.discourse.group/u/george)\
**Post date:** [April 8, 2019, 6:46am UTC](https://mapwindow.discourse.group/t/shapenetwork-class-example/120/1 "2019-04-08T06:46:31Z")

</div>

Hello,  
I am looking for the same feature as the topic recently posted: [path planning](https://mapwindow.discourse.group/t/how-to-implement-path-planning/111).  
Paul suggested that [ShapeNetwork class](https://www.mapwindow.org/documentation/mapwingis4.9/class_shape_network.html#ac5876331056ab637daf3838bd4bc0a0f) is still available in MapWinGIS, but there is no certainty if it is still working.  
@pmeems, is there some old example that I can follow, in order to test its working?  
Thank you.

---

<div class="post-metadata">

**Author:** ![pmeems](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/pmeems/32/9_2.png) [@pmeems](https://mapwindow.discourse.group/u/pmeems)\
**Post date:** [April 8, 2019, 7:32am UTC](https://mapwindow.discourse.group/t/shapenetwork-class-example/120/2 "2019-04-08T07:32:07Z")

</div>

I don’t have any example code. And I can’t remember I’ve seen any (and I’m over a decade with this project 😉 )

All I have is the API description:

> A shape network is created from the shapes in a polyline shapefile which allows you to traverse the shapefile simulating water flowing in a watershed to a single outlet. To create a shape network from a polyline shapefile, first choose an outlet shape from the shapes in the shapefile. Next, choose an outlet point within the specified outlet shape. Finally, you need to select a tolerance value. The tolerance is used to determine whether to include a shape in the shape network if it is not connected to the network. Using this starting criteria, a shape network can be created from the polyline shapefile.

---

<div class="post-metadata">

**Author:** ![george](https://avatars.discourse-cdn.com/v4/letter/g/71e660/32.png) [@george](https://mapwindow.discourse.group/u/george)\
**Post date:** [April 8, 2019, 8:28am UTC](https://mapwindow.discourse.group/t/shapenetwork-class-example/120/3 "2019-04-08T08:28:15Z")

</div>

Thank you Paul.  
I googled and found an [old MapWinGIS manual from 2007](http://read.pudn.com/downloads152/ebook/662579/MapWinGIS%20Reference%20Manual.pdf), which shows this VBdotNET example code:

> Private Sub BuildNetwork()  
> Dim sf As New MapWinGIS.Shapefile()  
> Dim shapenetwork As New MapWinGIS.ShapeNetwork()  
> Dim result As Integer, hndl As Integer  
> 'Open a line shapefile  
> sf.Open(“C:\test.shp”)  
> 'Build a shape network from the shapefile using shape 0 as the outlet shape and point 0 in shape 0 as the outlet point  
> result = shapenetwork.Build(sf, 0, 0, 10, MapWinGIS.AmbiguityResolution.DISTANCE\_TO\_OUTLET)  
> End Sub

But that does not seem to be enough.  
Anyhow, thank you for the effort.

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [April 8, 2019, 6:48pm UTC](https://mapwindow.discourse.group/t/shapenetwork-class-example/120/4 "2019-04-08T18:48:54Z")

</div>

Hello all (@george, @pmeems).

I looked into this only a little, but my take on it was that it was designed for a specific purpose, and that purpose would not satisfy street routing problems; for instance,

- rather than a distinct outlet point, it is necessary to specify specific starting and ending points (and sometimes intermediate points, as in the TSP)
- you have to be able to deal with one-way streets, temporarily closed roads, and speed limits

Because of the various complexities, I decided not to try re-inventing that wheel in our code, but rather to use an external library. As mentioned previously, there are various options out there, depending on your use cases and constraints (e.g. self-contained vs web service, shapefiles vs Open Street Maps, etc.)

Regards.  
Jerry.

---

<div class="post-metadata">

**Author:** ![george](https://avatars.discourse-cdn.com/v4/letter/g/71e660/32.png) [@george](https://mapwindow.discourse.group/u/george)\
**Post date:** [April 8, 2019, 7:40pm UTC](https://mapwindow.discourse.group/t/shapenetwork-class-example/120/5 "2019-04-08T19:40:58Z")

</div>

Thank you for sharing your experiences @jerryfaust!  
I will will follow your topic, in order not to contaminate this one.

---

<div class="post-metadata">

**Author:** ![Jackson](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@Jackson](https://mapwindow.discourse.group/u/Jackson)\
**Post date:** [April 9, 2019, 8:15am UTC](https://mapwindow.discourse.group/t/shapenetwork-class-example/120/6 "2019-04-09T08:15:19Z")

</div>

I’m watching this too!If you implement it, I hope you can give me some Suggestions!

Thank you very much!

---

<div class="post-metadata">

**Author:** ![pmeems](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/pmeems/32/9_2.png) [@pmeems](https://mapwindow.discourse.group/u/pmeems)\
**Post date:** [May 11, 2019, 1:12pm UTC](https://mapwindow.discourse.group/t/shapenetwork-class-example/120/7 "2019-05-11T13:12:22Z")

</div>

Closed on May 11, 2019, 1:12pm UTC


