Skip to main content
added 49 characters in body
Source Link
chriserik
  • 1.3k
  • 1
  • 8
  • 17

I would do this (relies on network analysis and PostGIS, but should be doable in ArcGIS, too):

  1. relocate the villages and cities to the closest point on the river network line (or create a temporary table for that). In PostGIS, the select query would be something like this:

    SELECT DISTINCT ON (v.gid) v.gid, v.village_id, ST_Line_Interpolate_Point(r.the_geom, ST_Line_Locate_Point(r.the_geom, v.the_geom)) as the_geom FROM rivers as r JOIN villages as v ON ST_DWithin(v.the_geom, r.the_geom, 0.5) ORDER BY v.gid, st_distance(v.the_geom, r.the_geom);

  2. cut your river network at those points (ST_Split() in PostGIS), thus modifiying the topology to include your villages and cities (important for routing).

  3. Now build your network. In PostGIS I would follow underdark's excellent guide at http://underdark.wordpress.com/2011/02/07/a-beginners-guide-to-pgrouting/, I am not sure how this works in ArcGIS though.

  4. Now identify the drain/mouth node(s) of your river network. That could be done either manually (since there are propably only a few ot them) or via a query like this (returns all points of your river network with only one edge - so they must be start/end points if your network - and with an altitude of less than 10 meters above sea level):

    SELECT * FROM (SELECT tmp.id as gid, tmp.count, node.the_geom FROM (SELECT id, count(*) FROM network JOIN node ON (start_id = id OR end_id = id) AND (end_id = id OR start_id = id) GROUP BY id ORDER BY id) as tmp JOIN node ON (tmp.id = node.id) WHERE tmp.count = 1 AND metres_above_sea_level < 10) as start_or_end;

  5. Finally, to determine which villages are below a city, you calculate the shortest path from your drains/mouths to this city (following the river upstream). Then, query for every village which intersects this path. There you have it. If you provide some sample data I could maybe do an implementation.

I would do this (relies on network analysis):

  1. relocate the villages and cities to the closest point on the river network line (or create a temporary table for that). In PostGIS, the select query would be something like this:

    SELECT DISTINCT ON (v.gid) v.gid, v.village_id, ST_Line_Interpolate_Point(r.the_geom, ST_Line_Locate_Point(r.the_geom, v.the_geom)) as the_geom FROM rivers as r JOIN villages as v ON ST_DWithin(v.the_geom, r.the_geom, 0.5) ORDER BY v.gid, st_distance(v.the_geom, r.the_geom);

  2. cut your river network at those points (ST_Split() in PostGIS), thus modifiying the topology to include your villages and cities (important for routing).

  3. Now build your network. In PostGIS I would follow underdark's excellent guide at http://underdark.wordpress.com/2011/02/07/a-beginners-guide-to-pgrouting/, I am not sure how this works in ArcGIS though.

  4. Now identify the drain/mouth node(s) of your river network. That could be done either manually (since there are propably only a few ot them) or via a query like this (returns all points of your river network with only one edge - so they must be start/end points if your network - and with an altitude of less than 10 meters above sea level):

    SELECT * FROM (SELECT tmp.id as gid, tmp.count, node.the_geom FROM (SELECT id, count(*) FROM network JOIN node ON (start_id = id OR end_id = id) AND (end_id = id OR start_id = id) GROUP BY id ORDER BY id) as tmp JOIN node ON (tmp.id = node.id) WHERE tmp.count = 1 AND metres_above_sea_level < 10) as start_or_end;

  5. Finally, to determine which villages are below a city, you calculate the shortest path from your drains/mouths to this city (following the river upstream). Then, query for every village which intersects this path. There you have it. If you provide some sample data I could maybe do an implementation.

