World map for java

World map for java

Good introductions to map projections include: the University of Colorado and the United States Geological Service. Hans Havlicek has an impressive gallery. There are useful collections of formulae at the Escola Universit�ria Polit�cnica Barcelona en espa�ol (e catal�) and at MathWorld. For links there is Oddens’ bookmarks, aussi Liens Utiles en fran�ais, e Geogr@afia on line em portugu�s. Some other pages link here.

Lines on the image: In an attempt to illustrate how different maps distort areas differently, the sea in the image above shows a division of the earth into roughly equal area «rectangles» (and «triangles» near the poles, thought some projections show these as rectangles). Lines of longditude (meridians) are shown roughtly about every 15 degrees (so at 0 and +/- 15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, and 180 degrees) while lines of latitude (parallels) are shown less evenly (at about 0 and +/- 14.6, 30, 48.6, and 90 degrees, i.e. the angles whose sines are 0 and +/- 1/4, 1/2, 3/4 and 1). Each rectangle (including those obscured by land) therefore covers about 1/192 of the earth or just over 0.5%.

Scaling: Each projection shown in the applet has its own particular properties. In some cases these can be affected by scaling the X and Y axes on the map just by clicking on the map to give a new right hand corner.

As an example, the Mercator projection is conformal and can be used for navigational purposes since angles on the map represent bearings on a compass (and so straight lines are loxodromes); any scaling needs to preserve this property — but since a complete Mercator projection is of infinite height, different rectangles can include different amounts of northern and southern extremities.

