-
-
Platform Overview Platform Overview
High-precision data and advanced tooling in one place
-
Maps & Data Maps & Data
Build high-quality maps using fresh location data
Maps & Data-
Map Data Map Data
Create fresh, accurate maps and layer global information
-
Dynamic Map Content Dynamic Map Content
Explore industry-leading map content
-
Maps for ADAS & HAD Maps for ADAS & HAD
Help vehicles see beyond sensors with location data sources
-
-
Services Services
Browse our extensive range of services and APIs
Services-
Routing Routing
Make journey planning easier with our routing portfolio
-
Geocoding & Search Geocoding & Search
Translate addresses into accurate geocoordinates
-
Map Rendering Map Rendering
Highly customizable graphics and real-time map data
-
Positioning Positioning
Pinpoint devices and assets locations with precision
-
-
Tools Tools
Build solutions with our flexible developer tools and applications
Tools-
HERE Studio HERE Studio
Visualize, style and edit location data
-
HERE Workspace HERE Workspace
Create location-centric products and services in one space
-
HERE Marketplace HERE Marketplace
Source, buy, sell and trade location assets
-
HERE SDK HERE SDK
Build advanced location-enabled applications
-
HERE Live Sense SDK HERE Live Sense SDK
Enhance driver awareness by using AI
-
HERE Anonymizer HERE Anonymizer
Maximize location data while supporting regulatory compliance
-
-
Capabilities Capabilities
Everything you need for your location-related use case
Capabilities-
Visualize Data Visualize Data
Identify complex trends and patterns
-
Generate Insights Generate Insights
Transform location data into compelling stories
-
Build Applications Build Applications
Create feature-rich products designed for business
-
Develop Services Develop Services
Produce tailored service experiences
-
Make Maps Make Maps
Create and use custom digital maps
-
-
-
-
By Market By MarketBy Market
-
Automated Driving Automated Driving
-
Connected Driving Connected Driving
-
Fleet Management Fleet Management
-
Supply Chain Supply Chain
-
Urban Mobility Urban Mobility
-
Infrastructure Planning Infrastructure Planning
-
Public Safety Public Safety
-
-
By Applications By ApplicationsBy Applications
-
HERE Last Mile HERE Last Mile
Optimize your last mile deliveries
-
HERE Asset Tracking HERE Asset Tracking
Track assets in real-time with our end-to-end solution
-
HERE Navigation HERE Navigation
Use our off-the shelf navigation system
-
HERE WeGo HERE WeGo
Enjoy your journey with our new navigation app
-
-
-
-
Partner with HERE Partner with HERE
-
Partner Network Partner Network
-
-
Pricing Pricing
-
-
Documentation Documentation
-
Tutorials Tutorials
-
Code Examples Code Examples
-
Knowledge Base Knowledge Base
-
Developer Blog Developer Blog
-
-
-
About us About us
-
Events Events
-
News News
-
Press Releases Press Releases
-
Careers Careers
-
Sustainability Sustainability
-
Leadership Leadership
-
Investors Investors
-
HERE360 Blog HERE360 Blog
-
Solutions Day 26-30 : #100DaysOfCode

