Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Extract specific strings (more than one) into new fields

$
0
0
Hello:

I want to extract strings from a field called "other_tags" using the field calculator.
"other_tags" has a lot of unused information and the sting part that I want to extract is always located at a different position. Here some examples of the field "other_tags":


"lit"=>"yes","maxspeed"=>"50","oneway"=>"yes","ref"=>"B 6","voltage"=>"110000"
"voltage"=>"110000"
"lit"=>"yes","voltage"=>"110000"
"lanes"=>"2","oneway"=>"yes","ref"=>"B 6","voltage"=>"110000"

Always when the string " "voltage"=>" " accures the subsequent number should be written in a new field. Lets call the new field "Result1". It is also possible that the stirng " "voltage"=>" " existes 2,3 or 4 times in a single string so somehow i would have to write the second/third and fourth value in other fields. Lets call them "Result2", "Result3 and "Result4".

There was a similar thread wich didnt really help me further because my data in the field is not structured that way. But maybe it representes some productive food for thought:
http://forums.arcgis.com/threads/451...r-using-python
Also I have the same problem then the auditor of that thread that the code he was using does not work with field calculator!? Even when my source field is a sting type just as the target field.

From my point of view it seams to be a bretty complex topic for someone like me whose python experience is very small - So I am glad for any kind of help!!!

Viewing all articles
Browse latest Browse all 2485

Trending Articles