I would do this (relies on network analysis and PostGIS, but should be doable in ArcGIS, too):

  1. relocate the villages and cities to the closest point on the river network line (or create a temporary table for that). In PostGIS, the select query would be something like this:

    SELECT DISTINCT ON (v.gid) v.gid, v.village_id, ST_Line_Interpolate_Point(r.the_geom, ST_Line_Locate_Point(r.the_geom, v.the_geom)) as the_geom FROM rivers as r JOIN villages as v ON ST_DWithin(v.the_geom, r.the_geom, 0.5) ORDER BY v.gid, st_distance(v.the_geom, r.the_geom);

  2. cut your river network at those points (ST_Split() in PostGIS), thus modifiying the topology to include your villages and cities (important for routing).

  3. Now build your network. In PostGIS I would follow underdark's excellent guide at http://underdark.wordpress.com/2011/02/07/a-beginners-guide-to-pgrouting/, I am not sure how this works in ArcGIS though.

  4. Now identify the drain/mouth node(s) of your river network. That could be done either manually (since there are propably only a few ot them) or via a query like this (returns all points of your river network with only one edge - so they must be start/end points if your network - and with an altitude of less than 10 meters above sea level):

    SELECT * FROM (SELECT tmp.id as gid, tmp.count, node.the_geom FROM (SELECT id, count(*) FROM network JOIN node ON (start_id = id OR end_id = id) AND (end_id = id OR start_id = id) GROUP BY id ORDER BY id) as tmp JOIN node ON (tmp.id = node.id) WHERE tmp.count = 1 AND metres_above_sea_level < 10) as start_or_end;

  5. Finally, to determine which villages are below a city, you calculate the shortest path from your drains/mouths to this city (following the river upstream). Then, query for every village which intersects this path. There you have it. If you provide some sample data I could maybe do an implementation.

added 12 characters in body
Source Link
chriserik
  • 1.3k
  • 1
  • 8
  • 17

I would do this (relies on network analysis):

  1. relocate the villages and cities to the closest point on the river network line (or create a temporary table for that). In PostGIS, the select query would be something like this:

    SELECT DISTINCT ON (v.gid) v.gid, v.village_id, ST_Line_Interpolate_Point(r.the_geom, ST_Line_Locate_Point(r.the_geom, v.the_geom)) as the_geom FROM rivers as r JOIN villages as v ON ST_DWithin(v.the_geom, r.the_geom, 0.5) ORDER BY v.gid, st_distance(v.the_geom, r.the_geom);

  2. cut your river network at those points (ST_Split() in PostGIS), thus modifiying the topology to include your villages and cities (important for routing).

  3. Now build your network. In PostGIS I would follow underdark's excellent guide at http://underdark.wordpress.com/2011/02/07/a-beginners-guide-to-pgrouting/, I am not sure how this works in ArcGIS though.

  4. Now identify the drain/mouth node(s) of your river network. That could be done either manually (since there are propably only a few ot them) or via a query like this (returns all points of your river network with only one edge - so they must be start/end points if your network - and with an altitude of less than 10 meters above sea level):

    SELECT * FROM (SELECT tmp.id as gid, tmp.count, node.the_geom FROM (SELECT id, count(*) FROM network JOIN node ON (start_id = id OR end_id = id) AND (end_id = id OR start_id = id) GROUP BY id ORDER BY id) as tmp JOIN node ON (tmp.id = node.id) WHERE tmp.count = 1 AND metres_above_sea_level < 10) as start_or_end;

  5. Finally, to determine which villages are below a city, you calculate the shortest path from your drains/mouths to this city (following the river upstream). Then, query for every village which intersects this path. There you have it. If you provide some sample data I could maybe do an implementation.

I would do this (relies on network analysis):

  1. relocate the villages and cities to the closest point on the river network line (or create a temporary table for that). In PostGIS, the select query would be something like this:

    SELECT DISTINCT ON (v.gid) v.gid, v.village_id, ST_Line_Interpolate_Point(r.the_geom, ST_Line_Locate_Point(r.the_geom, v.the_geom)) FROM rivers as r JOIN villages as v ON ST_DWithin(v.the_geom, r.the_geom, 0.5) ORDER BY v.gid, st_distance(v.the_geom, r.the_geom);

  2. cut your river network at those points (ST_Split() in PostGIS), thus modifiying the topology to include your villages and cities (important for routing).

  3. Now build your network. In PostGIS I would follow underdark's excellent guide at http://underdark.wordpress.com/2011/02/07/a-beginners-guide-to-pgrouting/, I am not sure how this works in ArcGIS though.

  4. Now identify the drain/mouth node(s) of your river network. That could be done either manually (since there are propably only a few ot them) or via a query like this (returns all points of your river network with only one edge - so they must be start/end points if your network - and with an altitude of less than 10 meters above sea level):

    SELECT * FROM (SELECT tmp.id as gid, tmp.count, node.the_geom FROM (SELECT id, count(*) FROM network JOIN node ON (start_id = id OR end_id = id) AND (end_id = id OR start_id = id) GROUP BY id ORDER BY id) as tmp JOIN node ON (tmp.id = node.id) WHERE tmp.count = 1 AND metres_above_sea_level < 10) as start_or_end;

  5. Finally, to determine which villages are below a city, you calculate the shortest path from your drains/mouths to this city (following the river upstream). Then, query for every village which intersects this path. There you have it. If you provide some sample data I could maybe do an implementation.

