The GPS platform must deal with various maps and solve the following problems:
1. coordinate offset. Needless to say, you need to add the original coordinates to the offset, and then display it on Baidu map or Google. Note that Baidu map is to be added to the offset, maps of Google and AMAP are the coordinates of Mars;
2. coordinate decoding or correction is also required, because when users draw different areas on the map, the coordinates marked and sent to the background storage are based on the coordinate system used by the map, therefore, it is offset, which is a serious problem, because in the part 808 protocol, for the region alarm, the region's vertex coordinates need to be sent to the terminal, in actual operation, the terminal constantly compares the GPS coordinates with the Region coordinates to determine whether the alarm is sent to or from the region. If the region coordinates are offset, it must be wrong. Therefore, the offset coordinates must be reversely restored to the original coordinates based on the WGS84 coordinate system before being issued.
3. Regional alarm. The GPS platform also requires the platform to support regional alarm. That is to say, if the terminal does not have this function, the platform can analyze the GPS location for regional alarm. Therefore, the base platform must provide judgment algorithms for circular, polygon, and rectangular areas.
4. Route offset. The Ministry of Standards specifies that the ministry of standards platform must test the route offset alarm when detecting. Therefore, the ministry of standards platform must also provide a route offset judgment algorithm.
5. geographic location: You need to know the text of the vehicle's geographic location and the specific location of the alarm. Many Platforms only display the longitude and latitude coordinates in the report, this is annoying. Therefore, you need to provide an interface for obtaining geographical locations in the background to record the geographical location during the alert. Save it to the database, and then form a report display.
Therefore, during the design process, we need to design an underlying algorithm service library for use by other developers, because algorithms are mainly used in application and real-time alarm analysis, therefore, algorithms must be efficient.
6. Generally, the GPS platform provides at least two maps for users, such as Baidu, four-dimensional, Google, and AMAP. Our algorithms must be used with all these maps.
Now we provide an online dynamic library for your trial. The GPS algorithm service Library Demo has been downloaded 20 times.
The call method is as follows:
Using system; using system. collections. generic; using system. LINQ; using system. text; using mapserviceclient. mapfix; using gpsnet. coordservice; using gpsnet; namespace mapservicedemo {/*** @ author www.ltmonitor.com * @ email [email protected] */class program {static void main (string [] ARGs) {mapserviceclient. mapfix. imapservice service = mapservicefactory. getmapservice (); double lng1 = 121.111; double LAT1 = 32.121; // obtain the geographical location string location = service. getlocation (lng1, LAT1); console. writeline (location); // whether the test point is in the circular area double centerlng = 120; double centerlat = 32; // The Center Coordinate Double radiusbymeter = 100; // The Circular radius, in meters, Boolean isincircle = service. isincircle (lng1, LAT1, centerlng, centerlat, radiusbymeter); // whether the test point is in the polygon mypointlatlng P = new mypointlatlng (LAT1, lng1); mypointlatlng p1 = new mypointlatlng, 121.10); mypointlatlng P2 = new mypointlatlng (33.12, 121.10); mypointlatlng P3 = new mypointlatlng (33.12, 121.10); mypointlatlng P4 = new mypointlatlng (33.12, 121.10 ); mypointlatlng [] points = new mypointlatlng [] {P1, P2, P3}; // Boolean isinpolygon = service. isinpolygon (p, points); // check whether the test point is in the rectangle. The coordinates in the upper left corner and lower right corner of the rectangle must be entered correctly and cannot be mixed. // Boolean isinrect = service. isinrect (lng1, LAT1, lngleft, lattop, lngright, latbottom); int offset = 12; // Boolean isonline = service. ispointonline (p, P1, P2, offset); // test the coordinate offset and offset for (INT m = 0; m <50; m ++) {double lng = 121.122 + M * 0.01; double lat = 33.222 + M * 0.01; // Baidu coordinates are biased towards mypointlatlng pt1 = service. fix (LNG, Lat, "Baidu");/*** reversely restored to the original GPS coordinate */mypointlatlng pt2 = service. reverse (pt1.lng, pt1.lat, "Baidu");/*** obtains the error distance between two points, in meters */Double D = service. getdistancebymeter (LNG, Lat, pt2.lng, pt2.lat); console. writeline ("error precision between two points after Baidu coordinate restoration:" + D + "meters"); // The pt1 = service is added to the coordinate system of Mars (such as Google and AMAP. fix (LNG, Lat, "Google");/*** reversely restored to the original GPS coordinate */pt2 = service. reverse (pt1.lng, pt1.lat, "Google");/*** obtains the error distance between two points, in meters */D = service. getdistancebymeter (LNG, Lat, pt2.lng, pt2.lat); console. writeline ("error precision between two points after Google coordinate restoration:" + D + "meter");} console. readline ();}}}
The accuracy of the original coordinates is about 1 meter, which is very accurate compared with the coordinates after the deviation is obtained after the deviation is added and then obtained. The running result is as follows:
Architecture Design of the GPS platform (5)-map service Algorithm Library