Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
Hi,
I am trying to use openstreet map as it is free unlike the google maps widget, but i dont know how , so i though to use the Html Text area widget as i couldnt find another html widget, i put this html inside it :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OpenStreetMap Example</title>
<style>
/* Ensure the page takes up full height and removes margin/padding */
html, body {
height: 100%;
margin: 0;
padding: 0;
overflow: hidden; /* Prevent scrollbars */
}
/* Container for the map */
.map-container {
width: 100%;
height: 100%; /* Make the container fill the available height */
border: 2px solid #ccc; /* Add a small border around the map */
box-sizing: border-box; /* Ensure border is inside the container */
}
/* Ensure the iframe fills the map container */
iframe {
width: 100%;
height: 100%; /* Use the full height of the map container */
border: none; /* Remove the iframe's default border */
}
/* Additional styles to hide unwanted header and controls */
iframe[src*="openstreetmap.org"] {
display: block; /* Prevent inline-block and make sure the iframe takes up full width */
}
iframe[src*="openstreetmap.org"] + p {
display: none; /* Hide the "OpenStreetMap Embedded Map" text */
}
</style>
</head>
<body>
<!-- Map container with a small frame -->
<div class="map-container">
<iframe src="https://www.openstreetmap.org/export/embed.html?bbox=49.981493,26.245890,49.985093,26.247870&layer=mapnik&marker=26.246400,49.982544&noheader=true&nofollow=true&nozoom=true"
frameborder="0"
allowfullscreen=""></iframe>
</div>
</body>
</html>
when i run this html in a separate html file the map take the whole window and this is what i want , but when i put this same code inside the text property in the html txt area it only take a small area in the corner like this photo,
i am using thingworx 9.6 , i also couldnt use leaflet , when i installed it from github i cant finde the map link option and it felt like it is not going to work proprly , so how to do what i am aiming for, which is show some coordinates on a map and also make something like a tracking line to show all the previous locations also,
thank you,
Solved! Go to Solution.
Hello @IA_10816220 , Figured out the issue of expanding to fit container.so Here is an update. Have fun
Take a look:
yeah i have seen all these links and tutorials, in short i cant use google maps for free , but their widget works fine, so i though about using openstreet map , but here i am with my issue, in the tutorial in this step:
can i replace the url with something else that is free to use ?
thank you, I am a bit new to all of this,
Hello @IA_10816220 ,
I am aware that the Google Maps Extension now requires an AppKey to license.
I believe that if you do not supply an AppKey the map has a watermark.
In early versions of the Google Map Extension the option of adding the AppKey to the URL was not available .
It was necessary to insert the AppKey into the Extension.
There was an OpenStreetMap Extension which was created by the User community. I had played with it several years ago but have lost my copy.
In regards to your question Google Maps is no longer free. This is a decision which was made by Google
Regards,
Peter
thank you,
so about the openstreet map i cant find widget or plugin, also the leaflet widget doesn't work properly and the property field for the map link is not working, i think the widget itself is not working properly with thingworx 9.6 , i believe my html doesn't work with html textarea because the CSS thingworx cant understand maybe,
Hello @IA_10816220 ,
I am not sure I understand all the issues you are experiencing with the OpenStreetMap Extension.
I went looking for the old version. I managed to find one but it did not seem to work. After various different attempts to get it working I arrived at an extension which adds a widget OpenStreetMap.
The widget seems to work.
I believe one of the issue you encountered is the widget does not expand to fill the canvas. I am sill working on that.
Please let me know if this works for you?
If there is anything which is missing from the extension, I can try to update. I did go get a new version of the JavaScript library which is used by OpenStreetMap. I also did a very limited test in ThingWorx 9.6.1 and it seemed to work.
Good Luck
Pehowe
Hello @IA_10816220 , Figured out the issue of expanding to fit container.so Here is an update. Have fun
thank you very much for your time I will test it again and feedback to you
it is working thank you,
it there a way to change the map tile to add tile URL or anything like that, as i cant find a property for that ,
and is there a manual or page for this extension page for this one, to help me know how to use it properly
thank you
Hello @IA_10816220 , I am glad to hear that the Extension is working.
I don't understand your request "to change the map tile to add tile URL". The Extension has a property "SelectedLocation", If you provide coordinates this will display a PIN at that location.
If the Widget in ThingWorx does not have the necessary configuration, the widget can be modified. This requires that the OpenStreetMap interface can accept the configuration parameters.
There is some documentation on how to create extensions. Article - CS201191 - Creating a custom Widget/Extension in ThingWorx Platform
If you are looking for features in OpenStreetMap they would have the documentation.
Regards,
pehowe