Hi
there was a few details in the tcl script I send yesteday that was missing,
I have adede a new and corected version in this mail
Peter
>From: "peter laulund" <[EMAIL PROTECTED]>
>Reply-To: [email protected]
>To: [email protected]
>Subject: RE: [fme] Re: Bright ideas required
>Date: Mon, 05 Feb 2007 16:20:49 +0000
>
>Hi
>
>attatched a zipfile with a small mapping file / tcl scritp illustrating how
>you can do this
>
>there is still a lot off problems with the script but it gives an idear on
>how you can manipulate geoemtrys using tcl
>
>peter
>
>
> >From: "peter laulund" <[EMAIL PROTECTED]>
> >Reply-To: [email protected]
> >To: [email protected]
> >Subject: RE: [fme] Re: Bright ideas required
> >Date: Fri, 02 Feb 2007 21:46:44 +0000
> >
> >Hi
> >
> >It is some quite tricky quistiosn this weekend but , as alvays, tcl is
>the
> >answer
> >
> >with tcl it is quite simpel to convert the geoemtry into perfect
> >rectangels,
> >take a look at my chess program from the user conferance -
> >http://www.safe.com/company/fmeuc2006/index.php - to see how you can
> >manipulate geoemtrys with tcl
> >
> >the problem is to determin the centerpoint, size, and rotation but again
> >with tcl you can probbaly calculate som values
> >
> >Peter
> >
> >
> > >From: "mark2atsafe" <[EMAIL PROTECTED]>
> > >Reply-To: [email protected]
> > >To: [email protected]
> > >Subject: [fme] Re: Bright ideas required
> > >Date: Fri, 02 Feb 2007 20:56:41 -0000
> > >
> > >Hi Roland,
> > >I'll have a think... but in general Smoother transformers keep all the
> > >existing points and just re-arrange them into a nicer position. The
> > >generalizer is the one that will remove points. LineGeneralizer
> > >appears to give you more options than AreaGeneralizer; the Deveau
> > >algorithm looking the better one to try (the help states it removes
> > >points that don't add to the overall shape). Having said that it
> > >appears to be more useful for removing spikes than point thinning.
> > >
> > >If you're determined to create your own cleaner then my lateral
> > >thinking is...
> > >
> > >1) Drop the feature into points (Chopper)
> > >2) Calculate the angle at each point
> > >3) If the angle is 180 degrees (+/- a degree or two) then you know it
> > >is a mid-line coordinate and you can ignore it (Tester)
> > >4) Rebuild the feature from remaining points (PointConnector)
> > >
> > >Dmitri's PolylineAnalyzer transformer on fmepedia should help to
> > >calculate angles and bearings making the job way simpler.
> > >
> > >http://www.fmepedia.com/index.php/PolylineAnalyzer
> > >
> > >Hope this helps
> > >
> > >Mark
> > >
> > >Mark Ireland, Senior Product Specialist
> > >Safe Software Inc. Surrey, BC, CANADA
> > >[EMAIL PROTECTED] http://www.safe.com
> > >Solutions for Spatial Data Translation, Distribution and Access
> > >
> > >--- In [email protected], "Roland Martin" <[EMAIL PROTECTED]>
>wrote:
> > > >
> > > > Hi everyone,
> > > >
> > > > This is a bit of a tricky one...
> > > >
> > > > I need to convert some buildings (9-10 vertices apiece) to perfect
> > > > rectangles (in FME terms, 5 vertices), with 90 degree (or as near as
> > >makes
> > > > no odds) corners. I will then need to extract the vertices, but that
> > >I can
> > > > do... Any ideas?
> > > >
> > > > Unfortunately all the corners on the buildings are pretty much 90
> > >degrees,
> > > > so all the simplifying procedures seem to be fairly indiscriminate
> >about
> > > > which vertices to remove. I'm not overly familiar with what the
> > >different
> > > > tools (AreaGeneralizer; AreaSmoother; etc.) do, and what affect the
> > >specific
> > > > settings have, so I may have missed something here...
> > > >
> > > > Alternatively I'm going down the traditional FME "lateral thinking"
> > >route,
> > > > and contemplating the following:
> > > > - Run house through CentreLineReplacer
> > > > - Duplicate centreline, and rotate by 180 degrees or some such
> > > >
> > > > Trouble is, if the building isn't exactly square I don't think this
> >will
> > > > work.
> > > >
> > > > Or... maybe do something with a BoundingBoxReplacer? Except they
> > >don't all
> > > > face North!
> > > >
> > > > The obvious question is where the rectangle should fall - fully
> > >inside the
> > > > building; fully outside; or somewhere inbetween? Probably ideally
> > >somewhere
> > > > inbetween... Most of the buildings have three straight edges and one
> > >with
> > > > indentations, but some of them are more complex shapes.
> > > >
> > > > Maybe I should pack it all in, and digitise them instead!!!
> > > >
> > > > Does anyone have any bright ideas? Any help would be gratefully
> > >received!
> > > >
> > > > Cheers,
> > > > Roland.
> > > >
> > >
> > >
> >
> >_________________________________________________________________
> >Opret en personlig blog og del dine billeder på MSN Spaces:
> >http://spaces.msn.dk
> >
>
>_________________________________________________________________
>Log på MSN Messenger direkte på nettet http://webmessenger.msn.com/
><< BYGNING.zip >>
_________________________________________________________________
Få de bedste søgeresultater med MSN Search: http://search.msn.dk
For insights into what's up at Safe Software and what's on the development
horizon, visit Safe's blog at spatial-etl.blogspot.com.
Safe Software has also made slides available that outline enhancements planned
for FME 2007. The slides are from the "Road Ahead" presentation given on Day 2
of the FME Worldwide Users Conference. To view these slides, visit
www.safe.com/2006uc.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/fme/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/fme/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
set comment {
==============================================================================
Navn : Peter Laulund, KMS
Oprettet dato : 05 februar 2007 - 16:32
Beskrivelse :
==============================================================================
} ; unset comment
#
=============================================================================
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
namespace eval geom {
variable navn ""
variable version "1.0"
variable dato ""
#puts "$navn Version $version d. $dato"
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
proc geom::conver2rect {} {
#FME_Execute ConvertToLine CLASSIC 0.1
FME_Execute RemoveAttributes fme_regexp_match mapinfo_
set ax [expr {[ FME_Coordinates getCoord x 1 ] - [ FME_Coordinates
getCoord x 0 ]}]
set ay [expr {[ FME_Coordinates getCoord y 1 ] - [ FME_Coordinates
getCoord y 0 ]}]
set a [expr {90 - ( atan2($ax, $ay) * 57 )} ] ;# puts $a
FME_Execute Bounds x1 x2 y1 y2
set dx [expr {0.4 * ([ FME_GetAttribute x2 ] - [ FME_GetAttribute x1 ]
)} ]
set dy [expr {0.4 * ([ FME_GetAttribute y2 ] - [ FME_GetAttribute y1 ]
)} ]
set dxy [ expr { round ( ( $dx > $dy ) ? $dx : $dy )} ] ; # puts $dxy
FME_Execute ConvertToPoint CENTER_OF_GRAVITY
set cx [ FME_Coordinates getCoord x 0 ]
set cy [ FME_Coordinates getCoord y 0 ]
FME_Coordinates resetCoords
FME_Coordinates addCoord [ expr { $cx - $dxy }] [ expr { $cy - $dxy }]
FME_Coordinates addCoord [ expr { $cx - $dxy }] [ expr { $cy + $dxy }]
FME_Coordinates addCoord [ expr { $cx + $dxy }] [ expr { $cy + $dxy }]
FME_Coordinates addCoord [ expr { $cx + $dxy }] [ expr { $cy - $dxy }]
FME_Coordinates addCoord [ expr { $cx - $dxy }] [ expr { $cy - $dxy }]
FME_Coordinates geomType fme_polygon
FME_SetAttribute fme_type fme_area
FME_SetAttribute fme_color "1.0,0.0,0.0"
FME_SetAttribute fme_fill_color "1.0,0.0,0.0"
FME_Execute Rotate2D $a $cx $cy
FME_UnsetAttributes x1 x2 y1 y2
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
#
=============================================================================