{"id":2726,"date":"2025-12-23T10:00:20","date_gmt":"2025-12-23T15:00:20","guid":{"rendered":"https:\/\/www.mymiller.name\/wordpress\/?p=2726"},"modified":"2025-12-23T10:00:20","modified_gmt":"2025-12-23T15:00:20","slug":"geo-latitude-longitude","status":"publish","type":"post","link":"https:\/\/www.mymiller.name\/wordpress\/geo\/geo-latitude-longitude\/","title":{"rendered":"Geo &#8211; Latitude &#038; Longitude"},"content":{"rendered":"\n<p>A few years back, I was working for a customer that was going to begin project that would involve GPS, and Geo-Fencing of items they were tracking.  In preparation of this work, I put together some classes that would assist working with the Geo-Fence.  <\/p>\n\n\n\n<p>The first class here, is a simple Coordinate class that would be the base of doing Longitude and Latitude:<\/p>\n\n\n\n<div class=\"wp-block-coblocks-gist\"><script src=\"https:\/\/gist.github.com\/Ghost-Programmer\/2d87cdea8e80d6aa81f4cf0ef0b4c076.js\"><\/script><noscript><a href=\"https:\/\/gist.github.com\/Ghost-Programmer\/2d87cdea8e80d6aa81f4cf0ef0b4c076\">View this gist on GitHub<\/a><\/noscript><\/div>\n\n\n\n<p>Takes a Degree amount, and stores it.  Notice this is an abstract class, you need to implement the getDegreeLimit() for derived classes.  Longitude allows up to 180 degrees, and Latitude allows up to 90 degrees.<\/p>\n\n\n\n<div class=\"wp-block-coblocks-gist\"><script src=\"https:\/\/gist.github.com\/Ghost-Programmer\/f2f9146e32e44f7d4ccc4382366a8690.js\"><\/script><noscript><a href=\"https:\/\/gist.github.com\/Ghost-Programmer\/f2f9146e32e44f7d4ccc4382366a8690\">View this gist on GitHub<\/a><\/noscript><\/div>\n\n\n\n<p>Can see that we call setDecimal() in the constructor in to set the value of the degree.  We have the getDegreeLimit() implemented limiting us to 180 for the degree range.<\/p>\n\n\n\n<div class=\"wp-block-coblocks-gist\"><script src=\"https:\/\/gist.github.com\/Ghost-Programmer\/7d3b58f8bc767319fbddcc00b9f106bf.js\"><\/script><noscript><a href=\"https:\/\/gist.github.com\/Ghost-Programmer\/7d3b58f8bc767319fbddcc00b9f106bf\">View this gist on GitHub<\/a><\/noscript><\/div>\n\n\n\n<p>Next time we will be discussing the GeoLocation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Latitude and Longitude implementation for Geo API.<\/p>\n","protected":false},"author":1,"featured_media":2725,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[454],"tags":[291,69],"series":[288],"class_list":["post-2726","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-geo","tag-geo","tag-java-2","series-geo"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2020\/04\/globe-71443_640.jpg?fit=640%2C426&ssl=1","jetpack-related-posts":[{"id":2728,"url":"https:\/\/www.mymiller.name\/wordpress\/geo\/geo-location\/","url_meta":{"origin":2726,"position":0},"title":"Geo &#8211; Location","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"So we have Latitude and Longitude, putting those together we have a location now. That is simple enough, but once we have a location, we can use that to derive other locations. Deriving new locations We create the addDistanceEast(), addDistanceWest(), addDistanceNorth(), and addDistanceSouth() methods to generate a new location-based on\u2026","rel":"","context":"In &quot;Geo&quot;","block_context":{"text":"Geo","link":"https:\/\/www.mymiller.name\/wordpress\/category\/geo\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2020\/04\/street-map-2679271_640.jpg?fit=640%2C332&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2020\/04\/street-map-2679271_640.jpg?fit=640%2C332&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2020\/04\/street-map-2679271_640.jpg?fit=640%2C332&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3704,"url":"https:\/\/www.mymiller.name\/wordpress\/spring_databases\/mastering-location-data-with-spring-jpa-a-comprehensive-guide\/","url_meta":{"origin":2726,"position":1},"title":"Mastering Location Data with Spring JPA: A Comprehensive Guide","author":"Jeffery Miller","date":"November 24, 2025","format":false,"excerpt":"In today\u2019s interconnected world, location data plays a pivotal role in numerous applications, from e-commerce and logistics to travel and social networking. Efficiently managing and accessing this wealth of geographical information is crucial for developers. This article delves into the realm of location data management using Spring JPA (Java Persistence\u2026","rel":"","context":"In &quot;Spring Databases&quot;","block_context":{"text":"Spring Databases","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spring_databases\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/international-1751293_1280.png?fit=1186%2C1200&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/international-1751293_1280.png?fit=1186%2C1200&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/international-1751293_1280.png?fit=1186%2C1200&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/international-1751293_1280.png?fit=1186%2C1200&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/international-1751293_1280.png?fit=1186%2C1200&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":2730,"url":"https:\/\/www.mymiller.name\/wordpress\/geo\/geo-line\/","url_meta":{"origin":2726,"position":2},"title":"Geo &#8211; Line","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"One of the simplest shapes we can make is GeoLine. It consists of two GeoLocations the start, and end of the line. The line is the simplest of shapes but is used by other shapes to make their structure. View this gist on GitHub","rel":"","context":"In &quot;Geo&quot;","block_context":{"text":"Geo","link":"https:\/\/www.mymiller.name\/wordpress\/category\/geo\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2020\/04\/chart-1110428_640.jpg?fit=640%2C257&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2020\/04\/chart-1110428_640.jpg?fit=640%2C257&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2020\/04\/chart-1110428_640.jpg?fit=640%2C257&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":2734,"url":"https:\/\/www.mymiller.name\/wordpress\/geo\/geo-fence\/","url_meta":{"origin":2726,"position":3},"title":"Geo &#8211; Fence","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"Every need to define an area and determine if a location is within that range? This is called a GeoFence. Very handy and useful for any kind of GPS tracking. Define the GeoFence area, then you can use checkInside() to see if a GeoLocation is inside or outside of the\u2026","rel":"","context":"In &quot;Geo&quot;","block_context":{"text":"Geo","link":"https:\/\/www.mymiller.name\/wordpress\/category\/geo\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2020\/04\/map-2789052_640.jpg?fit=640%2C426&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2020\/04\/map-2789052_640.jpg?fit=640%2C426&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2020\/04\/map-2789052_640.jpg?fit=640%2C426&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":2732,"url":"https:\/\/www.mymiller.name\/wordpress\/geo\/geo-path\/","url_meta":{"origin":2726,"position":4},"title":"Geo &#8211; Path","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"Once you have GeoLocations, you can then make shapes for them. So we create a GeoShape Interface that allows us to define our shape. View this gist on GitHub We implement a forEach() method to be able to act on each location in the shape, and a getGeoPath() to return\u2026","rel":"","context":"In &quot;Geo&quot;","block_context":{"text":"Geo","link":"https:\/\/www.mymiller.name\/wordpress\/category\/geo\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2020\/04\/treasure-map-1850653_640.jpg?fit=640%2C426&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2020\/04\/treasure-map-1850653_640.jpg?fit=640%2C426&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2020\/04\/treasure-map-1850653_640.jpg?fit=640%2C426&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3370,"url":"https:\/\/www.mymiller.name\/wordpress\/java_new_features\/sealed-classes\/","url_meta":{"origin":2726,"position":5},"title":"Sealed Classes","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"Java 15 introduced a new feature called Sealed Classes, which allows developers to restrict the types that can extend a class or implement an interface. This feature is designed to improve code safety and maintainability by enforcing a set of rules that limit the hierarchy of classes and interfaces. In\u2026","rel":"","context":"In &quot;Java New Features&quot;","block_context":{"text":"Java New Features","link":"https:\/\/www.mymiller.name\/wordpress\/category\/java_new_features\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/06\/letter-g26b7a9ac7_640.jpg?fit=640%2C427&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/06\/letter-g26b7a9ac7_640.jpg?fit=640%2C427&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/06\/letter-g26b7a9ac7_640.jpg?fit=640%2C427&ssl=1&resize=525%2C300 1.5x"},"classes":[]}],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/2726","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/comments?post=2726"}],"version-history":[{"count":3,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/2726\/revisions"}],"predecessor-version":[{"id":2750,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/2726\/revisions\/2750"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/media\/2725"}],"wp:attachment":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/media?parent=2726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/categories?post=2726"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/tags?post=2726"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/series?post=2726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}