IP address query, you can query the IP address according to the geographical latitude and longitude coordinates, such as the following example query IP address 58.192.32.1, latitude and longitude of 118.777802, 32.061699, is the location of Nanjing University.
---------------------------------Package------------------------------------Package
Com.pstreets.gisengine.demo.rim; ---------------------------------IMPORTS------------------------------------Import
Com.mapdigit.gis.DigitalMap;
Import Com.mapdigit.gis.MapPoint;
Import Com.mapdigit.gis.geometry.GeoLatLng;
Import Com.mapdigit.gis.raster.MapType;
Import Com.mapdigit.gis.service.IIpAddressGeocodingListener;
Import com.mapdigit.gis.service.IpAddressLocation;
Import Com.pstreets.gisengine.demo.MapDemoRIM;
Import Net.rim.device.api.ui.component.Menu;
Import Net.rim.device.api.ui.MenuItem; [------------------------------MAIN class----------------------------------] public class Mapipsearchrim extends Mapdemorim implements Iipaddressgeocodinglistener {/** * Entry point for application * @param args Comm and line arguments (not used) */public static void main (string[] args) {//Create a new instance of The application and make the currently
Running thread the application ' s event dispatch thread.
Mapipsearchrim Theapp = new Mapipsearchrim ();
Theapp.entereventdispatcher ();
} private MenuItem Mapfindaddressmenuitem = new MenuItem ("Find Address", 0, 0) {public void run () {
Map.getiplocations ("58.192.32.1");
}
};
Public Mapipsearchrim () {init ();
Pushscreen (canvas);
Map.setipaddressgeocodinglistener (this);
GEOLATLNG Center = new GEOLATLNG (32.0616667, 118.7777778);
Map.setcenter (center, Maptype.microsoftchina); The public void is done (String query, ipaddresslocation result) {if (result! = null && result.error.length ( ) = = 0 && result.longitude.length () > 0 && result.latitude.length () ;
0) {try {MapPoint MapPoint = new MapPoint (); String latlng = "[" + Result.longitude + "," +Result.latitude + ", 0]";
Mappoint.point = DIGITALMAP.FROMSTRINGTOLATLNG (LATLNG);
Mappoint.setname (result.organization);
Mappoint.setnote (result.city + "" + result.country);
Map.panto (Mappoint.point);
} catch (Exception e) {result.error = "ip_not_found";
}}} protected void CreateMenu (Menu menu, int instance) {menu.add (Mapfindaddressmenuitem); }
}
Note: The current IP query results are always returned in English, such as the above results in detail.
ISP: "China Education and the China Network"
Organization: "Nan Jing University"
Country: "CN"
City: "Nanjing"
If you want to know the latitude and longitude corresponding to the place name, you can use the address anti-coding service.
You can enter 127.0.0.1 to query the native address.
BlackBerry Guide Bee Map Development Kit Ver2.1 Download