Sonicman_
05-04-2006, 09:35 AM
I know how to place pushpins and play with latitude/longitude and everything, but I am so far unable to determine the territory name for a pushpin I just placed (using VBA).
I have about 50 territories in the united states and would like to place a pushpin, determine it's territory and delete the pushpin.
Determining the territory is my issue. I tried doing a search but all of those who have posted this question did not get any answer. I hope i'll be more successful !
Thank you for your help it will be greatly appreciated.
Sonicman
Wilfried
05-04-2006, 02:43 PM
Hi,
I hope you have more success if it can be done and someone know how. i dont...
Sonicman_
05-06-2006, 10:12 AM
Hi Wilfried
thanks for posting
Anyone else have any idea how to do this ? Or is it just not possible with mappoint ?
Alex
Sonicman_
05-07-2006, 10:55 AM
Here is some code posted by a guest on another topic. Does anyone think it could be adapted to find the territory of a pushpin ?
Here is the code to read the linked Territory. I was wondering if some body has dome the same but with Manually created Territory
With objMap.DataSets
szconn = objMap.Path & "C:\MapPoint\pushpin\Terrs.xls!Sheet1!A1:E127"
Set mpDataSet = .ImportTerritories(szconn, , geoCountryUnitedStates, , geoImportExcelA1)
End With
Dim objRecordset As Recordset
Set objRecordset = mpDataSet.QueryAllRecords
Dim strLookUp As String
ReDim Preserve strRegion(0)
x = 0
'Get the values
Dim vals As String
objRecordset.MoveFirst
Dim i As Integer
Do Until objRecordset.EOF
strLookUp = Trim(objRecordset.fields("Territory"))
ReDim Preserve strRegion(x)
strRegion(x) = strLookUp // I have the list here...
x = x + 1
End If
objRecordset.MoveNext
Loop
Sonicman_
05-12-2006, 03:17 PM
After two weeks of searching and posting I still haven't found a solution to this problem. I decided to reply to my own post again to make it sticky.
Maybe someone will find a solution and share it ?
Alex
Mohamed
05-22-2006, 04:14 PM
Hi,
After two weeks of searching and posting I still haven't found a solution to this problem. I decided to reply to my own post again to make it sticky.
Maybe someone will find a solution and share it ?
I have an idea but I have to test with your Data. Could u send me your file with sample Data to be sure I understand your problem.
Mohamed@atlascouscous.com
Mohamed
05-23-2006, 03:49 PM
Hi,
I don't know what's your progamming language, so I give you the method I used to resolve that:
( By the way, Why do you add a PushinPin and delete it? It's more elegant to use the "BeforeClick" Event )
Never mind, here is the idea :
3 steps:
- When you import your territories, you are obliged to have a GeoFieldType like Postal Code. So, for each Territory Name, you Know the corresponding Postal Codes ( in a file , in an Array, etc. )
- When you add a PushPin , by a Reverse Geocoding function ( you have a lot in this forum ) , you can get the StreetAddress Property and the GeoFieldType value like the Postal Code
- Now you do a search in the file or array where you have your territories and geoFieldTypes to find the correponding Territory Name
Ciao
P.S.
If you add programatically your PushPins, it's easy to save any information you have with the NOTE property. If you put the Territory Name in the NOTE property of a PushPin, you can get that information when you want.
renatoa
09-16-2006, 09:34 AM
I don't know if still useful, but I developed for one of my apps a method to return the clicked territory on map (on before click event).
Renato
I know how to place pushpins and play with latitude/longitude and everything, but I am so far unable to determine the territory name for a pushpin I just placed (using VBA).
I have about 50 territories in the united states and would like to place a pushpin, determine it's territory and delete the pushpin.
Determining the territory is my issue. I tried doing a search but all of those who have posted this question did not get any answer. I hope i'll be more successful !
Thank you for your help it will be greatly appreciated.
Sonicman