I have a database with lat\long values and I use google maps api v3 to plot these points on a map and draw a 30 mile radius around these points. All I have is a bunch of circles drawn on the map with info windows if you click on these circles.
I need to export this map as a .kmz file so that I can put it on my web server and make it available to our marketing website to import as a layer into their site.
Is this possible without re-inventing the wheel? My initial map is drawn in php, I query the database and get a json object that I traverse in javascript to plot the points and draw the circles.
Thank you
Jack
My current map as it appears:
Related
I have a dataset that has four types of files with the following file extensions -
.DBF,.PRJ,SHP,SHX
My goal is to get all the polygon coordinates for each neighborhood and draw the boundary outline on the google map when a user is on a specific Neighborhood page. Currently the datasource for the site is a MySQL Database.
I have tried converting the shp file to Geojson but then parsing that file is time taking.
I have also tried using tools such as QGIS and shp2sql etc.
I would like to know what is the best way to get the main attributes from the dataset along with each neighborhood's Polygon coordinates.
please advise
I have managed to accomplish this using the ogr2ogr command line tool -
ogr2ogr -f "MySQL" MYSQL:"mydb,host=myhost,user=mylogin,password=mypassword,port=3306" -nln "world" -a_srs "EPSG:4326" path/to/world_adm0.shp
I have the polygon coordinates in a geometry field in the table attached to its corresponding neighborhood id.
I did Select ASTEXT(Shape) as POLYGON from world to get the array of coordinates and now I can convert that to json and send it to Javascript so that it can be mapped
I'm trying to figure out how to build a statistical map for my web app. Here's what I've got:
I have a MySQL database of zip codes, and each zip code has latitude & longitude.
I have users who have declared what zip code they live in.
I even have a haversine query which will show how many users exist within, for example, 25 miles of a given latitude/longitude, based on their zip code.
My question is this: Using this information, how could I approach building a statistical map for a web application using PHP?
I would be fine with using just a US map or even a North American map for now, but I'm just not sure how to build that map. Some options I've considered:
Show a colored dot on the map, larger or smaller depending on the number of users near that location. I'm not sure how to do this, though, especially if those dots were to overlap!
Show individual "pushpins" where the users are. Seems like this could get out of hand if my user base grows significantly
So back to my question. If I had 300 users in Dallas, 4,000 in NYC, 45 users in Detroit, 403 in Chicago... how would I be able to represent that on a map -- and also how would I draw that map in a web application built on PHP?
You are trying to build a three-dimensional (probably even more dimensions) data display.
Your dimensions are:
X-Location
Y-Location
The value at every location
This really does not define anything about the visual appearance, though.
A simple approach might be to calculate the absolute number of users per state and then color the state on the map according to some scale. You also might calculate the percentage of users living in a state compared to the absolute number and color that instead.
A different approach would be to put a dot for every user on the map, and if this dot was printed before, to change it's color instead, e.g. make it brighter.
In the end, it really depends on what your actual data is and if your approach on visualizing it displays some significant information - but this can only be confirmend after you see it.
As you are looking for a web application have you considered Google Maps. Factor 1. can be implemented using the MarkerClusterer library. A DEMO showing this. The data from your database can be loaded using AJAX.
I need to draw complex regional bounding polygons in google maps. Is there a way to easily access regional data to draw these polygons? The regions will be australian postcode areas. If you type a post code into google (not maps normal search) such as "2454" into google the first result is an image with the regional polygon (perhaps this search only works if your searching from australia). Im assuming this data is accessible as google is drawing the polygon.
any idea how i would access this bounds data?
an example of what im talking about is here
http://maps.google.com.au/maps?pq=australian+postcode+2454&hl=en&cp=0&gs_id=2&xhr=t&q=2454&safe=off&gs_upl=&bav=on.2,or.r_gc.r_pw.r_cp.,cf.osb&biw=1876&bih=872&um=1&ie=UTF-8&hq=&hnear=0x6b9e9f724b020f8d:0x1c0609b7ccd310d0,New+South+Wales+2454&gl=au&ei=a3MoT66iKoKuiQelk7m3Ag&sa=X&oi=geocode_result&ct=title&resnum=2&sqi=2&ved=0CDIQ8gEwAQ
This data isn't available through the Google Maps API at this time. You would need to find a 3rd party provider of the boundary data. A quick query shows several providers of the data, though I'm not sure if they're provided anywhere for free. Once you get the data, it's probably in a GIS data format, such as a Shapefile or a KML file. These can be loaded into Google Fusion Tables or KML files can be loaded directly using a Google Maps API KMLLayer.
That data is not accessible programmatically from Google. Your best bet is to either find KML for the data and then use either maps.google.com or the Google Maps API to load the KML (http://code.google.com/apis/maps/documentation/javascript/layers.html#KMLLayers) or to use somehing like Fusion Tables to load GIS data (or KML) into a fusion table, and then use the Fusion Tables layer in the Google Maps API (http://code.google.com/apis/maps/documentation/javascript/layers.html#FusionTables).
*Note that the Fusion Tables layer is experimental.
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.
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.