ABOUTDEVELOPERS |
SpatialStream® Code Examples
Query By Street Name
GetQuery function enables advanced spatial and aspatial queries and context queries against SQL based (transactional) data. Queries include those using inclusion and exclusion geometries, as well as those using a buffer of a selected feature. Query results can be thematically displayed, just as with any other layer. In this example, a GetQuery is constructed using Street Name and it is querying the SpatialStream® parcel layer to obtain all match parcel's geoJson data and highlight them on the map. GetQuery
var query = "&query=(SITE_STREET_NAME like '" + document.getElementById("streetNm").value + "%25')";
var sw = map.getBounds().getSouthWest(); var ne = map.getBounds().getNorthEast(); var polygon = ["POLYGON((" + sw.lng + ' ' + sw.lat + ',' + ne.lng + ' ' + sw.lat + ',' + ne.lng + ' ' + ne.lat + ',' + sw.lng + ' ' + ne.lat + ',' + sw.lng + ' ' + sw.lat + '))']; var url = "http://dc1.spatialstream.com/GetQuery.aspx?" url += "datasource=SAMPLESITE.DMP/PARCELDETAIL" url += "&maxRecords=-1" url += "&inclusionGeometries=" + polygon url += query url += "&output=geojson&fields=site_street_name+geometry"; Dmp.Env.Connections["SS"].getJson(url, successCallback, errorCallback); Run Sample Back To Index |