I would do this (relies on network analysis):

  1. relocate the villages and cities to the closest point on the river network line (or create a temporary table for that). In PostGIS, the select query would be something like this:

    SELECT DISTINCT ON (v.gid) v.gid, v.village_id, ST_Line_Interpolate_Point(r.the_geom, ST_Line_Locate_Point(r.the_geom, v.the_geom)) as the_geom FROM rivers as r JOIN villages as v ON ST_DWithin(v.the_geom, r.the_geom, 0.5) ORDER BY v.gid, st_distance(v.the_geom, r.the_geom);

  2. cut your river network at those points (ST_Split() in PostGIS), thus modifiying the topology to include your villages and cities (important for routing).

  3. Now build your network. In PostGIS I would follow underdark's excellent guide at http://underdark.wordpress.com/2011/02/07/a-beginners-guide-to-pgrouting/, I am not sure how this works in ArcGIS though.

  4. Now identify the drain/mouth node(s) of your river network. That could be done either manually (since there are propably only a few ot them) or via a query like this (returns all points of your river network with only one edge - so they must be start/end points if your network - and with an altitude of less than 10 meters above sea level):

    SELECT * FROM (SELECT tmp.id as gid, tmp.count, node.the_geom FROM (SELECT id, count(*) FROM network JOIN node ON (start_id = id OR end_id = id) AND (end_id = id OR start_id = id) GROUP BY id ORDER BY id) as tmp JOIN node ON (tmp.id = node.id) WHERE tmp.count = 1 AND metres_above_sea_level < 10) as start_or_end;

  5. Finally, to determine which villages are below a city, you calculate the shortest path from your drains/mouths to this city (following the river upstream). Then, query for every village which intersects this path. There you have it. If you provide some sample data I could maybe do an implementation.

Source Link
chriserik
  • 1.3k
  • 1
  • 8
  • 17

I would do this (relies on network analysis):

  1. relocate the villages and cities to the closest point on the river network line (or create a temporary table for that). In PostGIS, the select query would be something like this:

    SELECT DISTINCT ON (v.gid) v.gid, v.village_id, ST_Line_Interpolate_Point(r.the_geom, ST_Line_Locate_Point(r.the_geom, v.the_geom)) FROM rivers as r JOIN villages as v ON ST_DWithin(v.the_geom, r.the_geom, 0.5) ORDER BY v.gid, st_distance(v.the_geom, r.the_geom);

  2. cut your river network at those points (ST_Split() in PostGIS), thus modifiying the topology to include your villages and cities (important for routing).

  3. Now build your network. In PostGIS I would follow underdark's excellent guide at http://underdark.wordpress.com/2011/02/07/a-beginners-guide-to-pgrouting/, I am not sure how this works in ArcGIS though.

  4. Now identify the drain/mouth node(s) of your river network. That could be done either manually (since there are propably only a few ot them) or via a query like this (returns all points of your river network with only one edge - so they must be start/end points if your network - and with an altitude of less than 10 meters above sea level):

    SELECT * FROM (SELECT tmp.id as gid, tmp.count, node.the_geom FROM (SELECT id, count(*) FROM network JOIN node ON (start_id = id OR end_id = id) AND (end_id = id OR start_id = id) GROUP BY id ORDER BY id) as tmp JOIN node ON (tmp.id = node.id) WHERE tmp.count = 1 AND metres_above_sea_level < 10) as start_or_end;

  5. Finally, to determine which villages are below a city, you calculate the shortest path from your drains/mouths to this city (following the river upstream). Then, query for every village which intersects this path. There you have it. If you provide some sample data I could maybe do an implementation.