Skip to main content
Participant
January 25, 2010
Answered

CFMap Debug / Error control ?

  • January 25, 2010
  • 1 reply
  • 1095 views

Hi,

Im using CFMAP looping a query of address from a DB, the output is  street address and a postcode, if the user enters the postcode wrong CFMAP thoughts a JavaScript error to screen saying debug needs to be enabled.  is there a way to debug to catch errors then not process them to the map, i.e. if it cannot find just ignore. Im out putting around 80 map items

Thanks

Jeremy

This topic has been closed for replies.
Correct answer Joshua_Cyr

The way the google map works it submits each address one after another and gets the latitute, longitute from it. By sending 80 of them you are exceeding googles rate limit.  It probably is bouncing at 8-10 items.

The best bet for you is to get the lat/long for each address first, then store that in the DB, then send that instead of the address to google.  Then you wont be using up your rate limit.

More info on this:

http://www.coldfusionjedi.com/index.cfm/2009/12/15/Having-trouble-with-too-many-map-markers-and-CFMAP

As for how to get the lat/long something like this will work.


<cfhttp url="http://maps.google.com/maps/geo?q=#address#&output=csv&sensor=false&key=#key#"
    result="data" method="get">


<!--- check to make sure it seems valid --->
<cfif  listGetAt(data.filecontent,'1') neq 200>
    <script>
    history.go(-1);
    </script>
    <cfabort />
</cfif>
   
    <cfset lat = listGetAt(data.filecontent,'3')>
    <cfset long = listGetAt(data.filecontent,'4')>

1 reply

BKBK
Community Expert
Community Expert
January 25, 2010

Have you tried something like this?

<cfloop>

<cftry>

<!--- map code goes here --->

<cfcatch type="any">

<!--- log error message, cfcatch.message, using cflog tag --->

</cfcatch>

<cftry>

</cfloop>

Participant
January 25, 2010

Thanks but it doesnt do anything, Im not sure its a coldfusion error more of a google api error? i attach an image of the error.

code looks something like (within a cfmap tag):

<cfoutput query=

"GetProperty">

<cfsavecontent variable=
"showtext">
<img src="uploads/#MainIamge#-1-m.jpg" width="150" height="120" alt="" border="0" /><br />
<strong>#PName#</strong><br />
#Rooms# rooms<br />
Plymouth, #PostCode#<br />
<br />
<a href="Details.cfm?id=#PropertyID#">view details</a>
</cfsavecontent>
<cfmapitem name=
"#PName#"
address=
"#PName#, #PostCode#"
markerwindowContent=
"#showtext#"
tip=
"#PName#"/>
</cfoutput>

Joshua_CyrCorrect answer
Participating Frequently
January 25, 2010

The way the google map works it submits each address one after another and gets the latitute, longitute from it. By sending 80 of them you are exceeding googles rate limit.  It probably is bouncing at 8-10 items.

The best bet for you is to get the lat/long for each address first, then store that in the DB, then send that instead of the address to google.  Then you wont be using up your rate limit.

More info on this:

http://www.coldfusionjedi.com/index.cfm/2009/12/15/Having-trouble-with-too-many-map-markers-and-CFMAP

As for how to get the lat/long something like this will work.


<cfhttp url="http://maps.google.com/maps/geo?q=#address#&output=csv&sensor=false&key=#key#"
    result="data" method="get">


<!--- check to make sure it seems valid --->
<cfif  listGetAt(data.filecontent,'1') neq 200>
    <script>
    history.go(-1);
    </script>
    <cfabort />
</cfif>
   
    <cfset lat = listGetAt(data.filecontent,'3')>
    <cfset long = listGetAt(data.filecontent,'4')>