Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a shapefile containing streets that have to be counted. But these streets in each case consist of several polylines. Maybe I should buffer these polylines and union the generated polygons that have the same name as well as they overlap. Is there a tool or do I have to write a VBA script or something?

share|improve this question

2 Answers 2

You don't need to worry about buffers or Polygons.

I think the tool you are looking for is called "Dissolve" in the Data Management/Generalization Toolbox. You have to decide whether to use the parameter DISSOLVE_LINE or UNSPLIT_LINES - the latter will only create a single line for contiguous features - i.e. lines that share an endpoint.

Dissolve and its usage, in Arcpy, is thus:

Dissolve Data Management

It effectively aggregates your geographies on specified attributes i.e. in your case, it's name.

The Unsplit lines parameter with two options, DISSOLVE_LINES and UNSPLIT_LINES, only applies to line input. When the default DISSOLVE_LINES option is specified, lines are dissolved into a single feature. When UNSPLIT_LINES is specified, only two lines that have a common endpoint (known as pseudonode) are merged into one continuous line.

I should add that it is very simple to use, either as a standalone script, or as a command in the python window in 10.

EDIT: You might want to have a look at the answer here if you're prepared to use another software package. From what you've told us it looks like arc may not be the best tool to work with your particular dataset.

share|improve this answer
    
First: Thank you for the quick answer! But the problem with this method is (I should have already mentioned that) that there are several streets (which consist of several lines in each case) of the same name in this area. So if they are dissolved with allowed multipart features some streets get lost. Without multipart features it doesn't work in all cases (e.g. when streets are formed like a 'Y'). That's why I mentioned the method with the overlapping buffers. –  Muschter Dec 1 '11 at 14:13
4  
Can't you just use the UNSPLIT_LINES paramater, as detailed above? Then, so long as two different roads with the same name are not next to each other (unlikely), then it should work, with multipart features –  Stev_k Dec 1 '11 at 15:09
2  
Muschter, that problem stems from an inherent flaw in the data: your streets have no unique identifier. Or maybe they do? If you can find a way to disambiguate names, perhaps by means of an additional field (like a zip code perhaps), you're free and clear with Stev_k's solution. If not, then you can still post-process this solution to "explode" each multipart street into its connected components. If the GIS works correctly, that should keep the "Y" branches together but create separate features for separate streets of the same name. –  whuber Dec 1 '11 at 16:30
1  
If you use the UNSPLIT_LINES option, ArcGIS won't connect two streets with the same name unless they share an endpoint. I think this is what you want. The only places this might break down are a) if the ends of the lines don't quite meet or b) if the is an intersection where two streets of the same name cross each other. –  mattwigway Dec 1 '11 at 17:43
    
@ whuber: Firstly: I'm totally with you. You're right with the missing common indentifier. Then it would be very easy. But there's no way to get any. But secondly: The explode tool has the same effect as the dissolve tool without the creating multiparts option. –  Muschter Dec 2 '11 at 10:39

i might be misunderstanding what you need. but if all you need is a count of unique street names, you could maybe use vanilla SQL GROUP BY to aggregate by street name.

like:

select s.street_name, count(*) from streets s group by s.street_name;

of course you'll need a tool that can do SQL against a shapefile/dbf, or put the shapefile/dbf into a DBMS that can do SQL.

Or maybe try Excel - it probably has a function to give you a list of unique values from a column, and a function to count them. You could operate on the shapefile's DBF directly in Excel.

share|improve this answer
    
Thank you very much but unfortunately you misunderstand my problem. There are e.g. 2 streets of the same name with the first consisting of 3 and the second of 4 polylines. The conclusion should be 2 counted streets, not 1 or 7. –  Muschter Dec 2 '11 at 10:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.