GithubHelp home page GithubHelp logo

mapuchila / fusiontable-map-template Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chrislkeller/fusiontable-map-template

0.0 2.0 0.0 234 KB

Searchable Map Template using Google Maps and Fusion Tables

Home Page: http://derekeder.com/searchable_map_template/

HTML 37.55% JavaScript 58.26% CSS 4.19%

fusiontable-map-template's Introduction

Fusion Table Searchable Map Template

You want to put your data on a searchable, filterable map. This is a free, open source tool to help you do it.

Searchable Map Template screenshot

Features

  • clean, full screen layout
  • mobile and tablet friendly using responsive design
  • address search (with variable radius and geocomplete)
  • geolocation (find me!)
  • results count (using Google's Fusion Tables v1 API)
  • RESTful URLs for sharing searches
  • ability to easily add additional search filters (checkboxes, sliders, etc)
  • all done with HTML, CSS and Javascript - no server side code required

Dependencies

Setup

This template is now supports the Fusion Tables v1 API. For more info on this, see the migration guide.

Follow the steps below and you'll be in business with your own map.

  1. Create a Fusion Table (here's a great tutorial)
  2. Make sure at least one column is set to a type of Location and that FT has geocoded it
  3. Set the Fusion Table to be publicly visible (via the Share button in the upper right)
  4. Turn on the Fusion Tables API in the Google APIs Console
  5. In source/maps_lib.js, set your
    1. fusionTableId to the encrypted ID of your Fusion Table. Note: Google is phasing out numeric IDs soon
    2. googleApiKey to the API key from your Google API Console
    3. locationColumn to the name of your location column in your Fusion Table
    4. map_centroid to the lat/long you want your map to center on
    5. locationScope to the area you want to limit searches to (set to 'Chicago' by default)
    6. recordName and recordNamePlural to the name of the items in your Fusion Table
  6. Add/modify additional checkbox filters to maps_lib.js. This will depend on the data you are trying to map. Take a look at the wiki for filter examples and list views to get started. You can also take a look at these examples:
  7. Upload this map and all the supporting files (source and styles folders) to your site

Custom Filters and Views

Take a look at the wiki to see how to add your own custom filters and views like:

Resources

Fusion Tables

Community

Reference Guides

Common issues/troubleshooting

If your map isn't displaying any data, try the following:

  1. Use the Chrome developer console or install Firebug for FireFox. This will allow you to debug your javascript.
  2. Load your map in the browser and open the javascript console
    • Chrome developer console on a Mac: option+command+j
    • Chrome developer console on a PC: Control+Shift+J
    • Firebug in Firefox: Tools => Web Developer => Firebug => Open Firebug)
  3. If you aren't seeing any javascript errors:
    • Make sure that you have at least one column with address or lat/long points set to type 'Location'. You can check this in Fusion Tables under Edit => Modify Columns.
    • Make sure that Fusion Tables has geocoded your column. You check this by going to View => Map. If you see your points on the map, you're good!
    • Check that your Fusion Table is public (in Fusion Tables, upper right corner => Share button)
  4. If you do see javascript errors:
    • The error will tell you what line it is failing on. Best to start by going there!
    • Columns in Fusion Tables are case sensitive, so make sure they are correct.
    • For columns that have multiple words in the title, make sure to surround the column name in your code with single quotes (example: "'first name'")

My custom map styles won't display!

This is due to a recent change to the FusionTablesLayer and only effects tables created after mid-November 2012. A styleId and templateId must be defined.

When you create custom styles for the first time, the styleId will be 2. For custom info window layouts, the first templateId will also be 2. The latest version of this template has these defaults set, but in case you want to add it to an existing project, use the following code:

   MapsLib.searchrecords = new google.maps.FusionTablesLayer({
     query: {
       from:   MapsLib.fusionTableId,
       select: MapsLib.locationColumn,
       where:  whereClause
     },
     styleId: 2,
     templateId: 2
   });

For reference, styleId 1 is the default look - usually small red dots or red polygons. templateId 1 is the default info window that just shows the first few columns in your table.

For more information, see Working with styles and Working with templates in the Fusion Tables documentation.

Still can't figure it out or more detail needed?

Email me! Derek Eder

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Commit and send me a pull request.

== Copyright

Copyright (c) 2012 Derek Eder. Released under the MIT License.

See LICENSE for details

fusiontable-map-template's People

Contributors

derekeder avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.