Announcement

Collapse
No announcement yet.

State Plane Conversion

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • fisherml
    started a topic State Plane Conversion

    State Plane Conversion

    Im not sure if this would be the correct section, if not please move.


    Hey Guys,

    I've looked into a few other posts/libraries as far as converting between State Plane (Easting/Northing) to get a Lat/Lon value, however I've run into some trouble.

    I saw here (http://stackoverflow.com/questions/1...nate-transform) that there were a few libraries that would be useful in doing such a conversion.

    I decided to give Java Map Projection Library a shot because it seemed to be more straight forward in terms of usage than say GDAL or CTS.

    But.. alas that is not the case. Below you can see some dumby code that I am trying to use to get the correct coordinates, but it is outputting (garble) information that I'm not quite sure about.

    I guess I have not found 'documentation' or examples as to how the code is intended to be used, and I am not extremely familiar with coordinate based systems, only that I need lat lon. Which leads me to the reason I am doing this.

    I am developing a product that uses WorldWind 2.0 SDK, and in order to plot points, it is my understanding that it needs to be in the form of Latitude and Longitude.

    I have roughly 2000-n rows in a database, all containing State Plane based coordinates that I need to programmatically convert to lat/lon in order to plot points on a map.

    So I guess I am asking if anyone knows of preexisting documentation/examples that relate to my problem, or if someone can spot out what I am doing wrong.



    Code:

    import com.jhlabs.map.proj.Projection;
    import com.jhlabs.map.proj.ProjectionFactory;
    import java.awt.geom.Point2D;

    public class Conversion()
    {
    public static void main(String[] args)
    {
    // Easting = 01495728
    // Northing = 00663563

    Projection epsg = ProjectionFactory.getNamedPROJ4Coordinat eSystem("nad27:3402");
    Point2D.Double pEPSG = new Point2D.Double(01495728, 00663563);
    Point2D.Double test = new Point2D.Double(0, 0);
    epsg.transform(pEPSG, test);

    System.out.println(test.x + ", " + test.y);
    System.out.println(epsg.getPROJ4Descript ion());
    }
    }

    This code outputs:

    856515.186461105, 5819341.3114590645
    +proj=lcc +a=6378249.145 +es=0.006803481196021999 +lon_0=-82d30 +lat_0=38d00 x_0=609601.2192024384 +y_0=0.0

    Using this code

    Code 2:

    Projection epsg2835 = ProjectionFactory.getNamedPROJ4Coordinat eSystem("nad27:3402");
    Point2D.Double pEPSG2835 = new Point2D.Double(01495728.0, 00663563.0);
    Point2D.Double test = new Point2D.Double(0, 0);
    epsg2835.inverseTransform(pEPSG2835, test);
    System.out.println("x: " + test.getX() + "\ny: " + test.getY());
    System.out.println(epsg2835.getPROJ4Desc ription());

    I get,

    x: -71.5472000389142
    y: 43.48764838968165
    +proj=lcc +a=6378249.145 +es=0.006803481196021999 +lon_0=-82d30 +lat_0=38d00 +x_0=609601.2192024384 +y_0=0.0

    I am not entirely familiar with the second line, only that it is outputting in Lambert Conic Conformal form. Otherwise, from my understanding, I am giving it the NAD27 Zone (3402) of South Ohio, Easting point of 001495728 and Northing point of 00663563.

    After manually doing the conversion from http://www.ngs.noaa.gov/cgi-bin/spc_getgp.prl
    It shows that is should be

    ======================================== ===================
    North(Feet) East(Feet) Datum Zone
    INPUT = 01495728.0 00663563.0 NAD27 3402
    ======================================== ===================

    LATITUDE LONGITUDE AREA
    DD MM SS.sssss DDD MM SS.sssss
    -------------- --------------- ----
    39 48 29.30270 84 17 42.17103 3402

    (this is DDD MMM SSSS) but can be converted to decimal.

    Any help is appreciated,

    Mike


    PS: I am not stuck on using this library so if you have other suggestions with documentation/examples or know the format that needs to be set I am entirely open to switching.

  • frenchy
    replied
    Hi,
    Seems that you're messing a little...
    False Easting and Northing are basically distances for shift calculations, they are in feet or meters (often 500,000m). That's not coordinates...
    Direct transform is for plotting, it goes from degrees (or radians) to meters (or feet), that's not what to give to transform()...
    Inverse transform is for reverse calculation (locators), going from meters to degrees, again you give the shifts, no ?
    Projection math is just math, it won't check anything, and will send back a result which is "modulo -PI"....or if you prefer "garbage-in, garbage-out"...:(
    You may try the direct+inverse classical computation, to see if you "go back to your feet"...
    I don't know this java package, but the principles are all the same,
    Pay attention to the units, the degree-radian or meter-feet mistake is an usual one.

    Leave a comment:


  • fisherml
    replied
    neilson,

    I feel like you are seeing more of me than you particularly care to .

    I believe I have it working (at least to my satisfaction for a non cartography expert) but I do have it out on a GISExchange and StackOverflow.

    I will update my code to reflect 8 decimal places as not to break anything, although I'm curious how it would influence WW.


    PS: Although slightly disappointed WW does not have a heat map built in/lack of time to develop one, I have started using Placemarks as you suggested and am happy with how they are working (thanks for the recommendation).

    Leave a comment:


  • nlneilson
    replied
    Originally posted by fisherml View Post
    Im not sure if this would be the correct section, if not please move.

    I've looked into a few other posts/libraries ...

    I decided to give Java Map Projection Library a shot because it seemed to be more straight forward in terms of usage than say GDAL or CTS.

    but it is outputting (garble) information ....


    I have roughly 2000-n rows in a database, ...

    So I guess I am asking if anyone knows of preexisting documentation/examples ...

    DD MM SS.sssss DDD MM SS.sssss
    -------------- --------------- ----
    39 48 29.30270 84 17 42.17103 3402

    (this is DDD MMM SSSS) but can be converted to decimal.
    Hi Mike

    This section in the forum is OK or Development Help.

    I suggest doing a 'Search' in the forum for all threads/posts related to the projection conversion -> WSG84.
    Try GDAL and their help forum.
    Northing-Easting is considered a bit antiquated by some but you should be able to convert it.
    Hopefully someone will respond to this thread that has done it.

    Technically this is more of an issue on converting rather than with WWJ and the lat,lon does need to be in decimal degrees.

    edit: After converting reduce the number of decimal places to 8.
    Using the 'double' of 14 places or whatever WILL cause problems in some situations.
    Last edited by nlneilson; 03-26-2014, 11:36 PM.

    Leave a comment:

Working...
X