Modify

Opened 5 years ago

Closed 5 years ago

#18097 closed defect (fixed)

MapCSSTagChecker.getLocation does not work for US

Reported by: Don-vip Owned by: Don-vip
Priority: normal Milestone: 19.09
Component: Core validator Version:
Keywords: inside territory Cc: Klumbumbus

Description

From https://josm.openstreetmap.de/ticket/17058#comment:19

*[aeroway=aerodrome][!icao][faa!~/\d/][inside("US")],
*[aeroway=aerodrome][!iata][faa!~/\d/][inside("US")] {
  throwOther: tr("{0} without {1}", "{0.tag}", "{1.key}");
  group: tr("Airport tagging");
  /* assertNoMatch: "way aeroway=aerodrome faa=OK12"; not properly working due to inside() */
  /* assertMatch: "way aeroway=aerodrome faa=ORD"; */
}

does not work. US bounds resolve to:

[x=-180,y=-15,width=360,height=88]

center of the bbox resolve to

LatLon[lat=29.0,lon=0.0]

which is not in the US.

    private static LatLon getLocation(TagCheck check, Method insideMethod) {
        Optional<String> inside = getFirstInsideCountry(check, insideMethod);
        if (inside.isPresent()) {
            GeoPropertyIndex<Boolean> index = Territories.getGeoPropertyIndex(inside.get());
            if (index != null) {
                GeoProperty<Boolean> prop = index.getGeoProperty();
                if (prop instanceof DefaultGeoProperty) {
                    Rectangle bounds = ((DefaultGeoProperty) prop).getArea().getBounds();
                    return new LatLon(bounds.getCenterY(), bounds.getCenterX());
                }
            }
        }
        return LatLon.ZERO;
    }

Attachments (0)

Change History (1)

comment:1 by Don-vip, 5 years ago

Resolution: fixed
Status: assignedclosed

In 15359/josm:

see #17058, fix #18097 - fix MapCSSTagChecker.getLocation

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Don-vip.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.