You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 25, 2021. It is now read-only.
Module utilizing the googlemaps api to determine coordinates based on an address.
2
+
Module utilizing the Google Maps api to determine coordinates based on an address. For licensing and terms using this Google API, please refer to the [Terms of Service](https://developers.google.com/maps/terms)
3
+
4
+
## Contributing
5
+
For more information on contributing to this repository visit [Contributing to a GitHub repository](https://world.mendix.com/display/howto50/Contributing+to+a+GitHub+repository)!
6
+
7
+
## Typical usage scenario
8
+
Determine latitude and longitude based on an address. With these coordinates it becomes possible to view a location on a Google map, using the Mendix Google Maps Widget.
9
+
10
+
## Configuration
11
+
The module contains snippets and example pages which you can use in your project. The example pages are excluded from the project by default in order to reduce the dependency on layouts (which might not be available in your project).
12
+
You can find the Snippets in the '_Use me' folder in the project navigation. You can find the example pages in '_Example pages' folder in the project navigation.
13
+
14
+
#### Snippets
15
+
Copy the snippets which you would like to use to a page in your project.
16
+
17
+
#### Example pages
18
+
Copy the example pages which you would like to use in your project to a module in your project structure. (E.g MyFirstModule) Include the page in your project by right-clicking the page in the project navigation and clicking 'Include in project'.
privatefinalstaticStringSTATUS_OK = "OK"; //indicates that no errors occurred; the address was successfully parsed and at least one geocode was returned.
16
+
privatefinalstaticStringSTATUS_ZERO_RESULTS ="ZERO_RESULTS"; //indicates that the geocode was successful but returned no results. This may occur if the geocode was passed a non-existent address or a latlng in a remote location.
17
+
privatefinalstaticStringSTATUS_OVER_QUERY_LIMIT ="OVER_QUERY_LIMIT"; //indicates that you are over your quota.
18
+
privatefinalstaticStringSTATUS_REQUEST_DENIED ="REQUEST_DENIED"; //indicates that your request was denied, generally because of lack of a sensor parameter.
19
+
privatefinalstaticStringSTATUS_INVALID_REQUEST ="INVALID_REQUEST"; //generally indicates that the query (address or latlng) is missing.
20
+
privatefinalstaticStringSTATUS_UNKNOWN_ERROR = "UNKNOWN_ERROR"; //indicates that the request could not be processed due to a server error. The request may succeed if you try again.
if(jsonstatus.equals(STATUS_OVER_QUERY_LIMIT)) thrownewIOException("GEOCODE request failed: you are over your quota");
84
+
elseif(jsonstatus.equals(STATUS_ZERO_RESULTS)) thrownewIOException("The geocode request was successful but returned no results");
85
+
elseif(jsonstatus.equals(STATUS_REQUEST_DENIED)) thrownewIOException("The geocode request is denied");
86
+
elseif(jsonstatus.equals(STATUS_INVALID_REQUEST)) thrownewIOException("The geocode request is invalid (generally indicates that the query (address or latlng) is missing)");
87
+
elseif(jsonstatus.equals(STATUS_UNKNOWN_ERROR)) thrownewIOException("The geocode request was not succesfull due to a google server error. The request may succeed if you try again.");
88
+
}
89
+
90
+
if (location == null) {
91
+
switch (statusCode) {
92
+
case400: thrownewIOException ("Bad Request");
93
+
case500: thrownewIOException ("Unknown error from Google Encoder");
94
+
case601: thrownewIOException ("Missing query");
95
+
case602: thrownewIOException ("Address could not be found");
96
+
case603: thrownewIOException ("Legal problem");
97
+
case604: thrownewIOException ("No route");
98
+
case610: thrownewIOException ("Bad key");
99
+
case620: thrownewIOException ("Too many queries");
0 commit comments