sghaskell / maps-plus

Maps+ for Splunk
Other
18 stars 3 forks source link

Feature request #3

Closed pgthompson closed 5 years ago

pgthompson commented 5 years ago

Hey Scott Love the Maps+ app! (trying it out in Ver 7.14). Are there any plans to apply the markerPriority to the new circle (canvas) markers? I've tried getting it to work, unsuccessfully. e.g. eval markerPriority=if(Site="Site A","1000","-1000") Site A renders below others. Cheers Paul Thompson

sghaskell commented 5 years ago

Hey Paul. Let me look into this. It's likely just an oversight on my part when I added the new feature. I'll do some testing and let you know.

pgthompson commented 5 years ago

Hi there Scott

Just wondering when you might have an updated version that caters for the canvas marker priority?

Thanks, Paul

From: Scott Haskell notifications@github.com Sent: Wednesday, 28 November 2018 1:16 p.m. To: sghaskell/maps-plus maps-plus@noreply.github.com Cc: Paul Thompson Paul.Thompson@spark.co.nz; Author author@noreply.github.com Subject: Re: [sghaskell/maps-plus] Feature request (#3)

Hey Paul. Let me look into this. It's likely just an oversight on my part when I added the new feature. I'll do some testing and let you know.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/sghaskell/maps-plus/issues/3#issuecomment-442268740, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Ab40Kg6OCLkGuQ4w2Mo_G9XOVYwNRcmdks5uzdXVgaJpZM4Y2lTr.

This email, including any attachments, is confidential. If you have received this email in error, please let me know and then delete it - do not read, use, or distribute it or its contents. This email does not designate an information system for the purposes of the Contract and Commercial Law Act 2017.

sghaskell commented 5 years ago

Hi Paul,

Apologies for not getting to this sooner. I've got some new features I'll be pushing out shortly so I'll look to incorporate this fix into the release. Thanks for your patience!

sghaskell commented 5 years ago

Hi @pgthompson

I'm looking into this now. You can only set a zIndexOffset on a Marker which is considered a UI layer. The CircleMarker is a vector layer and it doesn't have a similar functionality. The only viable thing I can see is using he method bringToFront but that would require grouping markers into layers. You'd be limited to bringing only one layer to the front via SPL. I could add a context menu when right clicking on a circle to bring its layer to the front, but that requires interaction with the map. It appears there's no simple way to accomplish something similar to markerPriority using vector layers.

sghaskell commented 5 years ago

I'm digging a bit deeper and it looks like you can create new panes and specify their Z-Index. I'll play with this and see if it's a viable solution.

pgthompson commented 5 years ago

Thanks Scott, appreciate your great work! Paul

From: Scott Haskell notifications@github.com Sent: Thursday, 7 March 2019 6:14 a.m. To: sghaskell/maps-plus maps-plus@noreply.github.com Cc: Paul Thompson Paul.Thompson@spark.co.nz; Author author@noreply.github.com Subject: Re: [sghaskell/maps-plus] Feature request (#3)

Hi Paul,

Apologies for not getting to this sooner. I've got some new features I'll be pushing out shortly so I'll look to incorporate this fix into the release. Thanks for your patience!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/sghaskell/maps-plus/issues/3#issuecomment-470193900, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Ab40KmbjVpP3EiRKSimBYcodxLZyb6lrks5vT_dYgaJpZM4Y2lTr.

This email, including any attachments, is confidential. If you have received this email in error, please let me know and then delete it - do not read, use, or distribute it or its contents. This email does not designate an information system for the purposes of the Contract and Commercial Law Act 2017.

sghaskell commented 5 years ago

@pgthompson I've got a fix in place for this that I'll publish shortly with my other enhancements. It leverages the markerPriority field in SPL, but it has to be used in conjunction with the layerGroup field. I'm creating new panes based on the layer groups and setting the zIndex on each layer in the layer group. I'm starting at Z-Index 400 which is the overlayPane. It can safely handle 250 layers before bleeding into the tooltipPane. It will paint into the shadowPane and markerPane above 100 layers, but it shouldn't matter unless you are mixing circle markers with svg or png markers. It also respects layering using the layer control toggle.

Here are the map pane ranges for reference.

I may end up adding a new layerPriority field to reduce any confusion. What are your thoughts?

pgthompson commented 5 years ago

Awesome Scott! Looking forward to the new release Paul

From: Scott Haskell notifications@github.com Sent: Tuesday, 12 March 2019 7:56 a.m. To: sghaskell/maps-plus maps-plus@noreply.github.com Cc: Paul Thompson Paul.Thompson@spark.co.nz; Mention mention@noreply.github.com Subject: Re: [sghaskell/maps-plus] Feature request (#3)

@pgthompsonhttps://github.com/pgthompson I've got a fix in place for this that I'll publish shortly with my other enhancements. It leverages the markerPriority field in SPL, but it has to be used in conjunction with the layerGroup field. I'm creating new panes based on the layer groups and setting the zIndex on each layer in the layer group. I'm starting at Z-Index 400 which is the overlayPane. It can safely handle 250 layers before bleeding into the tooltipPane. It will paint into the shadowPane and markerPane above 100 layers, but it shouldn't matter unless you are mixing circle markers with svg or png markers. It also respects layering using the layer control toggle.

Here are the map pane rangeshttps://leafletjs.com/reference-1.3.0.html#map-pane for reference.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/sghaskell/maps-plus/issues/3#issuecomment-471674961, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Ab40KhMMtDa3VfDKZr1VMSWy5vqrwe35ks5vVqbMgaJpZM4Y2lTr.

This email, including any attachments, is confidential. If you have received this email in error, please let me know and then delete it - do not read, use, or distribute it or its contents. This email does not designate an information system for the purposes of the Contract and Commercial Law Act 2017.

sghaskell commented 5 years ago

Hi @pgthompson - Sorry for the delay in getting this to you. Could you try out this branch to see if it meets your expectations?

https://github.com/sghaskell/maps-plus/tree/feature/vector-path-enhancements

Use the new SPL field layerPriority in conjunction with layerGroup when using circle markers or paths (polylines). It behaves the same way as markerPriority.

Here's an example search

| inputlookup chicago-crime.csv
| eval description = "<b>".description."</b>", 
tooltip=description, 
clusterGroup="default",
markerType="circle", 
layerGroup=case(like(description, "%SIMPLE%"), "simple", like(description, "%DOMESTIC BATTERY%"), "domestic", like(description, "%500 AND UNDER%"), "five_hundred", like(description, "%TO PROPERTY%"), "property", like(description, "%RETAIL THEFT%"), "retail", like(description, "%TO VEHICLE%"), "vehicle", 1=1, "default"),
layerPriority=case(like(description, "%SIMPLE%"), "10", like(description, "%DOMESTIC BATTERY%"), "20", like(description, "%500 AND UNDER%"), "30", like(description, "%TO PROPERTY%"), "4000", like(description, "%RETAIL THEFT%"), "50", like(description, "%TO VEHICLE%"), "60", 1=1, "1"),
layerDescription=case(like(description, "%SIMPLE%"), "simple", like(description, "%DOMESTIC BATTERY%"), "domestic", like(description, "%500 AND UNDER%"), "five_hundred", like(description, "%TO PROPERTY%"), "property", like(description, "%RETAIL THEFT%"), "retail", like(description, "%TO VEHICLE%"), "vehicle", 1=1, "default"),
circleColor=case(like(description, "%SIMPLE%"), "#42f498", like(description, "%DOMESTIC BATTERY%"), "rgb(95, 66, 244)", like(description, "%500 AND UNDER%"), "#41f4ee", like(description, "%TO PROPERTY%"), "rgb(175, 244, 65)", like(description, "%RETAIL THEFT%"), "#f46741", like(description, "%TO VEHICLE%"), "cadetblue", 1=1, "#f44164"),      
circleFillColor=case(like(description, "%SIMPLE%"), "#f442c8", like(description, "%DOMESTIC BATTERY%"), "#be41f4", like(description, "%500 AND UNDER%"), "#d1ef62", like(description, "%TO PROPERTY%"), "rgb(99, 14, 76)", like(description, "%RETAIL THEFT%"), "#370e63", like(description, "%TO VEHICLE%"), "#72066b", 1=1, "#f2074d"), 
circleOpacity=case(like(description, "%SIMPLE%"), "0.4", like(description, "%DOMESTIC BATTERY%"), "0.4", like(description, "%500 AND UNDER%"), "0.7", like(description, "%TO PROPERTY%"), "0.8", like(description, "%RETAIL THEFT%"), "0.3", like(description, "%TO VEHICLE%"), "0.5", 1=1, "0.6"),
circleFillOpacity=case(like(description, "%SIMPLE%"), "1.0", like(description, "%DOMESTIC BATTERY%"), "0.3", like(description, "%500 AND UNDER%"), "0.5", like(description, "%TO PROPERTY%"), "0.6", like(description, "%RETAIL THEFT%"), "0.7", like(description, "%TO VEHICLE%"), "0.3", 1=1, "0.4"),
circleRadius=case(like(description, "%SIMPLE%"), "15", like(description, "%DOMESTIC BATTERY%"), "10", like(description, "%500 AND UNDER%"), "12", like(description, "%TO PROPERTY%"), "7", like(description, "%RETAIL THEFT%"), "5", like(description, "%TO VEHICLE%"), "6", 1=1, "4"),
circleStroke=case(like(description, "%SIMPLE%"), "true", like(description, "%DOMESTIC BATTERY%"), "true", like(description, "%500 AND UNDER%"), "false", like(description, "%TO PROPERTY%"), "true", like(description, "%RETAIL THEFT%"), "false", like(description, "%TO VEHICLE%"), "cadetblue", 1=1, "true"),
circleWeight=case(like(description, "%SIMPLE%"), "20", like(description, "%DOMESTIC BATTERY%"), "10", like(description, "%500 AND UNDER%"), "12", like(description, "%TO PROPERTY%"), "8", like(description, "%RETAIL THEFT%"), "15", like(description, "%TO VEHICLE%"), "13", 1=1, "8")
| table latitude, longitude, description, tooltip, markerType, clusterGroup, layerGroup, circleColor, circleFillColor, circleOpacity, circleFillOpacity, circleRadius, circleStroke, circleWeight, layerDescription, layerPriority
pgthompson commented 5 years ago

Hi Scott Sorry but I’m fairly basic javascript user. I downloaded visualization.js from Git ok.

I set those 2 values to this (using similar logic to markerPriority but wasn’t too sure about arguments for layerGroup so just set the same as priority) layerPriority=if(like(description,"%COW%"),"1000","900"),layerGroup=if(like(description,"%COW%"),"1000","900")

Without running the new js my map seemed to prioritise the circles ok initially (with both layers on) which is kind of interesting.

[cid:image001.png@01D4EB9F.5AAB9A30]

When I hide the ‘green’ layer and then unhide again it renders on top [cid:image004.jpg@01D4EB9F.A5020F10]

I then ran visualization.js in FF scratchpad but it didn’t seem to have any effect so I’m not sure if I’m doing something wrong trying to run the js this way or have the layer values wrong. Cheers Paul

From: Scott Haskell notifications@github.com Sent: Thursday, 28 March 2019 4:03 p.m. To: sghaskell/maps-plus maps-plus@noreply.github.com Cc: Paul Thompson Paul.Thompson@spark.co.nz; Mention mention@noreply.github.com Subject: Re: [sghaskell/maps-plus] Feature request (#3)

Hi @pgthompsonhttps://github.com/pgthompson - Sorry for the delay in getting this to you. Could you try out this branch to see if it meets your expectations?

https://github.com/sghaskell/maps-plus/tree/feature/vector-path-enhancements

Use the new SPL fieldlayerPriority in conjunction with layerGroup when using circle markers or paths (polylines). It behaves the same way as markerPriority.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/sghaskell/maps-plus/issues/3#issuecomment-477427897, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Ab40KqG1otJqab5KhbLhX0BhAc-jIIzvks5vbDDNgaJpZM4Y2lTr.

This email, including any attachments, is confidential. If you have received this email in error, please let me know and then delete it - do not read, use, or distribute it or its contents. This email does not designate an information system for the purposes of the Contract and Commercial Law Act 2017.

sghaskell commented 5 years ago

Hi @pgthompson - Did you add layerGroup and layerPriority in your final table command? - | table layerGroup, layerPriority You will also need to re-start Splunk after dropping visualization.js into the app. You may also have the old version cached in your browser. Try clearing your browser cache.

pgthompson commented 5 years ago

Hi Scott

I managed to add visualization.js to the app and restart and it worked a treat after that! The canvas markers are prioritising as desired. Thanks 😊

From: Scott Haskell notifications@github.com Sent: Friday, 12 April 2019 8:40 a.m. To: sghaskell/maps-plus maps-plus@noreply.github.com Cc: Paul Thompson Paul.Thompson@spark.co.nz; Mention mention@noreply.github.com Subject: Re: [sghaskell/maps-plus] Feature request (#3)

Hi @pgthompsonhttps://github.com/pgthompson - Did you add layerGroup and layerPriority in your final table command? - | table layerGroup, layerPriority You will also need to re-start Splunk after dropping visualization.js into the app. You may also have the old version cached in your browser. Try clearing your browser cache.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/sghaskell/maps-plus/issues/3#issuecomment-482302894, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Ab40KrEGQMiv_QtH3ydVFxH_DtW8Vcpuks5vf52jgaJpZM4Y2lTr.

This email, including any attachments, is confidential. If you have received this email in error, please let me know and then delete it - do not read, use, or distribute it or its contents. This email does not designate an information system for the purposes of the Contract and Commercial Law Act 2017.

sghaskell commented 5 years ago

Thanks for confirming @pgthompson . I hope to get the release out this week with this feature and a bunch of others.

sghaskell commented 5 years ago

Hi @pgthompson . This has been addressed in v3.0.1. See layer priority.