[Script] WME Geometries - 2025.03.25.002

Prompted by this request for city boundaries, and inspired by now defunct WME GPS Track View

WME Geometries can load a geometry file and overlay it directly in the Waze Map Editor. Simply go to the Areas tab on the left, and scroll down to the new controls that have been added.

  • Greasyfork: WME Geometries
    The data format is detected automatically using the file extension, and the following formats are supported: GeoJSON, GML, WKT, KML, and GPX; and coordinate systems ESPG 3857, 4269 and 4326. If you have a (free to use) ArcGIS or ESRI Shapefile, then this can be converted into one of these text formats.

If you’re having trouble with your geometry data, then please get in touch with me and I’ll see if I can help.

It is possible to load very large geometry files, of order 10 Mb, and the editor still performs moderately well. Files that closer to 100 Mb will probably make the editor struggle when panning/zooming. This can be mitigated by ‘simplifying’ the original geometry before converting it to a supported format.

Labels will be shown for files with less than 50 features, if an appropriately named attribute can be found: name, Name, NAME or NAME0. Displaying labels for larger numbers of features really kills performance due to how OpenLayers handles them.

Development background: the functionality to parse geometries files is built in to OpenLayers, and so it does the majority of the processing. The ability to handle KML and GPX was tricky, as Waze seem to be using a crippled version of the library that was missing those two. I eventually figured out how to patch the missing functions in.

Possible future work:

  • Dedicated parsing for Waze GPS files
  • Finer control of options and layers
2 Likes

Tools for converting Shapefies

  • MyGeoData - Free Online GIS Data Converter
  • QGIS - OpenSource Desktop Application for Windows, Mac, Linux
    Conversion Tips (using QGIS)
  • Where possible, stick to standard “lat,lon” coordinate system: WGS 84 (EPSG:4326)
  • The “Simplify Geometries” tool can reduce the size of the data before exporting.
    Experiment with tolerances around 0.0002 - 0.0005 (assuming WGS 84 coordinates).
  • When exporting large files, tick “Skip attribute creation” to save space.
  • When saving as GeoJSON, you can reduce “coordinate precision” to 4.
    To make GeoJSON files even smaller, delete all space characters (20% saving!).
  • If anyone can work out how to remove coastlines, that will make a huge difference…
    Example Geometry Files
  • States of USA (48 contiguous states)
  • Counties of USA
  • Counties of Puerto Rico
  • Counties of Great Britain (“soon”)
  • Counties of Northern Ireland
  • Regions of Philippines

I’ve been using your tool Tim, and it’s a valuable tool for countries like Indonesia that’s lacking any clear information on regions.

I’ve got a suggestion for the tool though: Possible to have the boundary colors be different than dark blue? Sometimes it’s difficult to see the lines when the maps are dark.

Other than that, this is great.

Tools, tips and examples added to second post. :slight_smile:

I’m trying to add a missing city using the Census Designated Places data found here (California): https://www.census.gov/geo/maps-data/data/cbf/cbf_place.html

This add-on seems just what I need to get a nice overlay. Unfortunately, I can’t seem to get the conversion right. I’ve converted it to GeoJSON using the MyGeoData link above, but I always get the error message “JSON format not supported :(” when I try to import the data. Any advice?

^ You need to rename it so it has a .geojson extension.

Doh! So simple! It worked beautifully for this purpose!

bounds.jpg

Its a simple, light, and easy!
Unfortunately it failed to show name in different shape.


the yellow highlight above supposed to have the same name (Bangil)

Maybe if you can do color beside its name it can be help, some area in my country has 20+ shapes with the same name

Great work anyway! :smiley:

Great usefull script :smiley:

Thanks Tim for the script. By chance have you given any more thought for selectable colors? Or a way for us to set the colors by file load.

Thanks, this is interesting. Is it possible to increase the limitation that suppresses the display of the name attribute when there are more than 50 polygons/feature in the file? 75 would be more appropriate (average US State has about 63 counties, for instance).

I would recommend you select Google KML with WGS84 (EPSG:4326). Download and extract the .kmz using a zip program. If you’re lucky, you’ll be able to import the .kml files stored within.

Failing that, your next option is to download ESRI Shapefile, and use a program like QGIS to export a supported text format. See post #2 in this thread for links to tools.

Same from me, Tim. With the mini-building boom re-starting around NW Ark, this is an excellent script to ensure new roads are accurate. Thanks for the effort and expertise.

I ran some tests using Firefox; the number of features within one single track can be manipulated by altering line 159 of the script and it seems the default value of 50 can be increased to 255 (that’s 2^8 - 1) at least.

Johnny

WME Geometries is not working when I try to use the beta version.

WME Geometries is a user script. There’s no point posting a bug to the Beta forum, as you’re supposed to be testing the beta without scripts and there’s nothing Waze can do about it. :wink:

Post problems with WME Geometries here please.

[/quote]

Moved the last two posts from a new thread in beta WME bugs into this one :wink:

Script is no longer working as of this morning

experience the same thing when i want to see boundaries

This is the full error in the JS console, looks like a function is no longer provided.

ERROR: Execution of script 'WME Geometries' failed! OpenLayers.Format.GML is not a function
formathelp @ VM1677:4
(anonymous function) @ VM1677:5
c @ VM1640:40
(anonymous function) @ VM1676:1
p @ VM1640:71h
a @ VM1640:40k
a @ VM1640:82
b @ VM1640:83

Commenting out line 24 (‘GML’:new OpenLayers.Format.GML) allows Geometries to work again, but most likely won’t be able to load GML files (others still work).