Skip to content

Latest commit

 

History

History

GoogleNearby

Google nearby widget

####Settings In index.html
dojoConfig must add last 3 rows for dgrid, dstore and jszip

        var dojoConfig = {
            async: true, 
            packages: [{
                name: 'viewer',
                location: location.pathname.replace(/[^\/]+$/, '') + 'js/viewer'
            },{
                name: 'config',
                location: location.pathname.replace(/[^\/]+$/, '') + 'js/config'
            },{
                name: 'gis',
                location: location.pathname.replace(/[^\/]+$/, '') + 'js/gis'
            }, {
              name: 'dgridnew',
              location: '//cdn.rawgit.com/SitePen/dgrid/v0.4.0'
            }, {
              name: 'dstorenew',
              location: '//cdn.rawgit.com/SitePen/dstore/v1.0.1'
            }, {
              name: 'jszip',
              location: '//cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/',
              main: "jszip"
            }
            ]
        };

Adding the following to viewer.js config file.

javascript

//add showLabels: true to mapOptions
mapOptions: {  
    basemap: 'streets',  
    center: [-96.573, 39.185],  
    zoom: 14,  
    sliderStyle: 'small',  
    showLabels: true  
},

...
//add to widgets
googleNearby: {
  include: true,
  id: 'nearby',
  type: 'titlePane',
  canFloat: true,
  path: 'gis/dijit/GoogleNearby',
  title: 'Google Nearby',
  open: false,
  position: 10,
  options: {
    map: true,
    mapClickMode: true
  }
},


Query string from Google database:

distance AND name AND keyword AND type

distance - distance from the objects to the point in straight line (in meters)
name - search only in the name of the objects
keyword - search in any text related to the objects
type - select from Google's list

The results from query is up to 200 objects.

Screen from Sample page: Screenshot

Zoom to object: Screenshot

If you add and StreetView widget, then remove
'gis/plugins/async!//maps.google.com/maps/api/js?v=3&sensor=false' and
'gis/plugins/async!//maps.googleapis.com/maps/api/js?libraries=drawing,places&sensor=false"' from streetview.js and GoogleNearby.js

and add
'gis/plugins/async!//maps.googleapis.com/maps/api/js?libraries=drawing,places&sensor=false"' to viewer.js config file.
Because Google API can load only one time.

Writes a shapefile in pure javascript with JS2Shapefile.

Download a shapefile as zip with jszip library jszip:.

Requires a capable modern browser with Typed Arrays.

Using:
https://github.com/BrianBunker/cmv-widgets/tree/master//Nearby
and many sources from http:https://stackoverflow.com