smallAreaHealthStatisticsUnit / rapidInquiryFacility

The Rapid Inquiry Facility (RIF) helps epidemiologists and public health researchers in environmental health activities.
GNU Lesser General Public License v3.0
14 stars 5 forks source link

Png tiles from geojson #118

Closed peterhambly closed 5 years ago

peterhambly commented 5 years ago

PNG Tile Generation

Adds the ability to use tiles instead of GeoJSON in the front end, Currently only integrated to the when load a large area study from a JSON file.

The tiles generation has highlighted a bug in the UK geography in the Scottish highlands - I needed to clean the data to remove some spurious lines and points. This patch just effects graphics generation - tiles and the shapefiles.

For geolevels with more than 5000 areas the RIF middleware can auto generate PNG tiles on startup. If you do not do this the tiles will be generated on the fly; this can take up to 60 seconds per tile for the most complex tiles with >200,000 areas. Tiles are then cached.

To rebuild the cache delete the tiles scratchSpace directory: c:\rifDemo\scratchSpace\scratchSpace\tiles\ For UK 2011 census geography this typically takes 10 to 20 minutes. You need to edit the conf directory RIFServiceStartupProperties.properties:

#
# Tile generator: set if you need automatic tile generation for geolevels with more than 5000 areas 
# (see: disableMouseClicksAt in frontEndParameters.json5)
#
tileGeneratorUsername=<username>
tileGeneratorPassword=<password>

This processing requires 7G of memory; edit %CATALINA_HOME%/bin/setenv.bat to add -Xmx7g to CATALINA_OPTS:

Exception in thread "http-nio-8080-AsyncTimeout"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "http-nio-8080-AsyncTimeout"
Exception in thread "http-nio-8080-ClientPoller-0" java.lang.OutOfMemoryError: GC overhead limit exceeded

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "ajp-nio-8009-ClientPoller-1"
Exception in thread "http-nio-8080-exec-1" Exception in thread "http-nio-8080-exec-2" java.lang.OutOfMemoryError: GC overhead limit
exceeded
Exception in thread "http-nio-8080-exec-6"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "http-nio-8080-exec-6"
java.lang.OutOfMemoryError: GC overhead limit exceeded
Exception in thread "pool-611-thread-1" java.lang.OutOfMemoryError: GC overhead limit exceeded
Exception in thread "ajp-nio-8009-exec-3" Exception in thread "http-nio-8080-exec-12" java.lang.OutOfMemoryError: GC overhead limit
exceeded
java.lang.OutOfMemoryError: GC overhead limit exceeded

Code has been upgraded to Javadoc standards

peterhambly commented 5 years ago

I will refactor the code as suggested.

devilgate commented 5 years ago

I thought this was ready to merge. Surprised you're still adding to it. What's the status?

peterhambly commented 5 years ago

I am still making suggest changes; will ask for a further review.

devilgate commented 5 years ago

Are you finished with this, Peter? Can we merge it?

peterhambly commented 5 years ago

Have added error traps for PNG tile loading errors. Have also set maxNativeZoom: 11 to avoid: Error code is 'INVALID_ZOOM_FACTOR'. Message list is: '12 is an invalid zoom factor. It must be a number in [0,11]. middleware errors. If a PNG tile for zoomlevel 10 or 11 is required it is generated on the fly. This make not complete in time and this will generate and error. The user is warned that this has occurred and to try again in one minute. Ideally this should not occur as the TileLayer should handle this with a longer timeout and re-tries; e.g: https://jsfiddle.net/rendrom/0bef9r7z/

Now ready to merge into master. Will merge at the same time as pull #135