Hitachi Vantara Pentaho Community Forums
Results 1 to 13 of 13

Thread: Change marker icon into map component using openstreet

  1. #1
    Join Date
    Aug 2012
    Posts
    25

    Default Change marker icon into map component using openstreet

    Hello everyone i´m working with a NewMapComponent with openstreet engine.

    I would like to change the marker icon if it´s upper than a threshold. It´s posible to change it after it was executed?

    for example:
    i got the result set like (city,value)
    markers:
    : value<100
    : value>100

    Thanks for all it´was only a graphic example

    AJ

  2. #2
    Join Date
    Nov 2011
    Posts
    1,229

    Default

    Hey.

    Two ways you can do that:

    1. Have the marker come from the data. If your dataset for the component includes a column named marker, the data on that column will be used as the marker url. That way, you can have your query decide what marker you want for each point.

    2. MapComponent uses AddIns to encapsulate the logic for fetching the markers. This means you can develop your own addin and make the component use it. If you look at lines 76-104 of NewMapComponent.js you'll see a urlMarker addin being defined. You need to define a new addin, much like that one, but that checks the value and returns the appropriate marker. After defining the new addin, you must tell the component to use it - that's done on the preExecution step of the component. Something like this.markerImageGetter = <addinName> should do it.

    Cheers
    Pedro Vale
    --
    CTools Product Development
    http://www.webdetails.pt

  3. #3
    Join Date
    Aug 2012
    Posts
    25

    Default

    Thanks vale i was reading this adding in NewMapComponent.js and i understand it. But i don´t know how link it with my Result set.

    I don´t know how get the value "Description" (wich it´s the value to select diferent images) for each one. Marker image adding uses 3 params (tgt, st, opt) but i don´t know what it is.

    Thanks in advance

  4. #4
    Join Date
    Nov 2011
    Posts
    1,229

    Default

    st.data will give you the row you're processing. So st.data[0] (I think) will give you column 0 of the dataset row.
    The best way is to set a breakpoint at the top of the function and look into the st object. It will be easy to see where to get the data from.

    cheers
    Pedro Vale
    --
    CTools Product Development
    http://www.webdetails.pt

  5. #5
    Join Date
    Aug 2012
    Posts
    25

    Default

    Yes that´s. It´s like you are saying, you can access to data value using st.data[n] ("n" it´s the number of the column). I didn´t know wath kind of object was st

    Thanks for your attention pamval

  6. #6

    Default Change marker icon into map component using openstreet

    Hey AJ, I have the same need. Could you please send me the your code? I don't make the changes. Osmar,

  7. #7
    Join Date
    Aug 2012
    Posts
    25

    Default

    i have changed newMapComponent.js the addin MarkerImage, it has a switch based on the position of each result set´s row. You have to change it to assign the image as you need:
    if st.data[number-column-value] < threshold1 return 'getResource/system/pentaho-cdf-dd/resources/custom/components/NewMapComponent/images/marker_grey.png'
    else if st.data[number-column-value] < threshold2 return 'getResource/system/pentaho-cdf-dd/resources/custom/components/NewMapComponent/images/marker_orange.png'
    else return 'getResource/system/pentaho-cdf-dd/resources/custom/components/NewMapComponent/images/marker_black.png'


  8. #8
    Join Date
    Dec 2012
    Posts
    121

    Default

    Hi guys,
    can you explain me where can i find an add-In documentation?
    i did not understand what the mean of the function function (tgt, st, opt) and its parameters (what type of objects are them?).

    Any support will be appreciated.
    Yamas

  9. #9
    Join Date
    Sep 2016
    Posts
    15

    Default

    Hello!

    I trying to send marker to my map with trought my dataset, with a column named "marker" that contains the URL of marker.

    I create a folder in "public", named "marker". Inside this, I uploaded two markers: "red.png" and "green.png"

    My URL in column "marker" is /public/marker/red.png or /public/marker/green.png (it depends of position).

    But when I run the dashboard, no markers are showed. When I remove column marker, the originals markers are showed. So, I think there some problem with the URL of uploaded market.

    Anyone can help me?

    Thanks!

  10. #10
    Join Date
    Nov 2011
    Posts
    1,229

    Default

    I think the URL should be getResource/public/marker/red.png.

    What is the actual URL used? You should see the requests in the network console of the browser.
    Pedro Vale
    --
    CTools Product Development
    http://www.webdetails.pt

  11. #11
    Join Date
    Sep 2016
    Posts
    15

    Default

    Hi Pedro. I solved this problem.

    I put the image in "biserver-ce\pentaho-solutions\system\pentaho-cdf-dd\images\ProjectImages\red.png" and my URL in data source is "images/ProjectImages/red.png"

    It works fine. Thanks!

    Quote Originally Posted by pamval View Post
    I think the URL should be getResource/public/marker/red.png.

    What is the actual URL used? You should see the requests in the network console of the browser.

  12. #12

    Default

    Hi,
    I have a similar problem I have a column in my data set with the heading marker with URL as: /public/map/red.png.
    There is no change in the marker image
    Do I need to change any parameter to get the desired image,

  13. #13
    Join Date
    Mar 2017
    Posts
    4

    Default

    Useful information, but i'm using 'newMapComponent' and i can't define the marker by url, my dataset look like next:
    latitude, longitude, marker, description
    -16.2523, -65.2150, images/marker-blue.png, house
    -16.2369, -65.8596, images/marker-orange.png, penthouse
    this is an example, because i want to show differents colors for diferentes things in my dataset, i put the images in: path: 'biserver-ce\pentaho-solutions\system\pentaho-cdf-dd\images'
    so i don't know what is wrong, i am using pentaho 6.1


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.