Jump to content

extract road names from shape file


Recommended Posts

attached is a sample file. if you select a road and view the data pane you will see that all the roads have been given names. you need to scroll down a bit.

now, i want to see those names pasted in my drawing next to my road. so i cut & paste, but can a script be written that can do the cut and paste for me?

in other words, i select all the roads and then run the script and all the roads in my drawing have the road names next to them for me to then rotate/align w/ the road.

how hard is this?

Link to comment

Try this:

PROCEDURE ExtractAttribute; { ? Petri Sakkinen 1995 - 2009 } 

CONST 
rName = 'Emergency_rds_lineRec'; 
attr = 'Street'; 

VAR 
strData : STRING; 
x, y, dist, rotA : REAL; 
tangent, location : VECTOR; 
ok : BOOLEAN; 
obHd : HANDLE; 

BEGIN 
obHd := LSACTLAYER; 
WHILE NOT(obHd=NIL) DO BEGIN 
	strData := GETRFIELD(obHd, rName, attr); 
	dist := HPERIM(obHd)/2; 
	ok := POINTALONGPOLY(obHd, dist, location, tangent); 
	x := location.x; 
	y := location.y; 
	rotA := VEC2ANG(tangent); 
	TEXTORIGIN(x, y); 
	CREATETEXT(strData); 
	HROTATE(LNEWOBJ, x, y, rotA);
	obHd := PREVSOBJ(obHd); 
END; 
END; 

RUN(ExtractAttribute); 

Set default text attributes to your liking before running it.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...