Measuring tool units in feet

134 views
Skip to first unread message

Steve Borgstrom

unread,
Jul 6, 2013, 6:56:01 PM7/6/13
to geoext-vi...@googlegroups.com
Hi everyone,
I've experimented to my wit's end, being much more of a hacker than qualified programmer, and I can't seem to figure out how to configure the measuring tool to return feet instead of meters.  Without iterating each of my failures, my best guess was in the Heron.options.map.toolbar definition, adding the OpenLayers parameter displaySystem: 'english' to the "measurelength" tool:

Heron.options.map.toolbar = [
   ...
   {type: "measurelength", options: {geodesic: true, displaySystem: 'english'}},
   ...
]

Unfortunately, this has no effect.  FWIW, my map is configured like:
        Heron.options.map.settings = {
                                                        projection: 'EPSG:900913',
                                                        units: 'm',
                                                        displayProjection: new OpenLayers.Projection("EPSG:4326"),
     ...
}

Any assistance is greatly appreciated.  This is an amazing set of tools and I'm really enjoying learning about them.

-Steve


Just van den Broecke

unread,
Jul 8, 2013, 4:39:49 AM7/8/13
to geoext-vi...@googlegroups.com
Hi Steve,

You are right: for the OpenLayers Measure Control, displaySystem:
'english' is the way to change meters/kms to feet/miles.

There is a way to pass this parameter into the Heron measurelength tool.
It is a bit elaborate: you have to replace the entire instance of
OpenLayers.Control.Measure in the "options" config object with your own,
this will replace the default, :
options: {geodesic: true,
control: new
OpenLayers.Control.Measure(OpenLayers.Handler.Path, {
persist: true,
immediate: true,
displayClass: "olControlMeasureDistance", // css-Cursor
displaySystem: 'english',
handlerOptions: {
layerOptions: {styleMap: new OpenLayers.StyleMap({
"default": new OpenLayers.Style(null, {
rules: [new OpenLayers.Rule({
symbolizer: {
"Point": {
pointRadius: 10,
graphicName: "square",
fillColor: "white",
fillOpacity: 0.25,
strokeWidth: 1,
strokeOpacity: 1,
strokeColor: "#333333"
},
"Line": {
strokeWidth: 1,
strokeOpacity: 1,
strokeColor: "#FF0000",
strokeDashstyle: "solid"
}
}
})]
})
})
}
}
}),
.
},

(This also allows you to change other parameters like line and cursor
style). Hope this helps, best,

Just
> --
> --
> You received this message because you are subscribed to the Google
> Groups "geoext-viewer-devel" group.
> To post to this group, send email to
> geoext-vi...@googlegroups.com
> To unsubscribe from this group, send email to
> geoext-viewer-d...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/geoext-viewer-devel?hl=en
>
> ---
> You received this message because you are subscribed to the Google
> Groups "Heron Mapping Client Development" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to geoext-viewer-d...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Steve Borgstrom

unread,
Jul 8, 2013, 10:16:27 PM7/8/13
to geoext-vi...@googlegroups.com, jus...@gmail.com
Fantastic!  That works, Just.  More importantly, it makes sense to me.  Thank you for your assistance.  

All the best,
Steve
> For more options, visit this group at
> http://groups.google.com/group/geoext-viewer-devel?hl=en
>
> ---
> You received this message because you are subscribed to the Google
> Groups "Heron Mapping Client Development" group.
> To unsubscribe from this group and stop receiving emails from it, send

Michael Bishopp

unread,
Dec 30, 2015, 2:55:44 PM12/30/15
to Heron Mapping Client Development
Steve,

I am just getting started with using Heron MC--very cool stuff.  I am wondering if you would be available to answer some questions regarding implementing this tech in US units (feet)?

Thanks,

Michael Bishopp

Just van den Broecke

unread,
Dec 31, 2015, 7:57:23 AM12/31/15
to geoext-vi...@googlegroups.com
Michael/Steve,

Looking at the code: the Heron toolbar types "measurelength" and
"measurearea" do not (yet) pass options like 'displaySystem' and
'displaySystemUnits' to the wrapped OpenLayers.Control.Measure object,
see possoble properties:
http://dev.openlayers.org/docs/files/OpenLayers/Control/Measure-js.html

So this needs to be fixed in Heron. Can you open an issue, like "Allow
passing units in Heron Toolbar Measure* control config" at:
https://github.com/heron-mc/heron-mc/issues ?

Thanks,

Just
> --
> --
> You received this message because you are subscribed to the Google
> Groups "geoext-viewer-devel" group.
> To post to this group, send email to
> geoext-vi...@googlegroups.com
> To unsubscribe from this group, send email to
> geoext-viewer-d...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/geoext-viewer-devel?hl=en
>
> ---
> You received this message because you are subscribed to the Google
> Groups "Heron Mapping Client Development" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to geoext-viewer-d...@googlegroups.com
> <mailto:geoext-viewer-d...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Steve Borgstrom

unread,
Dec 31, 2015, 10:16:19 AM12/31/15
to Heron Mapping Client Development
Hi Michael,
I'm happy to help where I can. My email address is scbor...@gmail.com if you want to connect off-list. FWIW, here's the snippet of code I included in my toolbar to produce a foot-based measuring tool:

    {type: "measurelength", options: {geodesic: true,
Steve

Michael Bishopp

unread,
Dec 31, 2015, 12:12:30 PM12/31/15
to Heron Mapping Client Development, jus...@gmail.com
I will open a ticket.  Thanks!
> To unsubscribe from this group, send email to
> For more options, visit this group at
> http://groups.google.com/group/geoext-viewer-devel?hl=en
>
> ---
> You received this message because you are subscribed to the Google
> Groups "Heron Mapping Client Development" group.
> To unsubscribe from this group and stop receiving emails from it, send
Reply all
Reply to author
Forward
0 new messages