We are back with another week of #100DaysOfCode with HERE. If you have no idea what I'm talking about, take a look at this blog post which will tell you everything about #100DaysOfCode. In this blog post, I will cover solutions for days 26 through 30. If you have missed the solutions for days 0-25, you can read them in my previous blogs posts or in the video format.
Let's begin!
Day 26/100
With Day 26, we start exploring the rest of the endpoints of the Geocoding and Search API. While geocode
gives you the generic address-to-geocoordinates solution, discover
is more specific and gives you results based on your current position. This can be applied when you reach a new place and want to know 'what are some of the cool things to do here'. Here, we are searching for 'markets' while specifying our current position.
// Get an instance of the geocoding service:
var geocoder = platform.getSearchService();
function geocodeAndSearch(){
let geocoderParams = {
q : 'markets', // free form query
at : '52.49105,13.37917' // position in the format latitude, longitude
}
function onResult(result){
console.log(result);
}
geocoder.discover(geocoderParams,onResult,alert);
}
geocodeAndSearch();
Day 27/100
The results from Day 26 give you a variety of results with places which can be identified as markets. One way to filter these results is by specifying a search radius. This can be done by using the in
parameter of the discover endpoint. Here we specify our search field as a circle and specify the radius in meters.
// Get an instance of the geocoding service:
var geocoder = platform.getSearchService();
function geocodeAndSearch(){
let geocoderParams = {
q : 'markets',
in : 'circle:52.49105,13.37917;r=1000'
}
function onResult(result){
console.log(result);
}
geocoder.discover(geocoderParams,onResult,alert);
}
geocodeAndSearch();
Day 28/100
If you expand the results from the query on Day 27, you will see that the results come with an important paramter along with the adddress and position of the places searched for. This paramater is the 'distance'. This is the distance of these places in meters, from the center of your search. The distance value can help the user choose the 'market' they want to go to.
{…}
items: (8) […]
0: {…}
access: (1) […]
0: Object { lat: 52.49006, lng: 13.38577 }
length: 1
address: Object { label: "Guuht, Kreuzbergstraße 1, 10965 Berlin, Deutschland", countryCode: "DEU", countryName: "Deutschland", … }
categories: Array(4) [ {…}, {…}, {…}, … ]
contacts: Array [ {…} ]
distance: 456
foodTypes: Array [ {…} ]
id: "here:pds:place:276u33d8-9e827cde6ea64aefb6936cfc02c66296"
openingHours: Array [ {…} ]
position: Object { lat: 52.49019, lng: 13.38576 }
resultType: "place"
title: "Guuht"
For Day 28, we use this distance and display it on an Info-Bubble. We use the position
of the places as the position of the info-bubble.
function onResult(result){
// console.log(result);
result.items.forEach(item => {
ui.addBubble(new H.ui.InfoBubble( item.position, {
content: 'distance: '+item.distance+' m'
}));
});
}
Day 29/100
The endpoint Autosuggest
can be used like an auto-complete for places and addresses. This can be done by providing an input field to the user where they can start typing their search query. The responses of the geocoder-autosuggest
can be displayed as options for the selection by the user. For Day 29, we have taken the incomplete query 'star' in a bid to find the nearest starbucks. We query the geocoding and search API with the autosuggest endpoint
. Note that the incomplete query q
needs to be used with the parameters at
or in
. You can read more about it in the autosuggest section of the Geocoding and Search API.
// Get an instance of the geocoding service:
var geocoder = platform.getSearchService();
function geocodeAndSearch(){
let geocoderParams = {
q : 'star',
at : '52.491059,13.37917'
}
function onResult(result){
console.log(result);
}
geocoder.autosuggest(geocoderParams,onResult,alert);
}
geocodeAndSearch();
Day 30/100
On Day 27, we restricted our search to a circle with a radius. Guess what? You can also restrict searches in a box. For Day 30, we are modifying the autosuggest search query from Day 29 and adding the parameter in:bbox
to restrict our search to a bounding box
. When you wish to draw a polygon, you need to define the length of each side. For a bounding box in terms if location, you will need the position of a point (a geocoordinate) on all the sides of the box. We start with the left side and go anti-clock wise. Now as the left side is the vertical side, we use the vertical coordinate (longitude) of any point of this box. For the horizontal sides of this box, we use the horizontal coordinates (latitude). This this box can be defined with bbox:Left-longitude, bottom-latitude, right-longitude, top-latitude
. If you are still confused, check out the documentation on this one. The autosuggest search will now be restricted to the bounding box we define with these coordinates.
// Get an instance of the geocoding service:
var geocoder = platform.getSearchService();
function geocodeAndSearch(){
let geocoderParams = {
q : 'star',
in : 'bbox:13.3817,52.50474,13.40432,52.51647'
}
function onResult(result){
console.log(result);
}
geocoder.autosuggest(geocoderParams,onResult,alert);
}
geocodeAndSearch();
This week we covered the discover and autosuggest endpoints of the Geocoding and Search on #100DaysOfCode. We will explore the other endpoints of Geocoding and Search as well as other APIs in the days to come. Hope you enjoyed this week of #100DaysOfCode with HERE. Keep following us on Twitter for more tasks and complete all 100 days. If you want to watch the video version of these solutions, take a look at our playlist for #100DaysOfCode on YouTube.
While you're at it, why don't you take a look at the blog post announcing the release of our new HERE SDK for Flutter.
Want to kmnow how to use the OAuth authentication method? Take a look at the step-by-step tutorial.
Happy coding!
Have your say
Sign up for our newsletter
Why sign up:
- Latest offers and discounts
- Tailored content delivered weekly
- Exclusive events
- One click to unsubscribe