I'm a complete PHP newbie trying to get above Filemaker Pro scripts.
I have a map87.txt file which contains point coordinates (POI) and coordinates which forms a line (POLYLINE):
Coordinates - in (latitude, longitude) format - which are bolded above is the only text that I want to parse for out-of-bounds values. That is just a snip. The largest file size is 3MB and contains hundreds and thousands of coordinate data....
...
[POI]
Type=0x6401
CountryName=MALAYSIA~[0x1d]MYS
RegionName=PAHANG~[0x1d]PHG
CityName=KUANTAN
Data0=(3.83569,103.33313)
[END]
[POLYLINE]
Type=0x2
Label=~[0x06]12
EndLevel=4
RoadID=771
RouteParam=5,3,0,0,0,0,0,0,0,0,0,0
Data0=(3.70593,103.12008),(3.70227,103.12075),(3.70145,103.12069),(3.69467,103.11905),(3.69265,103.11890),(3.68750,103.11922),(3.68540,103.11905),(3.68402,103.11875),(3.68175,103.11787),(3.67527,103.11581),(3.67407,103.11551),(3.67300,103.11532),(3.67064,103.11499),(3.66909,103.11480),(3.66667,103.11492)
Nod1=0,281773,0
Nod2=11,281765,0
Nod3=14,286218,1
[END]
...
..
The reference bound coordinates are in a separate bounds.txt file which contains the North (latitude), South (latitude), East (longitude) and West (longitude):
How can I write a PHP code to evaluate whether all the coordinates in the map87.txt file is within the bounds of the bounds.txt file?...
...
map86.txt N4.00000 S3.66667 E102.50000 W103.00000
map87.txt N4.00000 S3.66667 E103.00000 W103.50000
...
...
Should I:
1. Use regular expressions - research tells me that this will be slow
2. Put the coordinates in an array - is this faster? How do I tell PHP to put the coordinates into an array and evaluate whether:
a) 3.66667 < latitude < 4.00000
b) 103.00000 < longitude < 103.50000
and then list all coordinates which are out-of-bounds?
Thanks heaps in advance.
Warm regards,
Umar