ThinkGeo.com    |     Documentation    |     Premium Support

Update DBF

Hello,

I would like to know if it possible to automatically add two columns in the database of my shape file containing the name of the intersecting streets.
In my shape I just have the ST_NAME column with the street name, and I would like to make a project that find the intersecting streets of all features and generate a new dbf with two new column called ST_NAME_1 and ST_NAME_2.

Since my English is not so well I’ve attached an image explaining what I would need.

Thank you very much.
Best Regards,

Leandro

Sorry, I didn't attached the file, here it is.


 




Yes, that can be done. Map Suite offers all the tools for accomplishing this such as shapefile editing for adding new columns and spatial querying for finding intersecting streets. I think this would be a good idea for a Code Community project also. But one caveat; there can be more than two intersecting streets. How would you like to handle that case?

Hello Val,


To be honest, I didn’t think of it, you are talking about cases in which a corner has 3, 4 or 5 streets, like in the example below? In such cases it would be great instead of add two columns called ST_NAME_1 and ST_NAME_2 like I said before; add all necessary columns called INTERSECTING_1, INTERSECTING_2, INTERSECTING_3, ETC. But for my project I don’t care if I just listed 2 intersecting since Street A Between Street B and Street C, it’s going to be the same that Street A Between Street D and Street C, or even that Street A Between Street D and Street B which is the worst combination.



Leandro,


Actullay, the multiple intersectings are prevalent, for example, I search any streets on the google maps, it always has multiple intersectings, please see the case below:



Even, I think one street has more than 10 intersectings, I think maybe you can build your own custom data to store the intersecting information and the custom data can add field dynamically.


Thanks,


Scott,



Hello Scott,


For the case you are pointing, the intersecting streets are always two, please see the image below and let me know if I’m wrong.



 



Leandro,


Thanks for your reply,


I understand your mean fully, maybe at first I misunderstood anything, in your case above, the NW Ave G street was seperate to many segments, that's right, we seperate the street according to the street number, so the table should be this:



You can see in the ST_NAME field, we need to record the street name with street number so that we can identify the special street segement.


If you have any other questions please let me know,


Thanks,


Scott,



Hello Scott, 
  
 Thank you for your answer, remember that my English is not so well, so I understand that is possible to do this. If it is possible, let start again, Could you help me with a sample code to do this automatically? 
 Best regards, 
  
 Leandro

Sorry for the delay. You should have an answer tomorrow morning. Thank you.

Hello Val, no problem, thank you for the update.

Leandro, 


Here is the general way how to get it.
 
1, Get the intersecting Roads. For example, we want to get the intersecting roads for Road A, if both the green one and the red one are all intersecting roads, we can call
            layer.QueryTools.GetFeaturesIntersecting(RoadA, "ST_NAME");
 
If we just want to get the green roads, we need to call the following 2 methods
            layer.QueryTools.GetFeaturesIntersecting(PointM, new string[] { "ST_NAME" });
          layer.QueryTools.GetFeaturesIntersecting(PointN, new string[] { "ST_NAME" });
                   
From the returned features, we can get the Name of the intersecting roads.
 
2, Add the features to DBF.
            For now, we don’t have APIs to directly modify a dbf. But in the upcoming May 1st release, we will expose APIs to directly modify it, you can then accomplish it with that version.  Generally, you need to create a new DBF, add the new 2 columns “ST_NAME_1” and “ST_NAME_2”, and copy the original data as well as the intersecting road names to the new Dbf.  We don’t have an API to directly add a column to DBF, here in the following post we talked about the reason. Please have a look if you are interested.
 
gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/21/aft/7348/afv/topic/afpgj/1/Default.aspx#16197
 
Let us know if you have any issues.
 
Thanks,
 
Ben

Hello Ben, 
  
 Thank you for the example, I will wait the new upcoming release and let you know if I have any issues. 
 Best Regards, 
  
 Leandro 


Leandro,  
  
 That’s my pleasure. Just let us know for any problems.  
  
 Thanks, 
  
 Ben