Google Maps API - Possible to make a custom map from an image (e.g. game map)
38 replies, posted
snip figured it out
[QUOTE=Marlamin;35995644]I made this a while back: [url]http://marlamin.com/gmaps/[/url]
... Photoshop's scripting environment.
Grab [url=http://marlamin.com/u/2012.05.17-23.19.19.log]this script[/url]. [/QUOTE]
In the script, we can use:
[CODE]var AD=activeDocument;
var Name = app.activeDocument.name.replace(/\.[^\.]+$/, '');
var FolderPath = AD.path + "/" + Name + " Map Tiles/";
Folder (FolderPath).create();[/CODE]
for FolderPath (this will create a sibling folder aside the Photoshop File to save the tiles). With that, the script could be saved to the Install Path of Photoshop (in my case it's "C:\Program Files\Adobe\Adobe Photoshop CC 2014") Then put the script file in Presets/Scripts/ and it'll always be on the menu (instead of browsing)
Hey there, I am hoping to find success with this like all the others did, so again, sorry for the thread necromancy. ...
I got the html set up, the image files sliced and a local test directory set up.
But no image shows up when i load the html in a browser. I think i have changed the paths to be correct - but do i need to do more?
right now its set to =
var baseURL = 'D:\Map';
just to test locally before i upload all these images...
What am I doing wrong?
Thanks!
EDIT== Never mind, my directory was simply formatted wrong.
This works perfectly!
[editline]14th May 2015[/editline]
Ok, so a better question would be = does anyone have an already complete set of map markers and the javascript to read them for the stuff SteamDB made above?
I would really appreciate an example of map markers for this.
Thanks!
[QUOTE=renleyx;47723604]
Ok, so a better question would be = does anyone have an already complete set of map markers and the javascript to read them for the stuff SteamDB made above?
I would really appreciate an example of map markers for this.
Thanks![/QUOTE]
Glad you got it working.
Here's the official Marker example from the Google Maps API documentation. Should be simple to implement.
[url]https://developers.google.com/maps/documentation/javascript/examples/marker-simple[/url]
That was it! Thanks!
Now I just need to add the code to read these locations from a file along with their info window's and i am all set!
I will look for a link to that here now, unless anyone has one they would like to share.
Thanks!
I made a GIMP script-fu to generate tiles out of a single large image file. I've only tested it on square maps, so YMMV with non-square sizes. It creates as many zoom levels as you specify, with the lowest zoom level being the entire map on a single tile of the specified size, and each successive level being twice the size. It allows you to set the interpolation separately for growing and shrinking, since I was using it on a map from a retro game, so I wanted it to keep it pixel-perfect when growing, but interpolate nicely when shrinking. You can also choose .jpg or .png output formats. I figured I'd share in case it was useful to anybody.
[CODE]; Google Maps Tiles, V1.0
; script-fu-google-maps-tiles.scm
;
; Based on the tiles-to-files script by theilr
; http://registry.gimp.org/node/20868
;
; http://www.qwertymodo.com
;
(define (script-fu-google-maps-tiles inImage inDrawable inTileSize inMaxZoom
inFileType inShrinkMethod inGrowMethod outDir)
(gimp-image-undo-group-start inImage)
(let* (
(fullWidth (car (gimp-image-width inImage)))
(fullHeight (car (gimp-image-height inImage)))
(tileWidth inTileSize)
(tileHeight inTileSize)
(zoomWidth tileWidth)
(zoomHeight tileHeight)
(newImage (car (gimp-image-new tileWidth tileHeight RGB)))
(tmpImage)
(tmpLayer)
(selLayer)
(outfname)
(hcnt 0)
(vcnt 0)
(zcnt 0)
)
(set! zcnt 0)
(while (<= zcnt inMaxZoom)
(set! zoomWidth (* tileWidth (expt 2 zcnt)))
(set! zoomHeight (* tileHeight (expt 2 zcnt)))
(gimp-rect-select inImage
0
0
fullWidth
fullHeight
CHANNEL-OP-ADD FALSE 0)
(gimp-edit-copy-visible inImage)
(gimp-selection-none inImage)
(set! tmpImage
(car (gimp-image-new zoomWidth zoomHeight RGB)))
(set! tmpLayer
(car (gimp-layer-new tmpImage fullWidth fullHeight
RGB-IMAGE "Background" 100
NORMAL-MODE)))
(gimp-image-add-layer tmpImage tmpLayer -1)
(set! selLayer
(car (gimp-edit-paste tmpLayer FALSE)))
(gimp-floating-sel-anchor selLayer)
(if (< zoomWidth fullWidth)
(begin
(gimp-context-set-interpolation inShrinkMethod)
(gimp-layer-scale tmpLayer zoomWidth zoomHeight FALSE)
(gimp-image-resize-to-layers tmpImage)
)
)
(if (> zoomWidth fullWidth)
(begin
(gimp-context-set-interpolation inGrowMethod)
(gimp-layer-scale tmpLayer zoomWidth zoomHeight FALSE)
(gimp-image-resize-to-layers tmpImage)
)
)
(set! hcnt 0)
(while (< (* hcnt tileWidth) zoomWidth)
(set! vcnt 0)
(while (< (* vcnt tileHeight) zoomHeight)
(gimp-rect-select tmpImage
(* tileWidth hcnt)
(* tileHeight vcnt)
tileWidth
tileHeight
CHANNEL-OP-ADD FALSE 0)
(gimp-edit-copy-visible tmpImage)
(gimp-selection-none tmpImage)
(set! tmpLayer
(car (gimp-layer-new newImage tileWidth tileHeight
RGB-IMAGE "Background" 100
NORMAL-MODE)))
(gimp-image-add-layer newImage tmpLayer -1)
(set! selLayer
(car (gimp-edit-paste tmpLayer FALSE)))
(gimp-floating-sel-anchor selLayer)
(if (= inFileType 0)
(begin
(set! outfname (string-append outDir
"/"
(number->string zcnt)
"-"
(number->string hcnt)
"-"
(number->string vcnt)
".png"))
(file-png-save RUN-NONINTERACTIVE
newImage
tmpLayer
outfname
outfname
0 9 1 0 0 1 1 )
)
)
(if (= inFileType 1)
(begin
(set! outfname (string-append outDir
"/"
(number->string zcnt)
"-"
(number->string hcnt)
"-"
(number->string vcnt)
".jpg"))
(file-jpeg-save RUN-NONINTERACTIVE
newImage
tmpLayer
outfname
outfname
0.95 ; JPEG compression level
0 ; Smoothing
1 ; Optimize
1 ; Progressive
"" ; Comment
0 ; Subsampling (0-4)
1 ; Baseline
0 ; Restart
0 ; DCT
)
)
)
(set! vcnt (+ vcnt 1))
)
(set! hcnt (+ hcnt 1))
)
(gimp-image-delete tmpImage)
(set! zcnt (+ zcnt 1))
)
(gimp-image-delete newImage)
(gimp-image-undo-group-end inImage)
(gimp-displays-flush)
)
)
(script-fu-register
"script-fu-google-maps-tiles" ; function name
"<Image>/Filters/Tiles/_Google Maps" ; menu label
"Split an image into tiles suitable\ ; description
for use with Google Maps API"
"qwertymodo" ; author
"(c) 2015, qwertymodo" ; copyright notice
"25 May 2015" ; date created
"RGB*" ; image type
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT "Tile Size (px)" '(128 8 1024 1 8 0 SF-SPINNER)
SF-ADJUSTMENT "Max Zoom Level" '(4 0 10 1 2 0 SF-SPINNER)
SF-OPTION "Output File Type" '("png" "jpg")
SF-ENUM "Interpolation (Shrink)" '("InterpolationType" "cubic")
SF-ENUM "Interpolation (Grow)" '("InterpolationType" "cubic")
SF-DIRNAME "Output Folder" "tiles"
)[/CODE]
I have no idea how to use the google maps api but I'm trying blindly to create a map, I found your post, I'll calmly read and see if I can get something
I think I got it, it's not the google maps api but it's similar to http://www.eftmap.pixelheart.com.br/customs-apartments-cff.html
Don't bump threads for 3 years ago.
Sorry, you need to Log In to post a reply to this thread.