Skip to content

Some GeoJSON shapes are broken #694

Closed

Description

@averas

I'm a bit curious as to which GeoJSON types that are supported as sources and what their limitations are. From the source (tilegeojson.js) it's obvious that MultiPolygon types are not yet supported:

...
    } else if (type === 'MultiPolygon') {
        throw("todo");
...

However, I've ran into odd behaviour with geojson that supposedly is supported. Take the following for example: http://jsfiddle.net/vahs068p/ A regular Polygon. Nothing shows, no javascript-errors. If I however take that same geojson and simplify it a bit (i.e. remove some vertices) it renders fine: http://jsfiddle.net/ggfe0y61/

If I take an arguably complex and big Polygon (thousands of vertices and holes) I get an error in tilegeojson.js like so:

Uncaught TypeError: Cannot read property 'x' of undefined

at

var corner = corners[c];
segments[k].push(new Point(
     (corner.x + (corner.x - 0.5 > 0 ? 1 : -1) * padding) * tileExtent,
     (corner.y + (corner.y - 0.5 > 0 ? 1 : -1) * padding) * tileExtent));
}

This can be seen here: http://firefly.ibk.se/~racer/mapboxgl_vanern.html

This drills down to:
Are arbitrary big (geometrically) Polygons supported?
Are arbitrary big (number of vertices) Polygons supported?
Are Polygons with holes supported?
Any notion when MultiPolygons will be supported?

Activity

  1. mourner commented on Aug 13, 2014

    @mourner
    Member

    Thanks for a nice report! Looks like there are some serious issues with our implementation of cutting GeoJSON into tiles here: https://github.com/mapbox/mapbox-gl-js/blob/mb-pages/js/source/tilegeojson.js

    Not sure whether they're an easy fix or not, @ansis can you take a look at this?

  2. added this to the milestone on Aug 13, 2014
  3. changed the title [-]Supported GeoJSON types[/-] [+]Some GeoJSON shapes are broken[/+] on Aug 13, 2014
  4. modified the milestones: v0.3, v0.4 on Sep 23, 2014
  5. modified the milestone: v0.4 on Nov 4, 2014
  6. added a commit that references this issue on Dec 8, 2014
    43260ce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions