[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
www.undertowsoftware.com • View topic - Finding info about a point not working

Finding info about a point not working

A forum made available for users of the MapPro OCX SDK to exchange ideas, ask each other questions, etc.

Finding info about a point not working

Postby jimwelch » Tue Feb 07, 2012 10:32 am

Have been using the mappro80 sdk for a short while. Using VB.Net (VS-2010). All I want to do is find the address and other information at a specific Lat/Lon and I am having all sorts of problems. Please, forgive my ignorance if it's something trivial. Here is the code I am using. I get the coordinate using the Geofind and then I parse the coordinates from what I get back and try to find the info about those coordinates using the FindPlaceAtPoint. But, I keep getting a NULL result. It's driving me nuts. Can anyone see what I might be doing wrong here?

Thanks in advance for any advice I can get.

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
' Trying to find a place the address of a point the map
Dim sAddress, mPlace As String
Dim Xc, Yc As Double
sAddress = AxMapPro1.GeoFindFirst("6056 Anthony Lane, Jefferson City, MO")
Xc = AxMapPro1.ParseTabField(sAddress, 10)
Yc = AxMapPro1.ParseTabField(sAddress, 11)
mPlace = AxMapPro1.FindPlaceAtPoint(Xc, Yc)
If mPlace = Nothing Then
Label4.Text = "No Address Found at this point"
Else
Label4.Text = mPlace
End If
End Sub
User avatar
jimwelch
Active User
Active User
 
Posts: 20
Joined: Mon Feb 06, 2012 10:55 pm

Re: Finding info about a point not working

Postby StephenE » Tue Feb 07, 2012 2:34 pm

Jimwelch, I think you might be using the wrong function. I don't think that FindPlaceAt will give you the address info you are looking for. According to the docs it just returns the name of a place (town, city, etc.) and its FIPS code. And, if I read the skimpy info right, it has to be inside the place polygon, which means for most of the country, you won't get anything.

What I don't understand is, if you already have the address (you used it in your code to find the coordinates), why are you then using the coordinates to find the address? What am I missing?
User avatar
StephenE
New User
New User
 
Posts: 9
Joined: Mon Feb 06, 2012 4:49 pm

Re: Finding info about a point not working

Postby Gyrotech » Tue Feb 07, 2012 4:49 pm

What StephenE said is correct. Why are you using FindPlaceAt? You'd never get the information you are after.

Having said that, the reason for the failure could be that he point you are specifying is NOT within a place polygon. Have you tried other points? May be one in the center of a major Metropolitan area (where a place polygon is likely to exist)?

If it fails there, as well, I have run into similar problems when the Paths_* and the Datasource properties are not set correctly. You may want to double-check those.
User avatar
Gyrotech
Frequent User
Frequent User
 
Posts: 52
Joined: Mon May 03, 2010 11:23 pm

Re: Finding info about a point not working

Postby jimwelch » Tue Feb 07, 2012 9:05 pm

Yeah, reading a bit closer, I see what you all mean. For some reason I thought FindPointAt would give me what I wanted. That, however, still doesn't explain why the FindPointAt would always return NULL. I looked into the possibility of not having a place polygon, but I get the same result, no matter what point I specify.

I went back and made sure my data paths are correct (I have my data folders inside a folder f:\maps), but still no dice. Can anyone think of anything else I might be doing wrong?

Also, what is the best way to get the information I want, if I have the Lat/Lon of the point?
User avatar
jimwelch
Active User
Active User
 
Posts: 20
Joined: Mon Feb 06, 2012 10:55 pm

Re: Finding info about a point not working

Postby UShadow » Tue Feb 07, 2012 11:21 pm

I think you may not have set the Datasource correctly. Set it to either "US" or "US,CA" before you do the search. If I understood what you are looking for, here is an adaptation of your code...

Code: Select all
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        ' Trying to find the address of a point the map
        Dim mPlace, sCF As String
        Dim xLat, yLon, mRad As Double
        Dim Hits, Opt As Integer
        'You can change these coordinates to another point
        xLat = -98.483337
        yLon = 33.883188
        mRad = 2  'Set the search radius in miles
        Hits = 1 'Only need to find the closest (one) hit
        Opt = 1  'Search option, do not consider CFCC filter
        sCF = "A10" 'Set the CFCC code, though it won't be used
        mPlace = AxMapPro1.FindClosestStreetFirst(xLat, yLon, mRad, Hits, sCF, Opt)
        AxMapPro1.FindClosestStreetClose()  'Remember to close the list object to release resources
        If mPlace = Nothing Then mPlace = "No Address Found at this point"
        'Zoom in to see the address
        AxMapPro1.Miles = 0.05
        AxMapPro1.GotoPoint(xLat, yLon)
        'Mark location with small rectangle
        AxMapPro1.Cad.Rectangle(xLat - 0.00005, yLon - 0.00005, xLat + 0.00005, yLon + 0.00005)
        AxMapPro1.Cad.Font.Size = 8
        mPlace = mPlace.Replace(Chr(9), ",")
        AxMapPro1.Cad.Text(xLat - 0.001, yLon + 0.0001, mPlace)
        AxMapPro1.Refresh()
    End Sub
Imagination is greater than detail - Albert Einstein
User avatar
UShadow
Frequent User
Frequent User
 
Posts: 61
Joined: Fri May 28, 2010 11:49 am

Re: Finding info about a point not working

Postby jimwelch » Wed Feb 08, 2012 10:02 am

Yes, it appears that it might have been the datasource. And, your snippet of code is exactly what I was looking for, thanks! It now makes a lot more sense.
User avatar
jimwelch
Active User
Active User
 
Posts: 20
Joined: Mon Feb 06, 2012 10:55 pm


Return to MapPro OCX

Who is online

Users browsing this forum: No registered users and 2 guests

cron