Minimal distance

Dear All,

Is there a methode in MapWinGIS to calculate the minimal distance between two points based on a road network Table (PostGIS)?

Hello @Ismail7, and welcome.

It sounds like you’re asking about a street routing solution. I’m sorry, but the answer’s no, that is not built-in to MapWinGIS.

I’ve personally used the Itinero open-source library, which can generate routes using Shapefiles, but it is not trivial.

Since you’re using PostGIS, you might look into (perhaps you already have) the pgRouting library, which is built around PostGIS.

Regards,
Jerry.

Hello @jerryfaust, and thank you for your response

Currently I’m working on developing a desktop application that calculate the minimal distance between two point, my network data is stored in PostGIS database.

I already installed the PgRouting library and all the functions work perfectly inside PostgreSQL using PostGIS/PgRouting extensions. Here is an example of the request to get the minimal distance using Dijkstra’s algorithm:

SELECT cost

FROM pgr_dijkstra(‘SELECT id, source, target, st_length(the_geom) as cost FROM network’,165, 2, false)

The problem is when I try to use the functions inside a third-party Windows development environment it doesn’t work. That’s why I am looking for an Activex or an API that can allow me to use the functions inside the environment I am working in.

Sincerely,

Ismail.

Ok. Well the MapWinGIS OCX uses the GDAL library for data access, and there is a PostGIS driver, so hopefully you can do what you want.

You can review our online help. You will want to use an OGRDatasource to add OGRLayers. There’s an overview HERE.

I may be able to provide some direction as you go down this path. Let us know.

Regards,
Jerry.