-
Notifications
You must be signed in to change notification settings - Fork 452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logitude Latitude necessary for mapping function to work? Available outside of US? #5174
Comments
Mapping features definitely work outside en_US locales (I’m using successfully, and reliably here in en_AU - greetings from Oz!). When you say showing all families displays “nothing” do you mean the map area is blank (no map etc) or you mean the map displays but no pins are rendered etc? A screen shot might be useful, as would anything relevant from the |
A map with no pins. I'll get a screen shot and logs. Thanks. |
|
Odd - there isn't anything in the logs that point to a problem (other than occasional MySQL connection saturation). If you open A single column with only numbers indicates the system was unable to resolve the addresses to lat/long co-ordinates. No need to show results; but it might help narrow down where the problem is. |
Thanks for the feedback. The query results look like this:
fam_ID fam_Latitude fam_Longitude
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291 0 0
292 0 0
293 0 0
294 0 0
295 0 0
296 0 0
297
So obviously the system can't get the LAT/LON numbers. Where can I go
next to see where the problem might be?
Thanks!
…------ Original Message ------
From: "James G" <notifications@github.com>
To: "ChurchCRM/CRM" <CRM@noreply.github.com>
Cc: "David Leigh" <david@leighweb.com>; "Comment"
<comment@noreply.github.com>
Sent: 2020-03-10 01:08:35 AM
Subject: Re: [ChurchCRM/CRM] Logitude Latitude necessary for mapping
function to work? Available outside of US? (#5174)
Odd - there isn't anything in the logs that point to a problem (other
than occasional MySQL connection saturation). If you open QuerySQL.php
on your ChurchCRM setup (Left menu: Query/Reports -> Query Menu -> Run
a Free-Text Query (top right)" then enter the following query select
fam_ID,fam_Latitude,fam_Longitude from family_fam. You should see three
columns with a number, then latitude and longitude for each family
address.
A single column with only numbers indicates the system was unable to
resolve the addresses to lat/long co-ordinates.
No need to show results; but it might help narrow down where the
problem is.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#5174?email_source=notifications&email_token=AB7LGEVKS3SGRG2S76XZPGDRGWAIHA5CNFSM4LDX2JDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOJQHNI#issuecomment-596837301>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB7LGEUXAQMXDT4ELX6GGZTRGWAIHANCNFSM4LDX2JDA>.
|
So, I see in /ChurchCRM/utils/GeoUtils.php debug lines like:
$logger->debug("Using: Geo Provider - ". $provider->getName());
But a search on the logs for "Using: Geo Provider" turns up nothing even
though I've executed: UpdateAllLatLon.php
Does that mean that I need to "turn on" debugging in some way or that
I'm not looking in the right logs?
Thanks!
…------ Original Message ------
From: "David Leigh" <david@leighweb.com>
To: "ChurchCRM/CRM"
<reply@reply.github.com>
Sent: 2020-03-12 11:05:31 AM
Subject: Re[2]: [ChurchCRM/CRM] Logitude Latitude necessary for mapping
function to work? Available outside of US? (#5174)
Thanks for the feedback. The query results look like this:
fam_ID fam_Latitude fam_Longitude
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291 0 0
292 0 0
293 0 0
294 0 0
295 0 0
296 0 0
297
So obviously the system can't get the LAT/LON numbers. Where can I go
next to see where the problem might be?
Thanks!
<https://david.leighweb.com>
------ Original Message ------
From: "James G" ***@***.***>
To: "ChurchCRM/CRM" ***@***.***>
Cc: "David Leigh" ***@***.***>; "Comment"
***@***.***>
Sent: 2020-03-10 01:08:35 AM
Subject: Re: [ChurchCRM/CRM] Logitude Latitude necessary for mapping
function to work? Available outside of US? (#5174)
>Odd - there isn't anything in the logs that point to a problem (other
>than occasional MySQL connection saturation). If you open QuerySQL.php
>on your ChurchCRM setup (Left menu: Query/Reports -> Query Menu -> Run
>a Free-Text Query (top right)" then enter the following query select
>fam_ID,fam_Latitude,fam_Longitude from family_fam. You should see
>three columns with a number, then latitude and longitude for each
>family address.
>
>A single column with only numbers indicates the system was unable to
>resolve the addresses to lat/long co-ordinates.
>
>No need to show results; but it might help narrow down where the
>problem is.
>
>—
>You are receiving this because you commented.
>Reply to this email directly, view it on GitHub
><#5174?email_source=notifications&email_token=AB7LGEVKS3SGRG2S76XZPGDRGWAIHA5CNFSM4LDX2JDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOJQHNI#issuecomment-596837301>,
>or unsubscribe
><https://github.com/notifications/unsubscribe-auth/AB7LGEUXAQMXDT4ELX6GGZTRGWAIHANCNFSM4LDX2JDA>.
>
|
Ok, big progress!
I'll share for others that perhaps arrived at the same place as me:
After running UpdateAllLatLon.php I'd see messages like this in the app
log:
[2020-03-12 11:47:09] defaultLogger.WARNING: issue creating geoCoder API
access denied. ... Message: This API project is not authorized to use
this API.
I thought I'd done everything necessary with associating the right
services for my API key but I had not. I added the following ones
specifically (probably don't need them all):GeocodingDirectionsDistance
MatrixGeolocationThen my app log messages changed to this:
Message: API keys with referer restrictions cannot be used with this
API.
I had entered our ChurchCRM installation URL as a restriction where this
request could come from. Unfortunately, Google doesn't accept that. So
I had to enter the server IP address, which is annoying because it's a
shared host and I could get abusive use from others on the server.
Unlikely but possible. Then six of our 122 family entries successfully
had their Latitude and Longitude calculated. Before then, when I would
select fam_ID,fam_Latitude,fam_Longitude from family_fam these six
families had "0" for Latitude and for Longitude and the others, nothing
at all. When I looked at the database, I saw that except for these 6
families all the rows had NULL for Latitude and Longitude. I set those
all to "0" in the database and then Latitude and Longitude were
correctly calculated. This part seems like a bug - i.e. It should
calculate correctly regardless of what's in the target fields or the
fields should be set to NOT NULL with a default of 0. Now when I want to
see a full map of all the members, it starts to display with pins, etc.
and then it get's overlaid with a gray screen and a message
Oops! Something went wrong.
This page didn't load Google Maps correctly. See the JavaScript console
for technical details.
In the JavaScrip console I'm getting this error from the Maps JavaScript
API: Google Maps JavaScript API error: RefererNotAllowedMapError
which is a legitimate error because the API key that does the GeoCoding
is different than my Maps JavaScript API. AND, since Google is saying
that I can't use a referrer restriction for the GeoCoding, but in the
Maps JavaScript API I NEED to use a referrer, it seems that these two
need to be two DIFFERENT API keys that I use but the ChurchCRM only has
place for a single API key. Not quite sure what to do at this point.
I'm obviously missing something here. Looking forward to your help!
Thanks!
…------ Original Message ------
From: "James G" <notifications@github.com>
To: "ChurchCRM/CRM" <CRM@noreply.github.com>
Cc: "David Leigh" <david@leighweb.com>; "Comment"
<comment@noreply.github.com>
Sent: 2020-03-10 01:08:35 AM
Subject: Re: [ChurchCRM/CRM] Logitude Latitude necessary for mapping
function to work? Available outside of US? (#5174)
Odd - there isn't anything in the logs that point to a problem (other
than occasional MySQL connection saturation). If you open QuerySQL.php
on your ChurchCRM setup (Left menu: Query/Reports -> Query Menu -> Run
a Free-Text Query (top right)" then enter the following query select
fam_ID,fam_Latitude,fam_Longitude from family_fam. You should see three
columns with a number, then latitude and longitude for each family
address.
A single column with only numbers indicates the system was unable to
resolve the addresses to lat/long co-ordinates.
No need to show results; but it might help narrow down where the
problem is.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#5174?email_source=notifications&email_token=AB7LGEVKS3SGRG2S76XZPGDRGWAIHA5CNFSM4LDX2JDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOJQHNI#issuecomment-596837301>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB7LGEUXAQMXDT4ELX6GGZTRGWAIHANCNFSM4LDX2JDA>.
|
Thanks for the additional information @dleigh. The way I set up Google Maps API keys is not to restrict the API key (it can call any API I have enabled) and not to set any "Application restrictions" (ie, HTTP referrer, IP address). The API keys I set up have the following Google Maps APIs enabled:
This will only require a single API key and allows the maps features work correctly in the ChurchCRM application. Some commentary on securityYes, this theoretically means if someone got hold of my API key they could max out my free map API calls and leave my ChurchCRM map dead in the water (or burn a hole in my Google API budget...which is why I set monthly $$ limits). Then I could just generate a new key, and move on. Having said that, the geocode utilities for Google Maps used in ChurchCRM smoosh the API interaction into a JSON payload communicated over HTTPS:
The API key is never transmitted in the clear or as part of a GET request when polling Google (even if your ChurchCRM isn't set up with an SSL certificate), as can be seen above. The only information that could be sniffed off the wire is (possibly) the server being connected to over HTTPS (ie, * Domain name MAY be transmitted in clear (if SNI extension is used in the TLS handshake) but URL (path and parameters) is always encrypted. |
Thank you @MrClever for the info - very detailed and helpful. I can confirm that this works. My own opinion is that, at least for Google (since I don't know how Bing works), it would seem that having 2 keys (one for JavaScript and one for Geocoding) would be more in line with how Google expects the keys to be used. I had also run my issues by Google support and they indicated that a solution that doesn't allow for the use of two separate keys is (in their words) "wrongly developed". And, of course, not to have the referrer domain or source IP restrictions grants you a "warning icon" in the Google developer's console. So while it would be a bit more complex, it seems that's the recommended route - though I can see value in the simplicity of one key as well. Regardless of a one or two key solution, I do believe this whole process would benefit from more documentation. Considering how many different ways one can set this up and that Google pushes you to add restrictions, it's unfortunately a bit easy to set it up incorrectly - leading to time-consuming frustration. So hopefully this thread will help others and perhaps the documentation could be adjusted to make reference to it. Thanks again for your detailed help! |
Thanks @dleigh and @MrClever for the detailed research and notes. At first glance, I agree with implementing the two key approach, and have updated the labels and milestone for this issue, pending confirmation of Google API key best practices. I also think the API key would also be a prime candidate for at rest encryption in the database, since it is technically a "secret". |
…y from rendering This largely arises out of the discussion at #5174 (comment) Geocoding API keys should be restriced so that only the IP of the ChurchCRM server may execute queries, whilst the rendering key should be restricted so that only the ChurchCRM URL is permitted as an HTTP Referrer. Need to do some more work on this (migrations/documentation) before it's ready to merge.
I made a revision to the wiki attempting to summarize the discussion here; as well as take into account the changes pending for the 4.0.3 release: https://github.com/ChurchCRM/CRM/wiki/Geographic |
In my experience, this won't work. You have to remove the IP Address restriction to use a single API key for both the Geocoding AND the JavaScript APIs - hence the discussion. |
@dleigh this statement will be true in the wiki when we release 4.0.3, which splits out the API keys :-) |
Ah - ok, I understand. Thanks. |
@dleigh 4.0.3 is released - can I close this? |
Sure. Thanks! |
I created a Google Maps API key yesterday (so it's brand new). I have addresses that, when entered into Google are mapped correctly. In fact, when I am looking at a single family entry in ChurchCRM, and choose to display them on the map, it invokes Google Maps and displays correctly.
BUT displaying all the families shows NOTHING and updating the Longitude and Latitude shows nothing. Our church is in France. Is this why showing all the families doesn't work?
The text was updated successfully, but these errors were encountered: