Custom maps/coordinates - php

I'm looking for a quick way to drop in a map for something like Minecraft into a pan/zoomable thing, with support for custom coordinates (like defining where is 0,0 or something)
Can't seem to figure this out with google maps, any ideas? I have tile pngs for multiple zoomlevels, I have coordinates, just no clue how to implement it.

There are several ways to get the look and feel of a map.
One huge graphic
In case you've got only one huge picture of the map that is maybe even over 100 MB in size, use the service Zoom.it. Although it's supported by Microsoft and therefore uses Silverlight (JavaScript support available as well, though), it's a handy service. Besides, the homepage also stores the automatically generated tiles and hence serves as a webhoster as well.
Several tiles at different zoom levels
In this case it's probably best to use the Google Maps JavaScript API V3. It helps you realise all your map plans. In your case you'd have to overlay your map on the real world map. To be honest, that does sound weird as all coordinates on your specific map are also related to a region on the map of our beloved planet Earth. However, it works like a charm. Should you need webspace to upload your huge map in advance, use a service like Wuala for this purpose.
All-in-one Map Generator
As you want to create a map of your Minecraft world, it's maybe best to directly use Tectonicus, a deep map renderer that also creates all required HTML pages to render your map using the Google Maps API. You can find an example map here.

Related

How to generate an image of a leaflet drawn map (like a printscreen)

I'm using leaflet to draw maps and put misc layers on top of them.
I want to be able to create "print screens" of the maps in an automated fashion.
I know that first task is client side and second one is server side but I would like to know the steps to achieve this. For the server side I need solutions in PHP
For better understanding what I'm asking, think of a use case which could be generating reports which include images of maps
See the "Print/export" section in the list of Leaflet plugins.
Alternatively, use a headless web browser such as PhantomJS, that will allow you to load webpages without a graphical interface and take screenshots of them.

How can I render OpenStreetMap tiles on-the-fly using PHP?

ers, I need to render OSM tiles on-the fly using PHP without downloading the huge 23GB or so OSM dump. I found this, but it seems to be dead. :/ By the way, I don't want to store anything. If anyone has any ideas, thanks ;)
By the way, I'm using it for a web mapping application for the Nintendo DSi. (link)
PS. I know I could use the public OSM tile sever, but I hate the tile styles. :P
Your question is very vague.
Instead of using the full planet you can download any custom area you like by specifying a bounding box using either the regular API or the Overpass API. The latter also allows you to filter for specific data, for example highways. Or you can use a country extract.
Alternatively you can just use different tiles if you don't like the default style. There are many many pre-rendered OSM maps with different styles. For example Cloudmade offers a huge choice of different styles and you can even create your own one.
A third option is to look at one of the many other rendering applications for OSM.
And whether you are allowed to use the official tiles or not depends on the tile usage policy. Note that there are also (different) policies for tiles from different providers.

How to highlight areas in map with php?

I have a country map in .png format, I need to highlight specific states in this map dynamically using PHP. What's the best way to do this?
Thanks
You would need to create a list of all the points defining the polygon encasing each state, then use imagepolygon to fill in the appropriate polygons on the map image with some color.
Realistically you probably want to find a 3rd party library/component (i.e. Flash movie, JavaScript map and library, or PHP class designed for this) rather than writing it on your own from scratch. Highlighting a map isn't exactly a new problem and solving it again from scratch is tedious.
If you're talking about US States, I would recommend trying Google Maps, and the following links. I used them for the exact purpose you're talking about (votes by state) recently, and it worked great:
http://econym.org.uk/gmap/example_states2.htm
http://econym.org.uk/gmap/epoly.htm
http://econym.org.uk/gmap/states.xml

Interactive map solution suggestions

