Highmaps: what is the code for a county? - highcharts

I am new to Highmaps and am playing with it.
I notice that it uses the following data for a county in Maryland, USA.
Object { key="us-md-025", value=23}]
I am curious about "025". What is it called?

This code is called the "fips" or "county fips" code. It is a unique identifier for that particular county in the state you look at. Here is a good intro:
https://en.wikipedia.org/wiki/FIPS_county_code
A full county code looks like 23025 where the first two characters are the state fips code and the last three are the county fips code. Depending on the data set you are looking at you can also view the areatype code (for things like Metro Area, County, State, US Region, etc).
Full list of county fips codes can be found here:
http://www.census.gov/2010census/xls/fips_codes_website.xls

Map documentation can be found at...
http://www.highcharts.com/docs/maps/map-collection
Map data can be found at...
http://code.highcharts.com/mapdata/
If you scroll down to "USA States" > "Maryland, admin2" > "GeoJSON" link, you can open/download the map data for Maryland. Search the JSON data for "us-md-025". You will find "name":"Harford".

Related

What are the solutions when geocoding a wrong or incomplete address?

My company gets the addresses the loading hubs for our freights every week. We need to geocode them into coordinates. But often the addresses either are incomplete or contain minor grammar mistakes, so it's impossible to input them for geocoding.
My question : when dealing with a list of wrong or incomplete addresses when geocoding, is there any general solution to solve the issue ?
If there are useful articles or resources about this topic, please let me know.
Thank you.
Geocoding / Autocomplete
According to the Geocoding Addresses Best Practices documentation:
"Geocoding is the process of converting addresses (like a street address) into geographic coordinates (latitude and longitude), which you can use to place markers on a map, or position the map."
"In general, use the Geocoding API when geocoding complete addresses (for example, “48 Pirrama Rd, Pyrmont, NSW, Australia”). Use the Places API Place Autocomplete service when geocoding ambiguous (incomplete) addresses."
The Place Autocomplete service returns place predictions according to your inputs. This would solve your problem of having wrongly spelled addresses.
How to get the coordinates after using Place Autocomplete?
example request for Place Autocomplete would look like this:
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Paris&types=geocode&key=YOUR_API_KEY
The Place Autocomplete is able to return the address description together with its place_id. In this sample request, you are able to get "description": "Paris, France" with a "place_id": "ChIJD7fiBh9u5kcRYJSMaMOCCwQ".
Then you can use the Place ID of the predicted location to obtain the coordinates of that place by using Place Details request
You can request it like this:
https://maps.googleapis.com/maps/api/place/details/json?fields=geometry&place_id=ChIJD7fiBh9u5kcRYJSMaMOCCwQ&key=YOUR_API_KEY
We used here the fields=geometry to only return the coordinates of the location and as previously mentioned the Place ID we used is the one we had from the Autocomplete query.
The returned data will be the expected result according to your question. But feel free to comment if you need anything.
To read more about the fields parameter, refer to the Place Details documentation.
I hope this helps!

Create custom Map for Highmaps using Shapefiles and QGIS

I try to create a custom Map with Highcharts – I need german job center districts. I've done it the way it is described here.
I imported the shapefiles to QGIS an created a highcharts map here. But on this way, all information like the name oft he district got lost. Is there a way to keep it? Because there are a lot of districts – I don't want to write all single names by my own.
I was able to generate GeoJSON from the provided shapefile (the one that you provided me with via email) and place it in the JSFiddle boilerplate (http://jsfiddle.net/highcharts/xbzxfx2L/). Empty map displayed without any problems. To add values to the regions and also to display data labels you need to add adequate data and link it to the mapData (more about it in the API link below). I have prepared an example for you. Simply, copy the content of created GeoJSON (generated from the shapefile using QGIS, as described here: https://www.highcharts.com/docs/maps/custom-geojson-maps) to the textarea and click run button. The map with the values should show up. Also, you could try to use map of Germany from our maps collection. It can be found here: http://code.highcharts.com/mapdata/.
API Reference:
https://api.highcharts.com/highmaps/series.map.joinBy
Example:
http://jsfiddle.net/w20e8vja/

How can I determine if a postal code is inside a defined area?

I’m building an ordering/delivery website for a restaurant with a PHP backend.
I’d like to determine if the delivery postal code (Canada) is within a predetermined delivery zone. The zone is oddly shaped around specific streets and neighborhood, so radius is not an option.
What is the best way to achieve this?
I assume Google Maps could help with that but I haven’t found any clear path yet.
You could use something like
if ($zip > 5600 && $zip < 6000) {
//do stuff
You have to map GIS data to your postal codes. Maybe such a mapping already exists and you "only" have to asked "Canada Post" for it (assuming a commercial project).

Can I search countries by country_code in AdWords API v201109?

I want to find Country locations in AdWords API v201109 by country code, as it was possible in previous version of the API. However, in official documentation I can't find a way how to do that.
I can search by LocationName and entering country code. It works for some country codes ("CZ" - Czech Republic), but for some it doesn't ("SK" - Slovakia) - I suspect it doesn't work for most of country codes.
Of course, there's an obvious workaround: fetch Countries appendix and translate country codes to country names or ids locally. But I'd rather just search by country code directly. Is it possible?
Currently it is not possible to search countries by country_code only in AdWords API v201109. They havn't given feature for search with country code only. You are good hacky method.
They might develop later that for the same. Keep you code extend-able.
We recently published a CSV files that contains all the targetable locations, with a column for country code:
https://developers.google.com/adwords/api/docs/appendix/geotargeting

g:countrySelect with full country name as value

I want to store the exact country name using g:countrySelect. Example Germany instead of DEU. It is the value in the drop down menu. The drop down text is Germany but when it saves it to the database it changes back to the country code. Sorry if I am somewhat naive but I have been searching for almost 3 hours for solutions and it isn't well documented at the grails website. I could opt for any alternative even ajax. Just to have an easy way to display a list of countries and will be able to store the REAL NAME of the country NOT country code. Thank you!
You can convert from an ISO3 country code to the country name using this function
def getCountryName(String countryCode) {
Locale.availableLocales.find{it.ISO3Country == countryCode}.displayCountry
}
// Test
println getCountryName('DEU') // prints 'Germany'
If you want to do this within a GSP, it would be best to make this available as a TagLib.
Not sure when the above solution stopped working but if you try that now, you'll get an error:
Couldn't find 3-letter country code for CS
With the latest grail version, the current way of getting the full country name is by using this tag:
<g:country code="${country}"/>
I know this thread is old, but I was looking for the same issue and I had to share my solution.
You can use the CountryTagLib object to convert the ISO3 code back to full country name like this :
def country = CountryTagLib.ISO3166_3[code]
The "code" property being the ISO3 code that you got from <g:countrySelect>.

Resources