<div dir="ltr"><span class="im"><div><div><div>hello Mikhail Gusev , <br><br></div><div>Is it correct to do this way?First I will save point layer using start and end points of line  layer.Again then connect the two layers using autoconnect method . So that I can find shortest path between features of the line layer.<br></div></div><div> <br></div>thanks,<br></div>hema</span></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 12, 2014 at 3:03 PM, Михаил Гусев [via OSGeo.org] <span dir="ltr"><<a href="/user/SendEmail.jtp?type=node&node=5172529&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>></span> wrote:<br><blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

        <div dir="ltr"><span class=""><blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' style="border-left:2px solid #cccccc;padding:0 1em" class="gmail_quote">The algorithm is using only the features that are connected manually and that are present in _gnm_graph.</blockquote><div><br></div></span><div><span class="">No, if you use automatic connection the  _gnm_graph is also formed automatically because it internally calls ConnectFeatures().<br><br></span><span class=""><blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' style="border-left:2px solid #cccccc;padding:0 1em" class="gmail_quote">Is there any other simple solution to solve this.<br></blockquote><div><br></div></span><span class=""><div>It is no other solution for now to solve this. I think in the nearest future the new algorithm of automatic connection can be written (which regards only line layers and determines the start and end point of the lines automatically), I'm working on this now. <br></div></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-11-11 14:48 GMT+04:00 Hema Yeedunuri <span dir="ltr"><<a href="http://user/SendEmail.jtp?type=node&node=5172509&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>></span>:<br><blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' style="border-left:2px solid #cccccc;padding:0 1em" class="gmail_quote"><span class=""><div dir="ltr"><div><div><div>hello Mikhail Gusev , <br><br></div>Thank u for the reply .I want to find  the shortest distance between features .But the road layer I am using is having 10055 features. without creating graph it is not possible to find shortest distance.And to my understanding I think it is difficult to manually connect features to create graph. The algorithm is using only the features that are connected manually and that are present in _gnm_graph.dbf file.Is there any other simple solution to solve this.<br></div><div> <br></div>thanks,<br></div>hema<br></div></span><div><div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Tue, Nov 11, 2014 at 3:59 PM, Mikhail Gusev <span dir="ltr"><<a href="http://user/SendEmail.jtp?type=node&node=5172509&i=1" rel="nofollow" link="external" target="_blank">[hidden email]</a>></span> wrote:<br></span><blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' style="border-left:2px solid #cccccc;padding:0 1em" class="gmail_quote"><span class=""><div dir="ltr"><div><div>Hello, hema.<br></div>The current default implementation of GNMNetwork::AutoConnect() can work only if the passing array of layers contains at least one point and one line layer (i.e. GetGeomType() for the layers equals wkbPoint and wkbLineString accordingly). For each line feature the algorithm takes the start and end snapping area formed around the start and end point of the line and searches the points from point layers which are situated inside these two areas. So there is no way for now to connect features of only one line layer automatically. You can use ConnectFeatures() to connect manually, but you will need the features (with any geometry!) to be the source and the target for the connection, while the gnm_roads_line feature will be the connector.<br></div></div></span><div class="gmail_extra"><br><div class="gmail_quote"><div><div>2014-11-11 11:26 GMT+04:00 yhema <span dir="ltr"><<a href="http://user/SendEmail.jtp?type=node&node=5172509&i=2" rel="nofollow" link="external" target="_blank">[hidden email]</a>></span>:<br></div></div><blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' style="border-left:2px solid #cccccc;padding:0 1em" class="gmail_quote"><div><div class="h5"><div><div>Hello all,<br>
<br>
I am trying to create a graph for network analysis using gdalgnm.The feature<br>
auto connect is working if we provide more than one layer.How can we connect<br>
features of a single layer so that graph is created automatically. We can<br>
connect features using connect features but automatically it is not<br>
conncting using auto connect .Here is the code.<br>
<br>
 char **options = NULL;<br>
    options = CSLAddNameValue(options,GNM_INIT_OPTIONPAIR_NAME,<br>
"roads_network");<br>
<br>
<br>
    GNMGdalNetwork *poNet;<br>
<br>
    poNet =<br>
GNMManager::GdalCreateNetwork("/home/shiva/Desktop/network/network_data",<br>
"ESRI Shapefile", "EPSG:4326", options);<br>
    CSLDestroy(options);<br>
    if (poNet == NULL)<br>
    {<br>
        printf("Failed to create network\n");<br>
        exit(1);<br>
    }<br>
<br>
    GDALDataset *poSrcDS = (GDALDataset*)<br>
