Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Esri Shape file support #906

Open
spyhunter99 opened this issue Jan 28, 2018 · 17 comments

Comments

@spyhunter99
Copy link
Collaborator

commented Jan 28, 2018

Issue Type

[x] Improvement

Description and/or steps/code to reproduce the problem

Support importing/convert an esri shape file to osm style overlays

@spyhunter99

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 28, 2018

I found an ASF compatible library and at least reads the important fields of shape files. I was able to get it imported and was able to convert a low res country border shape file. This produced 250+ polygons, many with holes. There was a few rendering artifacts that @monsieurtanuki may be interested in, looks like it's isolated to polygons + date line rendering at a low zoom level.

Panning performance was also...poor to say the least. In genymotion it's rendering at about 1 fps. It's slightly better on real hardware but it's still rather poor.

related tickets
#857 #820 #770 #890

I think this highlights that we could do a better job of optimizing what needs to be rendered and what doesn't and to run point reduction based on what's on screen + the zoom level.

@spyhunter99

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 28, 2018

@spyhunter99

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 28, 2018

spyhunter99 added a commit that referenced this issue Jan 28, 2018
@spyhunter99

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 28, 2018

image
image
image
image

after profiling, it looks like most of the time is spent in SegmentIntersection.divisionByZeroSideEffect

@spyhunter99

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 28, 2018

I also found a dbase reader so that we can attach the meta data with each shape.

image

@spyhunter99

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 30, 2018

this issue depends on #910

@monsieurtanuki

This comment has been minimized.

Copy link
Collaborator

commented Jan 31, 2018

This produced 250+ polygons, many with holes. There was a few rendering artifacts that @monsieurtanuki may be interested in, looks like it's isolated to polygons + date line rendering at a low zoom level.

From the video the only strange thing I saw was with Antartica, which is by construction a side effect in osmdroid's Mercator projection: what kind of Polygon is that supposed to be? It even goes beyond our minimum latitude!

Panning performance was also...poor to say the least. In genymotion it's rendering at about 1 fps. It's slightly better on real hardware but it's still rather poor.

Regardless of the Douglas-Peucker algorithm or the possible improvements of Path construction, rendering many Paths is slow. Remember the heat map: very stupid square Paths, but numerous, therefore slow panning.

after profiling, it looks like most of the time is spent in SegmentIntersection.divisionByZeroSideEffect

I had a look at the code. The best I could do so far was to optimize Math.min (!). Another step would be to split SegmentIntersection.check in two, in order to avoid some computing for Y's if we already know that X's don't fit. But doing so we just avoid multiplications.
Or just rethink the whole thing...

spyhunter99 added a commit that referenced this issue Feb 3, 2018
@spyhunter99

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 4, 2018

@monsieurtanuki are you aware of any kind of padding or anything to that effect when calling mapView.getBoundingBox? It almost looks like there is an 18dp padding that is subtracked from the actual bounding box of the view

@spyhunter99

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 4, 2018

never mind, i've spent hours trying to debug some boundbox issues, turns out it was my code that cause the issue

@spyhunter99

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 5, 2018

@monsieurtanuki do we have a method to determine if there are multiple worlds currently in the view?

@monsieurtanuki

This comment has been minimized.

Copy link
Collaborator

commented Feb 5, 2018

It's rather @Maradox that worked on that multiple world feature and I don't know if he implemented something specific about that need, but depending on what you mean exactly I would check MapView.isHorizontalMapRepetitionEnabled, MapView.isVerticalMapRepetitionEnabled, MapView.getWidth, MapView.getHeight and TileSystem.MapSize.

@spyhunter99

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 5, 2018

thanks

spyhunter99 added a commit that referenced this issue Feb 6, 2018
…g bounding box
@Maradox

This comment has been minimized.

Copy link
Collaborator

commented Feb 6, 2018

@spyhunter99 When I implemented the no-repetition feature I didn't implement a method that determines if there are multiple worlds visible (since it wasn't necessary).

@spyhunter99

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 6, 2018

no problem. I was trying to find an elegant solution to determining if the map view's boundbox was abnormal, meaning multiple worlds present. This branch adds bounding box checks on lines and polygons to reduce draw time. Calculating if the bounds of the overlay overlap the bounds of the map view turned out to be difficult when multiple worlds are present. As a work around, I just checked if the zoom was less than 3

spyhunter99 added a commit that referenced this issue Feb 10, 2018
spyhunter99 added a commit that referenced this issue Feb 17, 2018
# Conflicts:
#	OpenStreetMapViewer/src/main/java/org/osmdroid/samplefragments/BaseSampleFragment.java
#	osmdroid-android/src/main/java/org/osmdroid/views/overlay/Overlay.java
#	osmdroid-android/src/main/java/org/osmdroid/views/overlay/Polyline.java
spyhunter99 added a commit that referenced this issue Feb 19, 2018
spyhunter99 added a commit that referenced this issue Feb 19, 2018
… the minimum zoom level required for drawing.
spyhunter99 added a commit that referenced this issue Feb 19, 2018
@pasniak

This comment has been minimized.

Copy link
Contributor

commented Feb 24, 2018

Why dbase and not sqlite?

@spyhunter99

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 24, 2018

That's the esri spec. Normally it's a zip file with 5 or 6 files in it.

spyhunter99 added a commit that referenced this issue Feb 24, 2018
spyhunter99 added a commit that referenced this issue Feb 24, 2018
@pasniak

This comment has been minimized.

Copy link
Contributor

commented Feb 25, 2018

there's a typo mMinmiumZoom in Polygon.java

spyhunter99 added a commit that referenced this issue Mar 16, 2018
spyhunter99 added a commit that referenced this issue Mar 17, 2018
spyhunter99 added a commit that referenced this issue Mar 17, 2018
spyhunter99 added a commit that referenced this issue Sep 28, 2019
# Conflicts:
#	OpenStreetMapViewer/src/main/java/org/osmdroid/samplefragments/BaseSampleFragment.java
#	osmdroid-android/src/main/java/org/osmdroid/views/overlay/DefaultOverlayManager.java
#	osmdroid-android/src/main/java/org/osmdroid/views/overlay/Marker.java
#	osmdroid-android/src/main/java/org/osmdroid/views/overlay/Polygon.java
#	osmdroid-android/src/main/java/org/osmdroid/views/overlay/Polyline.java
#	osmdroid-android/src/test/java/org/osmdroid/util/BoundingBoxTest.java
spyhunter99 added a commit that referenced this issue Sep 29, 2019
spyhunter99 added a commit that referenced this issue Sep 29, 2019
…wing speeds with zoomed in, zoomed out is still poor
spyhunter99 added a commit that referenced this issue Sep 29, 2019
spyhunter99 added a commit that referenced this issue Sep 29, 2019
spyhunter99 added a commit that referenced this issue Oct 3, 2019
…polygons and markers (#937)

* #906 exerpimental shape reader

* #906 adding additional overrides for shape conversion

* #906 work in progress with bounds calculation

* #908 reasonable balance of performance with polygins + point reduction + view bounds trimming

* #906 shape file +  #890 polygon automagic point reduction + #770 adding bounding box

* #906 temporarily disabling the dbase reader until that's published

* #906 fixing the unit tests and adding a field to polygon for defining the minimum zoom level required for drawing.

* #906 disabling point reduction by default

* #906 merging master and fixing the unit tests

* #906 typo

* #906 removing the id field to alighn with #968. typos

* #906 improved shape file support

* #906 enables bounds checks on overlays significant improvement in drawing speeds with zoomed in, zoomed out is still poor

* #906 readme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.