I'm looking to browser based map solution like google interactive chart map. I googled and i looked to smilar solution, but i didn't find good solution for it. It should be possible to created on flash, silverlight, ajax etc.
And should be change parameters easyly via javascript or sth. But i didn't like google chart beacuse; you can't change background of map and you can't modify tooltips.
Do you have any suggestions about it ?
Be practical, use Google. Don't be that guy.
Download or use the web based version of Tour de Flex (application for exploring flex capabilities)
Look for the folder Mapping, it gives you four options
-ESRI ArcGS
-Google Maps
-MapQuest Maps
-Yahoo Maps
Tool tip overlay examples are available for Google Maps. I have no clue what you mean by changing the background.... the map is the background. oO (please clarify)
Try jVectorMap. It works faster than Google implementation, looks nicer and has more built-in maps.

Google Maps Overlays

I'm trying to find something, preferably F/OSS, that can generate a Google Maps overlay from KML and/or KMZ data.
We've got an event site we're working on that needed to accommodate ~16,000 place markers last year and will likely have at least that many again this year. Last year, the company that had done the site just fed the KML data directly to the gMaps API and let it place all of the markers client side. Obviously, that became a performance nightmare and tended to make older browsers "freeze" (or at least appear frozen for several minutes at a time).
Ideally this server side script would take the KML, the map's lat/lon center, and the map zoom level and appropriately merge all of the visible place markers into a single GIF or PNG overlay.
Any guidance or recommendations on this would be greatly appreciated.
UPDATE 10/8/2008 - Most of the information I've come across here and other places would seem to indicate that lessening the number of points on the map is the way to go (i.e. using one marker to represent several when viewing from a higher altitude/zoom level). While that's probably a good approach in some cases, it won't work here. We're looking for the visual impact of a US map with many thousand markers on it. One option I've explored is a service called PushPin, which when fed (presumably) KML will create, server side, an overlay that has all of the visible points (based on center lat/lon and zoom level) rendered onto a single image, so instead of performing several thousand DOM manipulations client side, we merge all of those markers into a single image server side and do a single DOM manipulation on the client end. The PushPin service is really slick and would definitely work if not for the associated costs. We're really looking for something F/OSS that we could run server side to generate that overlay ourselves.
You may want to look into something like Geoserver or Mapserver. They are Google map clones, and a lot more.
You could generate an overlay that you like, and Geoserver(I think mapserver does as well) can give you KML, PDF, png, and other output to mix your maps, or you could generate the whole map by yourself, but that takes time.
Not sure why you want to go to a GIF/PNG overlay, you can do this directly in KML. I'm assuming that most of your performance problem was being caused by points outside the user's current view, i.e. the user is looking at New York but you have points in Los Angeles that are wasting memory because they aren't visible. If you really have 16,000 points that are all visible at once for a typical then yes you'll need to pursue a different strategy.
If the above applies, the procedure would be as follows:
Determine the center & extent of the map
Given that you should be able to calculate the lat/long of the upper left and lower right corners of the map.
Iterate through your database of points and check each location against the two corners. Longitude needs to be greater (signed!) than the upper left longitude and less than the lower right longitude. Latitude needs to be less than the upper left latitude (signed!) and greater than the lower right latitude. Just simple comparisons, no fancy calculations required here.
Output the matching points to a temporary KML for the user.
You can feed KML directly into Google Maps and let it map it, or you can use the Javascript maps API to load the points via KML.
It might not solve your exact problem here, but for related issues you might also look into the Google Static Maps API. This allows you to create a static image file with placemarkers on it that will load very quickly, but won't have the interactivity of a regular Google map. Because of the way the API is designed, however, it can't handle anywhere near 16,000 points either so you'd still have to filter down to the view.
I don't know how fare you are with your project but maybe you can take a look at GeoDjango? This modified Django release includes all kinds of tools to store locations; convert coordinates and display maps, the easy way. Offcourse you need some Python experience and a server to run it on, but once you've got the hang of Django it works fast and good.
If you just want a solution for your problem try grouping your results at lower zoom levels, a good example of this implementation can be found here.
This is a tough one. You can use custom tilesets with Google Maps, but you still need some way to generate the tiles (other than manually).
I'm afraid that's all I've got =/
OpenLayers is a great javascript frontend to multiple mapping services or your own map servers. Version 2.7 was just released, which adds some pretty amazing features and controls.

Categories