GDALOpenEx("/home/shiva/Desktop/network/data",<br>
                                                     GDAL_OF_VECTOR |<br>
GDAL_OF_READONLY, NULL, NULL, NULL );<br>
    if(poSrcDS == NULL)<br>
    {<br>
        printf("Can not open source dataset at\n");<br>
        exit(1);<br>
    }<br>
<br>
    OGRLayer *poSrcLayer2 = poSrcDS->GetLayerByName("roads");<br>
    if (poSrcLayer2 == NULL)<br>
    {<br>
        printf("layer is null\n");<br>
        printf("Can not process layers of source dataset\n");<br>
        exit(1);<br>
    }<br>
<br>
    GNMErr err2 = poNet->CopyLayer(poSrcLayer2, "roads");<br>
    if (err2 != GNMERR_NONE)<br>
    {<br>
        printf("Can not import layers from source dataset\n");<br>
        exit(1);<br>
    }<br>
<br>
    GDALClose(poSrcDS);<br>
<br>
<br>
    if (poNet->CreateRule("CLASS gnm_roads_line COSTS TIGER_ID") !=<br>
GNMERR_NONE)<br>
    {<br>
        printf("Can not create rule\n");<br>
    }<br>
<br>
    if (poNet->CreateRule("NETWORK CONNECTS gnm_roads_line WITH<br>
gnm_roads_line  ") != GNMERR_NONE)<br>
    {<br>
        printf("Can not create rule\n");<br>
    }<br>
<br>
<br>
    printf("\nBuilding network topology ...\n");<br>
    GDALDataset *poNetDS = poNet->GetDataset();<br>
    OGRLayer **layers = new OGRLayer*[3];<br>
<br>
    layers[0] = poNetDS->GetLayerByName("gnm_roads_line");<br>
    layers[2] = NULL;<br>
    layers[1] = NULL;<br>
<br>
<br>
    if (poNet->AutoConnect(layers,0.05, NULL) != GNMERR_NONE)<br>
    {<br>
        printf("Building topology failed\n");<br>
        exit(1);<br>
    }<br>
    else<br>
    {<br>
        printf("Topology has been built successfully\n");<br>
    }<br>
<br>
    delete[] layers;<br>
<br>
<br>
        GNMManager::GdalCloseNetwork(poNet);<br>
<br>
<br>
<br>
<br>
thanks,<br>
hema<br>
<br>
<br>
<br></div></div></div></div><span><font color="#888888"><div><div class="h5">
--<br>
View this message in context: <a href="http://osgeo-org.1560.x6.nabble.com/creating-graph-for-single-line-shape-layer-using-gdal-gnm-tp5172326.html" rel="nofollow" link="external" target="_blank">http://osgeo-org.1560.x6.nabble.com/creating-graph-for-single-line-shape-layer-using-gdal-gnm-tp5172326.html</a><br>
Sent from the GDAL - Dev mailing list archive at Nabble.com.<br>
_______________________________________________<br>
gdal-dev mailing list<br>
</div></div><a href="http://user/SendEmail.jtp?type=node&node=5172509&i=3" rel="nofollow" link="external" target="_blank">[hidden email]</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="nofollow" link="external" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</font></span></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div><span class="">
<br>_______________________________________________
<br>gdal-dev mailing list
<br><a href="http://user/SendEmail.jtp?type=node&node=5172509&i=4" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br><a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="nofollow" link="external" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a>

        
        
        
        <br>
        <br>
        <hr color="#cccccc" noshade size="1">
        </span><div style="color:#444;font:12px tahoma,geneva,helvetica,arial,sans-serif"><span class="">
                <div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
                </span><a href="http://osgeo-org.1560.x6.nabble.com/creating-graph-for-single-line-shape-layer-using-gdal-gnm-tp5172326p5172509.html" target="_blank" rel="nofollow" link="external">http://osgeo-org.1560.x6.nabble.com/creating-graph-for-single-line-shape-layer-using-gdal-gnm-tp5172326p5172509.html</a>
        </div><div class="HOEnZb"><div class="h5">
        <div style="color:#666;font:11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
                
                To unsubscribe from creating graph for single line shape layer using gdal gnm, <a href="" target="_blank" rel="nofollow" link="external">click here</a>.<br>
                <a href="http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" target="_blank" link="external">NAML</a>
        </div></div></div></blockquote></div><br></div>


        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://osgeo-org.1560.x6.nabble.com/creating-graph-for-single-line-shape-layer-using-gdal-gnm-tp5172326p5172529.html">Re: creating graph for single line shape layer using gdal gnm</a><br/>
Sent from the <a href="http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html">GDAL - Dev mailing list archive</a> at Nabble.com.<br/>