[KML For Google Maps] Unable to add kml

Forge Component
(2)
Published on 2019-01-31 by Pedro Costa
2 votes
Published on 2019-01-31 by Pedro Costa

Hi I am trying to use this component but I just can't seem to add a kml file into it. 

1) I tried using resources folder and change the deploy action to Target Directory. Then I add the link into AddKmltoMap action. But the console states "Unable to retrieve /TestKml/TestPolygon.kml"

2) I tried using a link using both google bucket and dropbox but I got a CORS error.

I am sure I must have made a silly mistake as everyone seems to have used it easily. Please help, I'm new in this. Refer to attached oml file.

Chris Chua wrote:

Hi I am trying to use this component but I just can't seem to add a kml file into it. 

1) I tried using resources folder and change the deploy action to Target Directory. Then I add the link into AddKmltoMap action. But the console states "Unable to retrieve /TestKml/TestPolygon.kml"

2) I tried using a link using both google bucket and dropbox but I got a CORS error.

I am sure I must have made a silly mistake as everyone seems to have used it easily. Please help, I'm new in this. Refer to attached oml file.

Hi Chris,


Which OS version you are using?


Hi Chris,


I can see there is some problem to load your kml file.Please check this.

Salman Ansari wrote:

Hi Chris,


I can see there is some problem to load your kml file.Please check this.

Hi Salman,

Thanks for taking a look at the oml file. Yes its the same error which I saw on my console. May I know how do you load a kml file using this module?


Chris Chua wrote:

Salman Ansari wrote:

Hi Chris,


I can see there is some problem to load your kml file.Please check this.

Hi Salman,

Thanks for taking a look at the oml file. Yes its the same error which I saw on my console. May I know how do you load a kml file using this module?


Hi Chris,


Please see the attached oml.I have done that way in attached.


Salman Ansari wrote:

Chris Chua wrote:

Salman Ansari wrote:

Hi Chris,


I can see there is some problem to load your kml file.Please check this.

Hi Salman,

Thanks for taking a look at the oml file. Yes its the same error which I saw on my console. May I know how do you load a kml file using this module?


Hi Chris,


Please see the attached oml.I have done that way in attached.


Hi Salman,

I still can't retrieve the kmz file or my kml file. Both return 404 error. Refer to screenshot below. I'm suspecting that outsystems is blocking kml or kmz file to be uploaded into the resource. But I don't know where can I unblock it. I've explored the content security settings in Lifetime, but failed to figure out how.


Chris Chua wrote:

Salman Ansari wrote:

Chris Chua wrote:

Salman Ansari wrote:

Hi Chris,


I can see there is some problem to load your kml file.Please check this.

Hi Salman,

Thanks for taking a look at the oml file. Yes its the same error which I saw on my console. May I know how do you load a kml file using this module?


Hi Chris,


Please see the attached oml.I have done that way in attached.


Hi Salman,

I still can't retrieve the kmz file or my kml file. Both return 404 error. Refer to screenshot below. I'm suspecting that outsystems is blocking kml or kmz file to be uploaded into the resource. But I don't know where can I unblock it. I've explored the content security settings in Lifetime, but failed to figure out how.



You are right there is some block from OS end because I am able to browse pdf.doc file from resource folder but not able to browse kml file.



Hi Chris,


I got the answer why we are not able to browse kml file.Clarification from OS support as below.
We need to host kml in other server not personal env.


Salman Ansari wrote:

Hi Chris,


I got the answer why we are not able to browse kml file.Clarification from OS support as below.
We need to host kml in other server not personal env.


Hi Salman, thanks for checking with OS. I had also posted the same check to tech support and got the same reply too. I tried using using both google bucket and dropbox but I got a CORS error. Are you able to try to see if it works on your end?


Chris Chua wrote:

Salman Ansari wrote:

Hi Chris,


I got the answer why we are not able to browse kml file.Clarification from OS support as below.
We need to host kml in other server not personal env.


Hi Salman, thanks for checking with OS. I had also posted the same check to tech support and got the same reply too. I tried using using both google bucket and dropbox but I got a CORS error. Are you able to try to see if it works on your end?


could you please share screen shot of error?


Solution

Hi all,

In order to overcome this limitation you can host the file in dropbox, and in order to overcome the CORS issue you may use a proxy like CORS AnyWhere to make that file available in your sample app.

I did a test with the file that you mentioned. I uploaded to my dropbox and got the share link "https://www.dropbox.com/s/jx0vkkx11hvtwxn/TestPolygon.kml" in order to make this direct link you need to change the www for "dl" (direct link), so dropbox link will not present the preview of the file but returning the file immediately "https://dl.dropbox.com/s/jx0vkkx11hvtwxn/TestPolygon.kml", so this link can be retrieved by the proxy that adds the CORS headers so it can be displayed correctly in your test application:

https://cors-anywhere.herokuapp.com/https://dl.dropbox.com/s/jx0vkkx11hvtwxn/TestPolygon.kml

Hope this helps you to overcome this.


Best regards.

Solution

Hi Daniel,


Thank you for clarification but what about if we want this file generated dynamically.

We are generating kml file from the entity and some logic in our app then we wanted to use that kml file in google map to display our location.How can we achieve this?

Hi Salman,


Why not use the same approach? 

DropBox has an API that allow us to upload files and host of any type there. So you would generate the file and then upload it and make it available dynamically. 


Hope it helps you.

Best regards

Daniel Martins wrote:

Hi Salman,


Why not use the same approach? 

DropBox has an API that allow us to upload files and host of any type there. So you would generate the file and then upload it and make it available dynamically. 


Hope it helps you.

Best regards

Yes we can do that way.Thanks

Hope Dropbox API not paid?