Re: [OpenMap Users] what about Geotools

From: Tony Bigbee <abigbee_at_mitre.org>
Date: Thu, 30 Sep 2004 10:48:44 -0400

> On Sep 30, 2004, at 7:18 AM, Ahmed Al-Obaidy wrote:
>
>> Hi
>>  
>> I am new to GIS..
>> i'll be glade if someone answer me
>> which one is better OpenMap or Geotools?

Instead of 'better', I was interested in differences in great circle
distance calculation using spheroid versus an ellipsoid as an earth
model. Geotools has a very easy way to do this for ellipsoid approach
and I compared varying distances at varying latitudes to understand the
differences. In short, there is < 1% difference between the distances
using either at any distance and any part of the earth--that's small,
although it will matter in certain applications. Here is the data I
generated (sorry for so many digits of precision). Below these tables
are source code fragments showing how Geotools versus OpenMap methods
are used.

Delta between longitudes = 0.01 (deg)
Latitude(deg) Ellipsoid(km) Sphere(km)
delta(meters)
0.0 1.113194907792064 1.1131949060017068
1.790357146091992E-6
5.0 1.108987062175152 1.1089588637318644
0.0281984432876925
10.0 1.0963936405188375 1.096282977962477
0.11066255636046662
15.0 1.0755048869765549 1.075263706042469
0.24118093408583263
20.0 1.0464708628681796 1.0460610371856813
0.4098256824984219
25.0 1.0095009025574666 1.0088972135103194
0.6036890471472134
30.0 0.9648628021710947 0.9640550641413635
0.8077380297310128
35.0 0.9128816960636721 0.9118758883816486
1.0058076820234874
40.0 0.853938569131024 0.852756775472505
1.1817936585189273
45.0 0.7884683504373743 0.7871476634477133
1.3206869896609987
50.0 0.7169575356263551 0.7155478936740587
1.4096419522965107
55.0 0.6399412924332541 0.6385023724414035
1.4389199918506392
60.0 0.5580000151941596 0.5565974504424106
1.4025647517490825
65.0 0.47175531000231463 0.47045650110206116
1.298808900253448
70.0 0.38186541230256915 0.38073509637702
1.130315925549155
75.0 0.28902005775281664 0.2881160387584101
0.904018994406556
80.0 0.19393485504259525 0.19330429084661938
0.6305641959758645
85.0 0.0973452256503901 0.09702127714238581
0.3239485080042783
Delta between longitudes = 0.1 (deg)
Latitude(deg) Ellipsoid(km) Sphere(km)
delta(meters)
0.0 11.131949079322641 11.13194907934957
2.692831913009286E-8
5.0 11.08987061252135 11.08958864158325
0.2819709381001303
10.0 10.96393636486906 10.962829717772614
1.1066470964451582
15.0 10.755048780265458 10.752637021035254
2.4117592302045523
20.0 10.46470847566653 10.460610249336627
4.0982263299029
25.0 10.095008799596467 10.088971906834137
6.036892762331263
30.0 9.648627718998803 9.640550389978836
8.077329019966783
35.0 9.128816583259336 9.118758464956947
10.05811830238963
40.0 8.539385247966706 8.527567286659664
11.817961307042424
45.0 7.8846830089999695 7.871476182292002
13.206826707967593
50.0 7.169574827599109 7.155478406897489
14.096420701620445
55.0 6.39941238476242 6.385023139543167
14.389245219253098
60.0 5.579999626076697 5.565974009833259
14.02561624343707
65.0 4.717552614140225 4.704564479153118
12.988134987107514
70.0 3.818653699556946 3.8073503945816474
11.303304975298488
75.0 2.8902002386885184 2.8811600889135227
9.040149774995825
80.0 1.9393483140858256 1.933042434481714
6.305879604111624
85.0 0.9734521351142168 0.9702131633799607
3.238971734256097
Delta between longitudes = 1.0 (deg)
Latitude(deg) Ellipsoid(km) Sphere(km)
delta(meters)
0.0 111.31949079322642 111.31949079326246
3.604509402066469E-8
5.0 110.89869553973436 110.8958758303873
2.8197093470662367
10.0 109.6393221056147 109.62825563618095
11.066469433731982
15.0 107.5503972719354 107.52627970189245
24.117570042944863
20.0 104.64693093380886 104.6059487323737
40.982201435166644
25.0 100.94986143105032 100.88949263839062
60.36879265970492
30.0 96.48597408441964 96.40520105245892
80.77303196072171
35.0 91.28778845027853 91.18720767602323
100.58077425530064
40.0 85.39340913015818 85.27523012385468
118.1790063035005
45.0 78.84633471022002 78.71426727213426
132.06743808575266
50.0 71.6952196063252 71.55425643850035
140.96316782484064
55.0 63.9935842734606 63.84969302685498
143.89124660562084
60.0 55.79947039335792 55.659215552649066
140.25484070885432
65.0 47.175039232263096 47.045159223665266
129.88000859782915
70.0 38.1861132933543 38.07308148095403
113.03181240027334
75.0 28.901663548081412 28.811263117056082
90.40043102532945
80.0 19.393246801387026 19.330188764719583
63.05803666744032
85.0 9.734399961888634 9.702010694567285
32.3892673213486
Delta between longitudes = 10.0 (deg)
Latitude(deg) Ellipsoid(km) Sphere(km)
delta(meters)
0.0 1113.1949079327344 1113.1949079327371
2.7939677238464355E-9
5.0 1108.9763376391795 1108.9481410328883
28.19660629122518
10.0 1096.3515545709338 1096.2408948962507
110.6596746831201
15.0 1075.4131847022704 1075.172031003202
241.1536990685854
20.0 1046.3150761097374 1045.9053169944357
409.7591153017711
25.0 1009.2714935842372 1008.6679446577012
603.5489265359938
30.0 964.5559669442339 963.7484944716215
807.4724726123968
35.0 912.4997712220787 911.4943836106073
1005.3876114714658
40.0 853.4900138892174 852.3088415647851
1181.172324432293
45.0 787.9673036110453 786.6474626653888
1319.8409456564113
50.0 716.42297700166 715.0143877102034
1408.5892914566211
55.0 639.3958647022039 637.9581675945327
1437.697107671178
60.0 557.4685858573904 556.0673605521295
1401.225305260974
65.0 471.2633705226865 469.9659116003878
1297.4589222986833
70.0 381.43742227292074 380.3083584609918
1129.063811928907
75.0 288.6778476396906 287.7749030439621
902.9445957284188
80.0 193.69619412615276 193.06638201745182
629.8121087009495
85.0 97.22265341992157 96.89916450578704
323.48891413453384
Delta between longitudes = 100.0 (deg)
Latitude(deg) Ellipsoid(km) Sphere(km)
delta(meters)
0.0 11131.949079327342 11131.949079327356
1.4901161193847656E-8
5.0 11074.491873849898 11074.254894524236
236.97932566329837
10.0 10904.359976941214 10903.418765269173
941.2116720415652
15.0 10627.860778648377 10625.775928024572
2084.850623805076
20.0 10254.301299970357 10250.697903355796
3603.3966145608574
25.0 9794.653276021594 9789.266119389758
5387.156631836668
30.0 9260.333396774788 9253.04585258056
7287.5441942270845
35.0 8662.315888923762 8653.180752132841
9135.136790921912
40.0 8010.615952982325 7999.854606853046
10761.346129279584
45.0 7314.0750071550565 7302.057954675393
12017.052479662932
50.0 6580.346792131377 6567.561468135687
12785.32399568893
55.0 5815.995557198364 5803.007346970454
12988.210227909498
60.0 5026.644058681537 5014.055202274522
12588.856407014653
65.0 4217.13394292686 4205.543591693387
11590.351233473979
70.0 3391.679088879379 3381.6466553441437
10032.433535235468
75.0 2554.0038003717677 2546.0169769587187
7986.823413048871
80.0 1707.4641604261387 1701.9125003059328
5551.660120205954
85.0 855.1541883143486 852.3088415647799
2845.3467495687073


import org.geotools.cs.Ellipsoid;
import org.geotools.units.Unit;
import com.bbn.openmap.geo.Geo;
import com.bbn.openmap.proj.GreatCircle;

//calculating great circle distances using ellipsoid with Geotools
double km = 1d/1000d; //do the division now and use to convert meters
to km when desired.
//create an ellipsoid earth model based on WGS84
Ellipsoid ellip = Ellipsoid.WGS84; //only instantiate an Ellipsoid
once!
//get the distance in meters given long1, lat1, long2, lat2. Note the
order!
//call ellip.orthodromicDistance whenever needed to calculate distance
double distance = ellip.orthodromicDistance(117.5, 34,117.55,34.01);
System.out.println(distance*km);

//you can also create your own ellipsoid and make it spherical if
desired:
Unit meter = Unit.METRE;
Ellipsoid sphere =
Ellipsoid.createEllipsoid("earth-sphere",6378137.0,6378137.0,meter);

//calculate great circle distance using OpenMap spherical model
//note: coordinates order is different than Geotools
Float om_distance =
GreatCircle.spherical_distance(lat1,long1,lat2,long2);

Tony


--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Thu Sep 30 2004 - 11:12:12 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:06 EDT