Lat & lon in a JTable

I need to be able to show lat and lon in columns of a table. We want to be able to edit the field in either deg:min:sec or float forms and render in deg:min:sec. Does anyone know of a widget for that, or some hints as to how to approach it?
I have built a class to contain a value, along with constructors for the two forms of input, but am hung up on how to build a cell editor for it.
Thanks for your help.

I'd break it down into three steps
1) write a java.text.Format class that can correctly parse/format values to some data value. You probably want a Longitude and Latatude class to server as the the value, or you might want a Longitude:Latitude pair.
2) Write a cell renderer that takes an object of your value class and formats it appropriately for dispay, using the format you've written
3) Write a cell editor that accepts strings of the proper format and parses them using your custom format.
You can use either the java.text package, or the javax.swing.text package: the first leads to standard cell renderers/editors, and the second leads to JFormattedText (at least for editing). I'd try to stay with the first unless the user's absolutely had to have the colons preinserted (meaning that I then have to do the cursor tracking and document handling that JFormattedText gives you).

Similar Messages

  • Help needed to write algorithm to find Direction given lat/lon

    Hello, i need an algorithm to find out the direction being traveled given the starting and ending lat/lon decimal coordinates. Anybody have any clues how to do it? or where i can find one to just plug into my program? thanks for your help
    public String getDirection(double prevLat, double prevLon, double newLat, double newLon) {
        String direction;
        return direction;
    }

    Perhaps this helps:
    http://www.cssd.ab.ca/tech/social/latitude/index.html
    It will help you learn the meaning of lat/long-coords. I think you will end up with somthing like this:
    if ( prevLat < newLat) {
       //we are travelling north
    else {
       // we are travelling south
    if (prevLong < newLong) {
       //we are travelling east?
    else {
       //we are travelling west
    }This could be wrong, since there is a west-long and an east-long..
    Anyhow, hope this gets you on your way.
    ps: is this a class-assignment??

  • Lat/Lon Format

    Canon 5D III, Canon GP-E2 GPS, LR 5.2
    The Lat/Lon format in LR is displayed as:
    35°45'54" N 82°15'54" W
    That is very inconvenient for any other work.
    The desired Lat/Lon format needs to be
    35.76500, -82.26500
    I can’t find a way to change the format.  Can any one help?

    WCA01 wrote:
    Do you know of such a plugin and where to get it?
    Jeffrey Friedl's metadata viewer will format it just the way you want, out of the box:
    http://regex.info/blog/lightroom-goodies/metadata-viewer
    It's a one-at-a-time thing, and takes a second or two for results.
    If you want something more persistent and immediate, which you can use in lib-filters and/or smart collections..., consider ExifMeta - use the 'GPS Lat-Long in Decimal' preset (preset manager section of plugin manager).
    Rob

  • Viewing actual lat/lon data in iPhoto

    I want to view the actual lat/lon GPS data inclosed in a photo shot on my iPhone ?

    HoughDah Geo can read the iPhoto database and display the Lat/Long - it also can automatically copy it to other photos based on time or add it from other sources including GPS trackers
    LN

  • Any way to set picture locations to a specific lat/lon?

    I've got a bunch of pictures in my iPhoto library that were taken at interesting places that aren't listed in the little database of landmarks that is pre-loaded into iPhoto '09. (For example: at the top of a mountain, or on a particular bridge, etc.) It's easy to find these places in Google Earth, so I know the exact latitude/longitude... but how can I tell iPhoto this information if the mountain/bridge/etc. isn't famous enough to be listed? Is there any way to just type in a latitude and longitude?
    Thanks!

    (However, that's a really cumbersome task if I'm going through a large roll of photos.
    Select all photos taken at the same location and enter the location for all of them at once.
    It would be great if there were a way to just type in a lat/lon if I know it
    I don't see a difference in assigning a name to a lat/long entry or assigning a name to a "pin" location on a map.
    because it's written in the picture file's EXIF header!
    My understanding is that these photos will have to be re-imported if you want iPhoto '09 to "scan" the data and add it to the iPhoto '09 database if the photos where originally imported under iMovie '08.

  • Converting large amounts of points - 76 million lat/lon's to spatial object...

    Hello, I need help.
    Platform - Oracle 11g 64bit on Windows Enterprise server 2008 64bit.  64 GB of ram with 2 CPUs totalling 24 cores
    Does any one know of a fast way to convert large amounts of points to a spatial object?  I need to convert 76 million lat/lon's to ESRI st_geometry or Oracle sdo_geometry.
    Currently, I have setup code using pipelined parallel functions and multiple jobs that run concurrently.  It still takes over 2.5 hours to process all of the points.
    Any pointers would be GREATLY appreciated!
    Thanks
    John

    Hi,
    Where is the lat/lon data at the moment?  In an external text file or in an existing database table as number attributes?
    If they're in an external text file, then I'd probably use an external table to load them in as quickly as possible.
    If they're in an existing database table, then you can just update the sdo_geometry column using:
    update <table> set <geometry column> = sdo_geometry(2001, <your srid>, sdo_point_type(<lon column>, <lat column>, null), null, null)
    where <lon column> is not null
    and <lat column> is not null;
    That should run very quick for you.  If you want to avoid the overhead of creating redo, you could use "create table .... as select...".  This example of creating 1,000,000 points runs in 9 seconds for me.
    create table sample_points (geometry) nologging as
      (select sdo_geometry(2001, null,
      sdo_point_type(
      trunc(100000 * dbms_random.value()),
      trunc(100000 * dbms_random.value()),
      null), null, null)
      from dual connect by level <= 1000000);
    I have setup code using pipelined parallel functions and multiple jobs that run concurrently
    You shouldn't need to use pl/sql for this task.  If you find you do, then provide some sample code and we'll take a look.
    Regards,
    John O'Toole

  • Excel formula to calculate the distance between multiple points using lat/lon coordinates

    I'm currently drawing up a mock database schema with two tables: Booking and Waypoint.
    Booking stores the taxi booking information.
    Waypoint stores the pickup and drop off points during the journey, along with the lat lon position. Each sequence is a stop in the journey.
    How would I calculate the distance between the different stops in each journey (using the lat/lon data) in Excel?
    Is there a way to programmatically define this in Excel, i.e. so that a formula can be placed into the mileagecolumn
    (Booking table),
    lookup the matching sequence (via bookingId)
    for that journey in the Waypointtable
    and return a result?
    Example 1:
    A journey with 2 stops:
    1 1 1 MK4 4FL, 2, Levens Hall Drive, Westcroft, Milton Keynes 52.002529 -0.797623
    2 1 2 MK2 2RD, 55, Westfield Road, Bletchley, Milton Keynes 51.992571 -0.72753
    4.1 miles according to Google, entry made in mileage column
    in Booking table
    where id
    = 1
    Example 2:
    A journey with 3 stops:
    6 3 1 MK7 7DT, 2, Spearmint Close, Walnut Tree, Milton Keynes 52.017486 -0.690113
    7 3 2 MK18 1JL, H S B C, Market Hill, Buckingham 52.000674 -0.987062
    8 3 1 MK17 0FE, 1, Maids Close, Mursley, Milton Keynes 52.040622 -0.759417
    27.7 miles according to Google, entry made in mileage column
    in Booking table
    where id
    = 3
    I understand that 100% accuracy is not possible, so it will not be an issue.

    http://www.cpearson.com/excel/LatLong.aspx
    and
    http://www.contextures.com/excellatitudelongitude.html

  • How to convert the x/y pixel into Lat/Lon?

    Does anyone know how to covert the X/Y coord into Lat?lon coord system? What is the formular?
    Thanks!!!
    Ming

    Depends on the projection your map is using.

  • Lat & Lon in Places - Aperture 3

    I have numerous photos taken in the high Arctic about 20 years ago. How do I get Places to accept the latitude and longitude so I can locate them reasonably close to where they were taken on the map? When I expand the map there are no place names or geographical highlights to use as a visual reference. The photos were taken with a film camera and the locations were determined the old fashioned way.

    TJK,
    I'm not experiencing the same thing that you are. Here's what I did. Please follow the same actions and let us know what you find.
    1. Select 1 photo
    2. Go to Places view with the toolbar button
    3. enter "74, -42" into the "Search the map" text box
    4. Click on the only selection available ("72.000000, -42.000000 Tuvu")
    5. Zoom out until I can see Greenland
    6. Drag the 1 photo to the coast (so I can tell it's not at (72, -42), which is a lot of snow and ice)
    7. Click the "done" button
    8. Select 1 more photo
    9. Drag the 1 photo to a different place
    10. Click the "done" button
    11. Select a different project
    12. Reselect the project with the newly tagged photos
    In my case, both photos are right where I dropped them.
    nathan

  • Error creating a simple polygon with lat/lon

    Hello,
    When I validate the result of the following code used to insert a polygon, I get oracle error 13050 - Contact Oracle. If I change the order of the points, I get error 13349 - Polygon crosses itself, so I feel I have the points in the correct order. Any ideas why this polygon won't validate to true?
    insert into tblname values(
    (mdsys.sdo_geometry(2003,null,null,
    mdsys.sdo_elem_info_array(1,1003,1),
    mdsys.sdo_ordinate_array
    (-89.228298,42.916663,
    -89.344087,43.247025,
    -89.016191,43.33739,
    -88.912663,43.079601,
    -89.02033,43.008463,
    -89.228298,42.916663))
    ), field 2, 'field3')
    Thanks for any thoughts,
    David

    Bruce,
    I was attempting solve a business/spatial problem the wrong way, based on limited experinece with Oracle spatial.
    I need to create a convex hull polygon from a splatering of points. (for sake of arguement, lets say the points are salesmans locations and there will be approx 2,000 salesmans locations. I need to create a convex hull of these 2000 points).
    My initial thought was to use the points as input to making a polygon. I was then going to use this polygon as input to making the convex hull. In order to make a valid polygon to feed into the generation of the convex hull, the points have to be in such an order so there are no crossing lines and the polygon closes itself, when creating a polygon.
    I have since been given the suggestion of using my ponits as input to making a linestring geometry, and then using this linestring geometry as input to creating a convex hull.
    Hope this explains my thought process. Thanks for your input.
    David
    null

  • Select data with SDO_RELATE in lat long coordinate system(8307) in 10gR2

    Hi all,
    I have problem with selecting data from table.
    Data are in lat lon coordinate system 8307.
    These requests don't return any data:
    SELECT ISSUE_ID FROM MAP_ISSUES WHERE SDO_FILTER(GEOMETRY, sdo_geometry (2003, 8307, null, sdo_elem_info_array (1,1003,1),sdo_ordinate_array(-180,-90, 180,-90, 180,90, -180,90, -180,-90)) ) = 'TRUE';
    SELECT ISSUE_ID FROM MAP_ISSUES WHERE SDO_RELATE(GEOMETRY, sdo_geometry (2003, 8307, null, sdo_elem_info_array (1,1003,1),sdo_ordinate_array(-180,-90, 180,-90, 180,90, -180,90, -180,-90)), 'MASK=ANYINTERACT' ) = 'TRUE'
    Optimized polygon does return all data correctly:
    SELECT ISSUE_ID FROM MAP_ISSUES WHERE SDO_FILTER(GEOMETRY, sdo_geometry (2003, 8307, null, sdo_elem_info_array (1,1003,3),sdo_ordinate_array (-180,-90,180,90)) ) = 'TRUE'
    Smaller polygon select data correctly too.
    SELECT ISSUE_ID FROM MAP_ISSUES WHERE SDO_FILTER(GEOMETRY, sdo_geometry (2003, 8307, null, sdo_elem_info_array (1,1003,1),sdo_ordinate_array (52,-7, 54,-7 , 54,-5 , 52,-5, 52,-7)) ) = 'TRUE'
    I have tried changed polygon to be clockwise, counter clockwise, make the area a bit smaller( 160 instead of 180, 89 instead of 90) nothing has helped.
    My explanation than was, that Earth is sphere and each defined polygon defines TWO polygons in the sphere and there is convention that the smaller is chosen to select data. It would make sense along the previous results, but than I found one post which says that this is bug http://www.frontoracle.com/oracle-database/703/180703-size-of-are-of-interest-smaller-equals.html
    I have found in other thread that max only 1/2 of Earth could be selected Different results using SDO_RELATE with polygon and rectangle type but it seems not true, because optimized bounding box works fine!
    What is right? Is there anything in official documentation?
    Is it bug.
    Max 1/2 of Earth could be selected in one request.
    Each polygon defines two areas in the Earth and the smaller one is used to do spatial SDO_RELATE operation?
    Thanks!
    Regards,
    Zdenek

    Zdenek,
    A bug, or limititation, whichever you choose. IMHO if you ask for something, and don't get what you expect, it is a bug that could be fixed.
    But for 10g anywho, the following applies, which is why I choose 120 degree breaks for my code as it is less than 180...
    The following size limits apply with geodetic data:
    ■ No polygon element can have an area larger than one-half the surface of the Earth.
    ■ In a line, the distance between two adjacent coordinates cannot be greater than or
    equal to one-half the perimeter (a great circle) of the Earth.
    If you need to work with larger elements, first break these elements into multiple
    smaller elements and work with them. For example, you cannot create a geometry
    representing the entire ocean surface of the Earth; however, you can create multiple
    geometries, each representing part of the overall ocean surface. To work with a line
    string that is greater than or equal to one-half the perimeter of the Earth, you can add
    one or more intermediate points on the line so that all adjacent coordinates are less
    than one-half the perimeter of the Earth.
    Bryan

  • Calculating distance between lat long coordinates best possible way?

    Hi,
    Am proposing to have a table A with latitude and longitude values along with some other info for that lat lon in it. The number of rows of data will be more and it will be growing day by day. i am having one application which will provide a latitude and longitude value and this i have to compare with all the lat lon of the table A and fetch the nearest (distance wise) information from other columns corresponding to that lat long in table A.
    what is the best method available to implement this so as to reduce the time required to compare lat lon supplied with all rows of data in table A.
    Thanks in advance.

    Have a look at the spatial option from oracle. Also there is a forum dedicated to this type of questions.
    http://www.oracle.com/technetwork/database/options/spatial/index.html
    especially: http://download.oracle.com/otndocs/products/spatial/pdf/locator11g_feature_overview.pdf
    Edited by: Sven W. on Nov 30, 2010 5:53 PM

  • Oracle Spatial function to find nearest line string based on lat/long

    Hi,
    Here is my scenario. I have a table that contains geometries of type line strings (the roadway network). The line geomteries are of type Ohio state plane south (SRID 41104).
    I have a requirement - given a lat/long, find the line string that snaps to that lat/long or the nearest set of line strings within a distance of 0.02 miles.
    This is a typical example of trying to identify a crash location on our roadway network. The crashes being reported to us in lat/long thru the GPS system.
    How can i acheive this through any spatial functions?
    Thanks for the help in advance.
    thanx,
    L.

    Hi L,
    That is not the way I would do it. I would convert my road segments to LRS data, then you can do all queries on the same data.
    Or, if you do not want to modify your original data, create a copy of your road segments with the same ID's and convert the copy into LRS data. If you keep the ID's identical, you can easily use geometry from one and LRS data from the other - as long as you are sure the ID is the same.
    Which will make the workflow a bit easier:
    1. Use SDO_NN to get the closest segments
    2. Use SDO_LRS.PROJECT_PT to get the projected point
    3. Use SDO_LRS.GET_MEASURE to get the measure
    And most of these you can incorporate into one single query. Now I am writing this of the top of my head (It's been a while since I played with LRS). so this has not been tested, but something like this should work (but could probably be greatly improved - it's getting late for me :-) ):
    SELECT
    SDO_LRS.FIND_MEASURE  --//find_measure needs an LRS segment and a point
        SELECT            --//here we select the LRS segment
          r.geometry 
        FROM
          roadsegments r
        WHERE SDO_NN(r.geometry,    --//based on the given GPS point
                     sdo_geometry(2001, 41104, sdo_point_type(lat,lon,NULL), NULL, NULL), 
                     'sdo_num_res=2 distance=0.02 unit=mile') = 'TRUE'
      SDO_LRS.PROJECT_PT  --//We project the point on the LRS segment
          SELECT         --//here we select the LRS segment (again, which could probably be improved!!)
            r.geometry 
          FROM
            roadsegments r
          WHERE SDO_NN(r.geometry,
                       sdo_geometry(2001, 41104, sdo_point_type(lat,lon,NULL), NULL, NULL), 
                       'sdo_num_res=2 distance=0.02 unit=mile') = 'TRUE'
        sdo_geometry(2001, 41104, sdo_point_type(lat,lon,NULL), NULL, NULL) --//The GPS point again
    AS milemarker from dual;So it is not as complicated as you think, it can easily be done with just one query (SQL can do a lot more than you think ;-) ).
    Good luck,
    Stefan

  • How do i update an existing XML File?

    Hello, I have the following xml file gps.xml:<?xml version="1.0"?>
    <!DOCTYPE gps SYSTEM "gps.dtd">
    <gps>
       <latitude>43.00000</latitude>
       <longitude>-83.00000</longitude>
    </gps> I already have methods written to get the values. But how can I change these values and update the file to reflect these changes?
    thanks for your help!

    Hi, I already have this following code. I would just like to add a method to it to update the existing XML file with different lat/lon coordinates. Could you please help me out with it? thanks
    import java.io.*;
    import java.io.PrintWriter;
    import java.net.MalformedURLException;
    import java.net.URL;
    import javax.xml.parsers.*;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    public class Gps implements java.io.Serializable {
        private double latitude_;
        private double longitude_;
        public Gps(Document doc) {
            setup(doc.getDocumentElement());
        public Gps(String uri) throws IOException, SAXException, ParserConfigurationException {
            setup(uri);
        public void setup(Document doc) {
            setup(doc.getDocumentElement());
        public void makeElement(Node parent) {
            Document doc;
            if (parent instanceof Document) {
                doc = (Document)parent;
            } else {
                doc = parent.getOwnerDocument();
            Element element = doc.createElement("gps");
            int size;
            URelaxer.setElementPropertyByDouble(element, "latitude", this.latitude_);
            URelaxer.setElementPropertyByDouble(element, "longitude", this.longitude_);
            parent.appendChild(element);
         public Document makeDocument() throws ParserConfigurationException {
            Document doc = UJAXP.makeDocument();
            makeElement(doc);
            return (doc);
        public final double getLatitude() {
            return (latitude_);
        public final void setLatitude(double latitude) {
            this.latitude_ = latitude;
        public final double getLongitude() {
            return (longitude_);
        public final void setLongitude(double longitude) {
            this.longitude_ = longitude;
       public final void updateXmlFile(double latitude, double longitude) {
         // something???
        public final void updateXmlFile(double latitude, double longitude) {
            this.latitude_ = latitude;
            this.longitude_ = longitude;
        public String makeTextDocument() {
            StringBuffer buffer = new StringBuffer();
            makeTextElement(buffer);
            return (new String(buffer));
        public void makeTextElement(StringBuffer buffer) {
            int size;
            buffer.append("<gps");
            buffer.append(">");
            buffer.append("<latitude>");
            buffer.append(Double.toString(getLatitude()));
            buffer.append("</latitude>");
            buffer.append("<longitude>");
            buffer.append(Double.toString(getLongitude()));
            buffer.append("</longitude>");
            buffer.append("</gps>");
        public String toString() {
            try {
                return (makeTextDocument());
            } catch (Exception e) {
                return (super.toString());
    }

  • How to find a line/edge that starts at the same point as the end of another

    I have an edges table of Lat/Lon data and for a specific edge I want to find any other edges that have the same start point as the end point of the given edge.
    I tried the following query:
    select geo_street_id from geo_street s2
    where SDO_LRS.GEOM_SEGMENT_START_PT(s2.geom) =
    (select SDO_LRS.GEOM_SEGMENT_END_PT(s.geom) as geom from geo_street s
    where geo_street_id = 122978214)
    but it gets the following error:
    ORA-22901: cannot compare nested table or VARRAY or LOB attributes of an object type
    Any Ideas?

    1. to compare geometry to be equal you should use appropriate function (SDO_GEOM.RELATE http://download.oracle.com/docs/html/B14255_01/sdo_objgeom.htm#sthref1561) or operators (sdo_relate http://download.oracle.com/docs/html/B14255_01/sdo_operat.htm#i78531) with specific mask EQUAL.
    2. to filter down the resultset in first place you can use the operator SDO_RELATE with mask TOUCH as this will return already the set of lines sharing endpoints, but will also include lines touching eachother not at endpoints (endpoint intersecting the otherone's interior)
    something like
    select geo_street_id from geo_street s2, geo_street s
    where
    s.geo_street_id = 122978214
    AND
    sdo_relate(s2.geom, s.geom,'mask=touch') = 'TRUE'
    AND
    sdo_geom.relate(SDO_LRS.GEOM_SEGMENT_START_PT(s2.geom),
    'EQUAL',
    SDO_LRS.GEOM_SEGMENT_END_PT(s.geom),0.005)='EQUAL'
    3. if you would do this for the full table, an SDO_JOIN (http://download.oracle.com/docs/html/B14255_01/sdo_operat.htm#BGEDJIBF) might be more appropriate.
    4. you might also consider 4 cases:
    start = start
    start = end
    end = start
    end = end
    5. alternative would be to take only the endpoints of your selected geometry and perform a touch with the edges. using the sdo_util.APPEND on the startpoint en endpoint of your geometry will return a multipoint. although there might some specific cases that this would not return respected result I think
    something like:
    select geo_street_id from geo_street s2, geo_street s
    where
    s.geo_street_id = 122978214
    AND
    sdo_relate(s2.geom,
    SDO_UTIL.APPEND(
    SDO_LRS.GEOM_SEGMENT_START_PT(s.geom),
    SDO_LRS.GEOM_SEGMENT_END_PT(s.geom)
    ,'mask=touch') = 'TRUE'
    Let us know how it works.
    Luc

Maybe you are looking for

  • User Exit for Incoming Excise invoice capture(MIGO)-clarification

    Hi all, We are using mySAP ECC 5.0 version with CIN Configuration made. In this, if Excise Duty value is zero, then excise invoice pop-up should not come. But the system asks for it, and the user has to manually change the excise action as 'No Excise

  • How to give the header condition type in the Sales Order for freight?

    Hi,      We are creating Sales Order(SO) using FM 'CRMXIF_ORDER_SAVE'.And we are unable to track the FREIGHT condition type in the above FM to pass value.      We want to check this value in CRMD_ORDER tcode.     Pls let us know how to make it possib

  • Vendor master records

    hi , if i configured F2 144 message for checking vendor master duplication ,is it case sensitive? i mean if i create vendor with capital letters (already is there with small letters) in NAME 1 or NAME 2,is it works. Regards, Ravi.

  • URl link of record in workflow email

    Hi, any one know how to send a URL of a record to a user in am workflow email?

  • Service dsk with third party hlp dsk

    hi, we want to integrate sap support desk with maximo help desk tool. have any one worked on this?? can anyone help me out on the strategies, scenarios ? thank you..