[Geomedia-l] WEBMAP PRO finding the nearest line

Rui Lima eng.ruilima at gmail.com
Thu Jan 4 12:27:08 CST 2007


Nguyen Quoc Toan,
I've created the following function to return the objects that are contained
on a 100meters radius. But as you said this way, like subsetpipe, only
minimize the number of objects. Could you send me a tip on how do i
calculate the distance between a point and a line?

    Private Function CreateRecordSetMarker(ByVal nomeLigacao As String,
ByVal tabela As String, ByVal dblX As Double, ByVal dblY As Double, ByVal
atributos As Array) As GDO.GRecordset
        Dim MyMarker As MAPSRVLib.IDGWMMarker
        Dim MyReturnRecordset As GDO.GRecordset
        Try
            MyMarker = MapServer.AddMarker("mrkAmbTrocos", nomeLigacao,
tabela, "", atributos)
            MyMarker.AddElementsByCircle("", dblX, dblY, 100)
            MyMarker.Recordset.MoveFirst()
            MyReturnRecordset = MyMarker.Recordset
        Catch ex As Exception
            MyReturnRecordset = Nothing
        Finally
            If Not MyMarker Is Nothing Then
                MapServer.DeleteMarker("mrkAmbTrocos")
                MyMarker = Nothing
            End If
        End Try
        Return MyReturnRecordset

    End Function

2007/1/4, Nguyen Quoc Toan <quoctoan at credent-asia.com>:
>
>  Rui Lima,
>
> As I remember there is no function in GeoMedia Pro/WebMap Pro to identify
> the nearest object. We can calculate the distance from the point to each of
> returned objects to determine the nearest one. The SubsetPipe is used to
> minimize the number of objects to check.
>
> Another way you can check and try is Aggreation function - but I not sure.
>
> Toan
>
>  ------------------------------
> *From:* Rui Lima [mailto:eng.ruilima at gmail.com]
> *Sent:* Thursday, January 04, 2007 7:25 PM
> *To:* geomedia-l at directionsmedia.net; Nguyen Quoc Toan
> *Subject:* Re: [Geomedia-l] WEBMAP PRO finding the nearest line
>
> Hi Toan,
> thanks for your suggestions, they helped!
> -- 1. How do you create recsetPonto? Does it contain coordinate system
> same as recsetTrocos
> Yes the coordinate system is the same.
> I've tried the second option using a buffer zone. I've already done that
> before, but  using the operator gmsqTouches, but i still have a big problem.
> It returns more than 1 record, how can i know witch is the nearest??? :(
>
>
> 2007/1/4, Nguyen Quoc Toan <quoctoan at credent-asia.com>:
> >
> >  Hi Rui Lima,
> >
> > I think there are 2 things need to check:
> >
> > 1. How do you create recsetPonto? Does it contain coordinate system same
> > as recsetTrocos
> > 2. Did you try to use InputRecordset from Point (house) instead of line
> > (road)? I think you should create a buffer zone around the point first and
> > use it as a filter recordset, then use gmsqOverlap operator. Your output
> > returns 0 rows because there is no road "entirely" within the distance.
> >
> > HTH,
> > Toan
> >
> >  ------------------------------
> > *From:* geomedia-l-bounces at directionsmedia.net [mailto:
> > geomedia-l-bounces at directionsmedia.net] *On Behalf Of *Rui Lima
> > *Sent:* Thursday, January 04, 2007 3:47 AM
> > *To:* geomedia-l at directionsmedia.net
> > *Subject:* Re: [Geomedia-l] WEBMAP PRO finding the nearest line
> >
> >  I'm not trying to do this on Geomedia Professional :(
> > I'm creating a webpage that uses Geomedia Webmap Professional, and want
> > to get the id of the nearest road when the user clicks on a point on the
> > map. I'm creating a BLOB using PBasic.PointGeometry and i was trying to
> > use a PPipe.SpatialSubsetPipe the outputrecordset.recordcount is always
> > 0
> >
> >
> >  Dim ssp As PPipe.SpatialSubsetPipe
> > ssp = Me.MapServer.CreateObject("GeoMedia.SpatialSubsetPipe")
> >        With ssp
> >       .InputRecordset = recsetTrocos             '<-has >24800 records
> >       .InputGeometryFieldName = "Geometry"
> >       .FilterRecordset = recsetPonto             '<- has one record
> >       .FilterGeometryFieldName = "Geometry"
> >       .Distance = 100 /
> > MapServer.CoordSysMgr.CoordSystem.StorageToProjectionScale
> >       .NotOperator = False
> >       .SpatialOperator = PPipe.SQConstants.gmsqWithinDistance
> >       .OutputStatusFieldName = "status"
> > End With
> >
> > Dim auxRecSet As GDO.GRecordset
> > auxRecSet = ssp.OutputRecordset
> > auxRecSet.MoveLast()      'rises exception because auxRecSet is empty :(
> > auxRecSet.MoveFirst()
> >
> >
> >
> > Where should i look for a problem???
> >
> >
> > Disclaimer: This email is intended only for the use of the individual or
> > entity to whom it is addressed and may contain information that is
> > privileged and confidential. If you are the intended recipient, you should
> > not disclose, disseminate, distribute, copy or use any of the information
> > contained in this transmission for any purpose. If you have received this
> > message in error, please notify us immediately by return email and erase all
> > copies of the message and attachments. Thank you.
> >
> >
>
>
> --
> __________________________________________________________
> "O único lugar onde o sucesso vem antes que o trabalho é no dicionário"
>
>
> Disclaimer: This email is intended only for the use of the individual or
> entity to whom it is addressed and may contain information that is
> privileged and confidential. If you are the intended recipient, you should
> not disclose, disseminate, distribute, copy or use any of the information
> contained in this transmission for any purpose. If you have received this
> message in error, please notify us immediately by return email and erase all
> copies of the message and attachments. Thank you.
>
>


-- 
__________________________________________________________
"O único lugar onde o sucesso vem antes que o trabalho é no dicionário"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.directionsmedia.net/pipermail/geomedia-l/attachments/20070104/4c65d32e/attachment.html


More information about the GeoMedia-l mailing list