Similarly the polar azimuthal projections keep lines of lattitude as concentric circles, and this needs to be preserved in scaling; but for the infinite gnomonic and stereographic maps, different amounts of the sphere can be included at different scales (the gnomonic projection — which is conformal and projects great circles to straight lines — cannot even cover a hemisphere, while the streographic projection can almost cover the whole sphere but only at the cost of losing much of the interesting detail. When centred on the North Pole, the azimuthal equal distance projection is essentially the same, minus Antartica, as the symbol of the United Nations and, more curiously, as the prefered map of the Flat Earth Society.

For the plain Longitude/Latitude, Equal Area Cylindrical, Mollweide and Triangular projections, scaling can be done almost freely, enabling different lines of latitude to have distances consistent with those on the prime meridian near that line of latitude.

Читайте также:  Вывод тегов

A scaled Equal Area Cylindrical projection is known as a «secant» rather than the basic «tangent» projection, but the difference is in fact minor. Despite this, the various names for this projection includes the Lambert Cylindrical Equal Area, Behrmann Cylindrical Equal Area, Tristran Edwards, Peters, Gall Orthographic, and Balthasart projections. The claims made for the originality and political importance of the Peters projection are particularly odd — there were already many equal area projections.

The Baar equal area projection produces various results in between the Cylindrical equal area and the Sinusoidal equal area projections. Specific examples include the Adams and Kavraisky V projections. This idea of finding intermediate projections is common, with the aim of reducing the worst distortions of the extremes.

Many conical projections can be seen as azimuthal projections which have been split and partially unwound.

The triangular projection is simply there to show that virtually anything is possible (its properties are that it preserves areas, it has lines of latitude as horizontal lines, and it fits inside a triangle — it is slightly similar to a sinusoidal projection at the top, and to the cylindrical projection at the bottom). Its use is not recomended for any purpose.

Changing the centre of the map can for example enable Pacific islanders to feel as if they are at the centre of the earth, rather than at the edge. Most maps of the world tend to put the centre close to the west coast of Africa (where the Greenwich meridian meets the equator), but this leads to major distortions near the poles, and so it is common to produce additional azimuthal projections with polar centres.

Changing the direction. A transverse projection is at right angles to a standard projection. The Transverse Mercator is currently popular for navigation (away from the poles). A reverse projection is at two right angles (i.e. upside down), perhaps so the penguins can feel superior to the polar bears. An oblique projection is at any other angle, and is harder to calculate. This version uses a different method to that used in the earlier applet and is probably marginally more accurate and faster when producing oblique projections, but it is certainly slower when rescaling.

Return to top Java code Earlier version Java and JavaScript examples Distances on the surface of a cuboid Circumnavigating a platonic solid Map of London Borough of Southwark

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Java library for generating flat world maps with sun/night reflection at a given time

License

Ozzyboshi/WorldMap

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Читайте также:  Kodi java runtime environment

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Worldmap is a java library jar file for creating a sun/night world map at a specific time. Inside the jar file you’ll find 2 packages:

  • com.ozzyboshi.worldmap.androidgraphics : meant to be used in android projects
  • com.ozzyboshi.worldmap.awt : meant to be used in awt projects

This project is based on This tutorial. The php code in this tutorial was translated by me into java style classes, thank you edesign.nl.

WorldMap output live demo

This is a live demo of the library, this image is created dynamically with java Jersey and the WorldMap library on top of a TOMCAT 8 Java applicaton server.You can find the code in the example paragraph.

Github images caching system could cause the above image to be not live updated, if this is the case you can visit http://meteo.ozzyboshi.com:8082/WeatherStation/MeteoServices/Readings/WorldImage for a dynamic real time version.

In order to use this class you’ll need 2 world png maps: the WorldMapMaker class is in charge of generating an output image based on the images you provide. You can take advantage of the ones under images/ or create your own, just be sure they both have the same size (same width and height). To generate the jar file you’ll also need Eclipse with Android Developer Tools (ADT) or at least this is what I used. You could also get my precompiled jar file from the release section of github.

In this example I am going to create a new map based on the current pc date and save it as a regular PNG file on my images folder.

public class WorldMapCli < public static void main(String[] args) < WorldMapDrawableimage = new WorldMapAwtDraw(); image.setDayImageFile(new File("images/day.png")); image.setNightImageFile(new File("images/night.png")); try < WorldMapMaker maker = new WorldMapMaker(image, true, false); maker.BuildMapFromUnixTimestamp(System.currentTimeMillis()/1000L); BufferedImage output = (BufferedImage) image.getDestination(); ImageIO.write(output, "PNG", new File("images/output.png")); >catch (ImageSizeDifferentException e) < e.printStackTrace(); >catch (IOException e) < e.printStackTrace(); >> > 

If you run this code you should get a new images/output.png file with the current Sun/Night WorldMap

You can also generate the output image from InputStream instead using the File class, just use the set(Day|Night)ImageInputStream methods instead of set(Day|Night)ImageFile, this was useful in combination with Jersey (see the demo before):

WorldMapDrawable image = new WorldMapAwtDraw(); image.setDayImageInputStream(Meteo.class.getResourceAsStream("/images/day.png")); image.setNightImageInputStream(Meteo.class.getResourceAsStream("/images/night.png")); try < WorldMapMaker maker = new WorldMapMaker(image, true, false); maker.BuildMapFromUnixTimestamp(System.currentTimeMillis()/1000L); >catch (ImageSizeDifferentException e)

If you want to use this library for your Android project you must use android.graphics instead of awt (or at least this is what Google suggests in his own Android documentation). In the following example I am going to create a Bitmap (instead of an BufferedImage) that is ready to be drawn in a Canvas object.

Drawable day = getResources().getDrawable(R.drawable.day); Drawable night = getResources().getDrawable(R.drawable.night); WorldMapAndroidGraphicsDraw image = new WorldMapAndroidGraphicsDraw(); image.setDayImageFile(day); image.setNightImageFile(night); WorldMapMaker maker = new WorldMapMaker(image, true, false); maker.BuildMapFromUnixTimestamp(System.currentTimeMillis() / 1000L); Bitmap output = image.getDestination(); 

In all the above examples I created the WorldMapMaker object with 2 switched (true/false):

  • the first switch (second parameter) if true prints mixed pixels in the dawn/dusk zone so it is smoother.
  • the second switch (third parameter) if true prints a black pixel in the night zone, in this case the night image is ignored even if (for now) the setNightImageFile call is mandatory.
Читайте также:  Css style display flex

This project (as the code I found in the tutorial I mentioned before) is licensed under the MIT License, you can freely use it in your project and distribute. As always I am looking for contribution so, if you improve my code please submit a pull request, I will be happy to merge your code.

About

Java library for generating flat world maps with sun/night reflection at a given time

Источник

Creating interactive maps and Geo Visualizations in Java

Unfolding is a library to create interactive maps and geo visualizations in Processing and Java. In this article, we will discuss what are the features of unfolding and how it is used to create interactive maps in Java and Processing.
The main purpose of using unfolding is to create not only static maps but also interactive maps in both java and processing. It can easily be installed on eclipse by downloading the unfolding template from the official website. It is widely used due to the features provided by unfolding like:

  1. Interaction Events: In unfolding, we can easily create interactive maps. The basic interactions like zoom and pan are included in this library. Apart from these, more advanced features like overview, details or multitouch gestures can also be easily added to the maps.
  2. Data Visualization: This library is very robust that it even lets users create geo-positioned markers to display the data on a map. This visual style can be freely adapted. This library also supports users to load and display user-defined shapes like points, lines or polygons.
  3. Styled Maps: This library is a title-based map library. This library allows map titles to have various geographic features and styles. It also comes with map providers like OpenStreetMap or TileMill.
  4. Clean & Extendable Code: This library allows the beginners to easily create simple maps. Advanced users can also sketch their prototypes or create their own sophisticated visualizations.

Approach:
In this implementation, let’s consider to draw two maps, one is Delhi and the other is Mumbai using this library. The map created is interactive as we can zoom in and zoom out. We need to set up our maps using the latitude and the longitude of the place. The draw function in the program runs repeatedly and draws the map repeatedly on the canvas.
Below is the implementation of the above approach:

Источник

Оцените статью