3

I have created my own fantasy map, I have the map in a full size png and the map broken down into tiles ( with no geo data )

I installed MS4W and tried to use it to get the georeference data put is seems the program got stuck while trying to do the 4th step here

this is my info I got from the 3rd step:

-Size is 4961, 3231

-Coordinate System is `'

  • Image Structure Metadata: -INTERLEAVE=PIXEL
  • Corner Coordinates:
  • 1st corner Upper Left( 0.0, 0.0 )
  • 2nd corner Lower Left ( 0.0, 3231.0 )
  • 3rd corner Upper Right ( 4961.0, 0.0 )
  • 4th corner Lower Right ( 4961.0, 3231.0 )
  • Center ( 2480.5, 1615.5 )
  • Band 1 Block=4961x1 Type=UInt16, ColorInterp=Red
  • Band 2 Block=4961x1 Type=UInt16, ColorInterp=Green
  • Band 3 Block=4961x1 Type=UInt16, ColorInterp=Blue
  • Band 4 Block=4961x1 Type=UInt16, ColorInterp=Alpha

4th step said something about -gcp not available or something

Could someone get my png georeferenced and into a kml or csv file for me so that I can continue my project, or help me with using the right code to continue on

here is my map png

5
  • 1
    your png file is not georeferenced, you need a .pngw file: look at World file
    – gene
    Jan 27, 2014 at 16:31
  • 1
    I know it's not thats why I was asking on how to do it or if someone could do it for me as I ran into troubles doing it with GDAL on my end, did you not read my post and questions ?
    – kipslacher
    Jan 27, 2014 at 17:39
  • You need a Spatial reference system
    – gene
    Jan 27, 2014 at 18:10
  • ok you have lost me now, I have no idea whats going on. all I want is the image I provided in kml and/or csv format. It is obvious I am way out of my league here in doing this with my image, so I am gonna need some serious help. If you know of any free software or online tools to help me put unlimited markers and routes which will then have images pop up when them dot markers are clicked ill gladly use that, but I have not come across any that are free like this.
    – kipslacher
    Jan 27, 2014 at 18:45
  • look at Georeference
    – gene
    Jan 27, 2014 at 19:06

2 Answers 2

6

Here's a world file for you (as per Gene's suggestion). Cut and paste the following into a text editor and name the file the same as your full-sized map but give it the extension '.pgw' instead on '.png':

1.0
0.0
0.0
-1.0
0.0
3231.0

I've made the following assumptions:

  1. Your map has a resolution (pixel size) of 1m square (i.e. each pixel is a reasonable stride length for a fantasy game humanoid character). If I am wrong, edit lines 1 and 4 accordingly.
  2. I have assumed that your map is not rotated.
  3. I have assumed that your LL corner is at 0,0 in your world. If your pixel size is bigger than 1m square then you will need to multiply your Y coordinate (3231.0) accordingly.
  4. Technically the UL coordinate (last two lines) is the center of your pixel. I have been lazy and set it to the corner. This in theory means that your coordinates would be consistently half a meter out but it's a fantasy world so nobody will know; it is consistent so won't screw up any distant calculations; and it saves a negative value as one of your origin coordinates. Adjust if you are sufficiently worried :)

I would then re-tile your map from the georeferenced full-sized one (this saves you making a world file for each tile)

Now, if you load your fantasy map into a GIS or similar system, you will probably be asked for the Spatial Reference System (SRS). The World file doesn't encapsulate that. It just locates and orients the image file in space relative to a nominal 0,0 origin. Since this is a fantasy map, all you need to do is pretend that it is in the real world somewhere and pick any coordinate system that gives you a flat projection with units in meters (or feet if you prefer but you will may have to adjust the values for resolution in the world file). A couple of suggestions for SRS could be:

  • EPSG: 3857 (aka 900913)
  • EPSG: 27700 (UK National Grid - the advantage of a national grid system UK or otherwise, is that you mostly stay clear of the poles and the international dateline and can hopefully avoid any weirdness which may result from such a location)

Your choice might not matter at all... on the other hand, you choice of SRS might be influenced by what you intend to do with your KML/CSV file (like you might be making a game with a post-apocalyptic theme but set in Quebec ...with zombies...). If you are using Google Earth or similar as a 'platform' for your game/fantasy world, so long as all your other data are in the same coordinate system, all should be well.

However, I do wonder if you may be better sticking with your PNG file as a text format like KML/CSV will be big. A PNG may be better for an internet-based game (reducing bandwidth). If you have a stand-alone scenario, most programming languages understand image formats well (especially if you call the GDAL libraries) and so I'm not convinced that a text-based format is even necessary here - but that's your choice of course.

3
  • Thanks Mapps for that info it's a lot to take in. All I am looking to do is make a interactive map where people can zoom in and out of it and look at markers or routes etc that will have a legend to choose what shows up. I am wanting to make markers for the towns, dungeons, castles, mobs, bosses etc on each of the markers I want a pop-up image of a image that contains a small map of the town or castle or dungeon or image of the mob or boss. It's gonna serve as a guide and tool players can use.
    – kipslacher
    Jan 27, 2014 at 20:54
  • This here is basically what I want it do do but of course I will be adding markers and routes etc maps.marlam.in/…
    – kipslacher
    Jan 27, 2014 at 23:30
  • Ok I have my image and tiles in the google api i think using photoshop and a java script it zooms and everything what do I do next ? here dropbox.com/sh/3mi2aqmrizqvfcx/hrsN3cE6-j you can find the index.html and the tiles folder
    – kipslacher
    Jan 28, 2014 at 4:19
1

So I found a script to use and it works great on my own browser but haven't figured out how to get it working yet. Every time I add the script to my web page nothing happens just keeps saying uploading tiles.

Archlord World Map html, body { height: 100%; margin: 0; padding: 0; } #map { width:100%; height:100%; color: #CCC; background: #EFEFEF; } span.loading { display: block; text-align: center; font: 300 italic 72px/400px "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif; } loading tiles...

        /*
         * = PS_Bramus.GoogleMapsTileCutter Config
         * ----------------
         */

            var repeatOnXAxis = false; // Do we need to repeat the image on the X-axis? Most likely you'll want to set this to false



        /*
         * Helper function which normalizes the coords so that tiles can repeat across the X-axis (horizontally) like the standard Google map tiles.
         * ----------------
         */

            function getNormalizedCoord(coord, zoom) {
                if (!repeatOnXAxis) return coord;

                var y = coord.y;
                var x = coord.x;

                // tile range in one direction range is dependent on zoom level
                // 0 = 1 tile, 1 = 2 tiles, 2 = 4 tiles, 3 = 8 tiles, etc
                var tileRange = 1 << zoom;

                // don't repeat across Y-axis (vertically)
                if (y < 0 || y >= tileRange) {
                    return null;
                }

                // repeat across X-axis
                if (x < 0 || x >= tileRange) {
                    x = (x % tileRange + tileRange) % tileRange;
                }

                return {
                    x: x,
                    y: y
                };

            }


        /*
         * Main Core
         * ----------------
         */

            window.onload = function() {

                // Define our custom map type
                var customMapType = new google.maps.ImageMapType({
                    getTileUrl: function(coord, zoom) {
                        var normalizedCoord = getNormalizedCoord(coord, zoom);
                        if(normalizedCoord && (normalizedCoord.x < Math.pow(2, zoom)) && (normalizedCoord.x > -1) && (normalizedCoord.y < Math.pow(2, zoom)) && (normalizedCoord.y > -1)) {
                            return zoom + '_' + normalizedCoord.x + '_' + normalizedCoord.y + '.jpg';
                        } else {
                            return 'empty.jpg';
                        }
                    },
                    tileSize: new google.maps.Size(256, 256),
                    maxZoom: 5,
                    name: 'PS_Bramus.GoogleMapsTileCutter'
                });

                // Basic options for our map
                var myOptions = {
                    center: new google.maps.LatLng(0, 0),
                    zoom: 2,
                    minZoom: 0,
                    streetViewControl: false,
                    mapTypeControl: false,
                    mapTypeControlOptions: {
                        mapTypeIds: ["custom"]
                    }
                };

                // Init the map and hook our custom map type to it
                var map = new google.maps.Map(document.getElementById('map'), myOptions);
                map.mapTypes.set('custom', customMapType);
                map.setMapTypeId('custom');

            }
    </script>

</body>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.